@@ -44,6 +44,41 @@ def test_find_element_with_non_defaults(driver, element):
44
44
mock .call (By .XPATH , mock_xpath_path )]
45
45
46
46
47
+ def test_find_elements_with_defaults (driver , element ):
48
+ """ Verify the waiter can find and return all elements
49
+ """
50
+ mock_css_path = "div.mock-css-path"
51
+
52
+ driver .find_elements .side_effect = [None , [element , element ]]
53
+
54
+ elem_list = waiter .find_elements (driver , mock_css_path )
55
+
56
+ assert driver .find_elements .called
57
+ assert isinstance (elem_list , list )
58
+ assert all (map (lambda x : x is element , elem_list ))
59
+ assert len (driver .mock_calls ) == 2
60
+ assert driver .find_elements .call_args_list == [mock .call (CSS , mock_css_path ),
61
+ mock .call (CSS , mock_css_path )]
62
+
63
+
64
+ def test_find_elements_with_non_defaults (driver , element ):
65
+ """ Verify the waiter can find and return all elements when using
66
+ non-default kwargs
67
+ """
68
+ mock_xpath_path = "div[@id=mock-id]"
69
+
70
+ driver .find_elements .side_effect = [None , [element , element ]]
71
+
72
+ elem_list = waiter .find_elements (driver , mock_xpath_path , by = By .XPATH )
73
+
74
+ assert driver .find_elements .called
75
+ assert isinstance (elem_list , list )
76
+ assert all (map (lambda x : x is element , elem_list ))
77
+ assert len (driver .mock_calls ) == 2
78
+ assert driver .find_elements .call_args_list == [mock .call (By .XPATH , mock_xpath_path ),
79
+ mock .call (By .XPATH , mock_xpath_path )]
80
+
81
+
47
82
def test_find_write_with_defaults (driver , element ):
48
83
""" Verify the waiter can find and write to an element, using
49
84
default kwargs
0 commit comments