Esempio n. 1
0
 def test_wait_for_and_input_password_with_timeout(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_input_password(mock_gui, "some_locator",
                                            "text", 5)
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator", 5)
     mock_gui.input_password.assert_called_with("some_locator", "text")
Esempio n. 2
0
 def test_wait_for_and_select_window_simple(self, robot_call):
     mock_gui = Mock()
     type(mock_gui).timeout = PropertyMock(return_value=15)
     GUILibrary.wait_for_and_select_window(mock_gui, "title")
     robot_call.assert_called_with(15, 1, 'Wait Until Window Opens',
                                   'title')
     mock_gui.select_window.assert_called_with("title")
Esempio n. 3
0
 def test_wait_for_mouse_over_and_click_simple(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_mouse_over_and_click(mock_gui, "some_locator")
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator")
     mock_gui.mouse_over.assert_called_with("some_locator")
     mock_gui.click_element.assert_called_with("some_locator")
Esempio n. 4
0
 def test_select_nested_frame(self):
     mock_gui = Mock()
     GUILibrary.select_nested_frame(mock_gui, "some_locator",
                                    "another_locator", "one_more")
     mock_gui.wait_until_page_contains_element.assert_called_with(
         "one_more")
     mock_gui.select_frame.assert_called_with("one_more")
Esempio n. 5
0
 def test_wait_for_and_click_element_simple(self):
     mock_gui = Mock()
     mock_gui.timeout = 10.5
     GUILibrary.wait_for_and_click_element(mock_gui, "some_locator")
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator", None)
     mock_gui.click_element.assert_called_with("some_locator")
 def test_wait_for_and_focus_with_timeout_override(self, robot_call):
     mock_gui = Mock()
     mock_gui.timeout = 15
     GUILibrary.wait_for_and_focus_on_element(mock_gui, "some_locator", 10)
     mock_gui.wait_until_page_contains_element.assert_called_with("some_locator", 10)
     robot_call.assert_called_with(10, 1, "Set Focus To Element", "some_locator")
     mock_gui.wait_until_element_is_visible.assert_called_with("some_locator", 10)
Esempio n. 7
0
 def test_wait_until_element_contains_value(self, robot_call):
     mock_gui = Mock()
     GUILibrary.wait_until_element_contains_value(mock_gui, "some_locator",
                                                  "expected_value")
     mock_gui.wait_until_page_contains_element.assert_called_with(
         "some_locator", None)
     mock_gui.get_value = Mock(return_value="expected_value")
     robot_call.assert_called()
Esempio n. 8
0
 def test_wait_for_and_select_from_list_by_value_with_timeout(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_select_from_list_by_value(
         mock_gui, "some_locator", "target", 11)
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator", 11)
     mock_gui.select_from_list_by_value.assert_called_with(
         "some_locator", "target")
Esempio n. 9
0
 def test_wait_for_and_select_from_list_by_index_simple(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_select_from_list_by_index(
         mock_gui, "some_locator", "target")
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator")
     mock_gui.select_from_list_by_index.assert_called_with(
         "some_locator", "target")
Esempio n. 10
0
 def test_create_dictionary_from_keys_and_values_lists_fail(
         self, robot_call):
     mock_gui = Mock()
     GUILibrary.create_dictionary_from_keys_and_values_lists(
         mock_gui, [5], [6, 7])
     robot_call.assert_called_with(
         "The length of the keys and values lists is not the same: \nKeys Length: "
         + "1" + "\nValues Length: " + "2", "ERROR")
Esempio n. 11
0
 def test_unselect_and_select_frame_with_timeout(self):
     mock_gui = Mock()
     GUILibrary.unselect_and_select_frame(mock_gui,
                                          "some_locator",
                                          timeout=7.5)
     mock_gui.wait_for_and_select_frame.assert_called_with(
         "some_locator", 7.5)
     mock_gui.unselect_frame.assert_called()
Esempio n. 12
0
 def test_wait_for_and_select_from_list_simple(self):
     mock_gui = Mock()
     mock_gui.timeout = 12
     GUILibrary.wait_for_and_select_from_list(mock_gui, "some_locator",
                                              "target")
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator", None)
     mock_gui.select_from_list_by_label.assert_called_with(
         "some_locator", "target")
Esempio n. 13
0
 def test_get_react_list_labels_simple(self):
     mock_gui = Mock()
     mock_webelement = Mock()
     mock_webelement.tag_name.lower = Mock(return_value='div')
     mock_gui.find_element = Mock(return_value=mock_webelement)
     with patch('Zoomba.Helpers.ReactSelect.ReactSelect.options'
                ) as mock_options:
         GUILibrary.get_react_list_labels(mock_gui, "some_locator")
         mock_gui.find_element.assert_called_with("some_locator")
         mock_options.assert_called()
Esempio n. 14
0
 def test_wait_for_and_focus_simple(self, robot_call):
     mock_gui = Mock()
     type(mock_gui).timeout = PropertyMock(return_value=15)
     GUILibrary.wait_for_and_focus_on_element(mock_gui, "some_locator")
     mock_gui.wait_until_page_contains_element.assert_called_with(
         "some_locator")
     robot_call.assert_called_with(15, 1, "Set Focus To Element",
                                   "some_locator")
     mock_gui.wait_until_element_is_visible.assert_called_with(
         "some_locator")
Esempio n. 15
0
 def test_get_element_css_attribute_value(self):
     mock_gui = Mock()
     mock_gui.get_webelement().value_of_css_property = Mock(
         return_value="some_attribute_value")
     value = GUILibrary.get_element_css_attribute_value(
         mock_gui, "some_locator", "some_attribute")
     self.assertEqual(value, "some_attribute_value")
Esempio n. 16
0
 def test_get_react_list_labels_values(self):
     mock_gui = Mock()
     mock_webelement = Mock()
     mock_webelement.tag_name.lower = Mock(return_value='div')
     mock_option1 = Mock()
     mock_option1.text = 'option1'
     mock_option2 = Mock()
     mock_option2.text = 'option2'
     mock_gui.find_element = Mock(return_value=mock_webelement)
     with patch('Zoomba.Helpers.ReactSelect.ReactSelect.options',
                return_value=[mock_option1, mock_option2]):
         assert GUILibrary.get_react_list_labels(
             mock_gui, "some_locator") == ['option1', 'option2']
Esempio n. 17
0
 def test_wait_until_window_closes_simple(self, robot_call):
     mock_gui = Mock()
     type(mock_gui).timeout = PropertyMock(return_value=15)
     GUILibrary.wait_until_window_closes(mock_gui, "title")
     robot_call.assert_called_with(15, 1, "Window Should Not Be Open",
                                   "title")
Esempio n. 18
0
 def test_should_not_be_equal_simple(self, robot_call):
     mock_gui = Mock()
     mock_gui.get_value = Mock(return_value="other_value")
     GUILibrary.element_value_should_not_be_equal(mock_gui, "some_locator",
                                                  "expected_value")
     robot_call.assert_called_with("other_value", "expected_value")
Esempio n. 19
0
 def test_drag_and_drop_by_js_false(self):
     mock_gui = Mock()
     GUILibrary.drag_and_drop_by_js(mock_gui, "source", "target", False)
     mock_gui.driver.execute_async_script.assert_not_called()
     mock_gui.driver.execute_script.assert_called()
Esempio n. 20
0
 def test_window_should_not_be_open_simple(self, robot_call):
     mock_gui = Mock()
     mock_gui.get_window_titles = Mock(return_value=["main"])
     GUILibrary.window_should_not_be_open(mock_gui, "title")
     robot_call.assert_called_with(["main"], "title")
Esempio n. 21
0
 def test_truncate_string_simple(self):
     mock_gui = Mock()
     assert GUILibrary.truncate_string(mock_gui, "string", 3) == "str"
Esempio n. 22
0
 def test_create_dictionary_from_keys_and_values_lists_simple(self):
     mock_gui = Mock()
     assert GUILibrary.create_dictionary_from_keys_and_values_lists(
         mock_gui, [5], [6]) == {
             5: 6
         }
Esempio n. 23
0
 def test_wait_until_javascript_is_complete_simple(self, robot_call):
     mock_gui = Mock()
     mock_gui.execute_javascript = Mock(
         side_effect=[False, True, False, True])
     GUILibrary.wait_until_javascript_is_complete(mock_gui)
     robot_call.assert_called()
Esempio n. 24
0
 def test_unselect_and_select_frame_simple(self):
     mock_gui = Mock()
     GUILibrary.unselect_and_select_frame(mock_gui, "some_locator")
     mock_gui.wait_for_and_select_frame.assert_called_with("some_locator")
     mock_gui.unselect_frame.assert_called()
Esempio n. 25
0
 def test_wait_for_and_input_text_simple(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_input_text(mock_gui, "some_locator", "text")
     mock_gui.wait_for_and_focus_on_element.assert_called_with(
         "some_locator")
     mock_gui.input_text.assert_called_with("some_locator", "text")
Esempio n. 26
0
 def test_get_vertical_position_from_web_elements_list_simple(
         self, robot_call):
     mock_gui = Mock()
     mock_gui.get_vertical_position = Mock(side_effect=[1, 2])
     assert GUILibrary.get_vertical_position_from_web_elements_list(
         mock_gui, ['a', 'b']) == [1, 2]
Esempio n. 27
0
 def test_wait_for_and_select_frame_simple(self):
     mock_gui = Mock()
     GUILibrary.wait_for_and_select_frame(mock_gui, "some_locator")
     mock_gui.wait_until_page_contains_element.assert_called_with(
         "some_locator")
     mock_gui.select_frame.assert_called_with("some_locator")
Esempio n. 28
0
 def test_scroll_to_bottom_of_page_simple(self):
     mock_gui = Mock()
     mock_gui.execute_javascript = Mock(return_value=20)
     GUILibrary.scroll_to_bottom_of_page(mock_gui)
     mock_gui.execute_javascript.assert_called_with("window.scrollTo(0,20)")
Esempio n. 29
0
 def test_get_values_from_web_elements_list_simple(self, robot_call):
     mock_gui = Mock()
     mock_gui.get_value = Mock(side_effect=['a', 'b'])
     assert GUILibrary.get_values_from_web_elements_list(
         mock_gui, ['a', 'b']) == ['a', 'b']
Esempio n. 30
0
 def test_scroll_to_bottom_of_page_exception(self):
     mock_gui = Mock()
     mock_gui.execute_javascript = Mock(side_effect=[BaseException, True])
     GUILibrary.scroll_to_bottom_of_page(mock_gui)
     mock_gui.execute_javascript.assert_called_with(
         "window.scrollTo(0,20000)")