Best Python code snippet using robotframework-appiumlibrary_python
test_desktop.py
Source:test_desktop.py
1import sys2import os3import psutil4import unittest5import subprocess6from selenium.common.exceptions import WebDriverException, NoSuchElementException, InvalidSelectorException7from ApplicationLibrary.DesktopLibrary import DesktopLibrary8from appium import webdriver9from unittest.mock import MagicMock, patch10sys.path.append(os.path.join(os.path.dirname(sys.path[0]), 'Helpers'))11from webdriverremotemock import WebdriverRemoteMock12from selenium.webdriver.remote.webelement import WebElement13from appium.webdriver.common.touch_action import TouchAction14def _long_running_function():15 while True:16 return 'Error'17class TestInternal(unittest.TestCase):18 def test_get_keyword_names_successful(self):19 DesktopLibrary().get_keyword_names()20 @patch('subprocess.call')21 @patch('subprocess.Popen')22 def test_driver_setup_and_teardown(self, Popen, call):23 Popen.return_value = 124 dl = DesktopLibrary()25 dl.driver_setup()26 self.assertTrue(dl.winappdriver.process)27 dl.driver_teardown()28 self.assertFalse(dl.winappdriver.process)29 @patch('subprocess.Popen')30 def test_driver_setup_failure(self, Popen):31 Popen.side_effect = Exception32 dl = DesktopLibrary()33 dl.driver_setup()34 self.assertFalse(dl.winappdriver.process)35 @patch('subprocess.call')36 def test_teardown_without_setup(self, call):37 dl = DesktopLibrary()38 dl.driver_teardown()39 self.assertFalse(dl.winappdriver.process)40 def test_driver_child_process_teardown(self):41 mock_child = MagicMock()42 dl = DesktopLibrary()43 dl.winappdriver.process = MagicMock()44 dl.winappdriver.process.pid = 145 psutil.Process.create_time = MagicMock()46 psutil.Process.children = MagicMock(return_value=[mock_child])47 self.assertFalse(dl.winappdriver.process is None)48 dl.driver_teardown()49 self.assertTrue(dl.winappdriver.process is None)50 def test_open_application_successful(self):51 dl = DesktopLibrary()52 webdriver.Remote = WebdriverRemoteMock53 self.assertFalse(dl._cache.current)54 dl.open_application('remote_url')55 self.assertTrue(dl._cache.current)56 def test_open_application_with_working_dir_successful(self):57 dl = DesktopLibrary()58 webdriver.Remote = WebdriverRemoteMock59 self.assertFalse(dl._cache.current)60 dl.open_application('remote_url', appWorkingDir='C:/Windows/System32')61 self.assertTrue(dl._cache.current)62 def test_open_application_failure(self):63 dl = DesktopLibrary()64 dl._open_desktop_session = MagicMock()65 webdriver.Remote = MagicMock()66 webdriver.Remote.side_effect = WebDriverException('error')67 self.assertRaisesRegex(AssertionError, 'Message: error', dl.open_application, 'remote_url')68 def test_open_multiple_applications_successful(self):69 dl = DesktopLibrary()70 webdriver.Remote = WebdriverRemoteMock71 dl.open_application('remote_url', alias='App1')72 dl.open_application('remote_url', alias='App2', desktop_alias='Desktop2')73 dl.switch_application('Desktop')74 dl.switch_application('Desktop2')75 self.assertRaisesRegex(RuntimeError, "Non-existing index or alias 'Desktop3'.", dl.switch_application,76 'Desktop3')77 def test_open_application_successful_double(self):78 dl = DesktopLibrary()79 webdriver.Remote = WebdriverRemoteMock80 self.assertFalse(dl._cache.current)81 dl.open_application('remote_url')82 self.assertTrue(dl._cache.current)83 dl.open_application('remote_url')84 self.assertTrue(dl._cache.current)85 def test_open_application_splash_catch(self):86 dl = DesktopLibrary()87 subprocess.Popen = MagicMock()88 webdriver.Remote = WebdriverRemoteMock89 self.assertFalse(dl._cache.current)90 dl.open_application('remote_url', window_name='test', app='testApp', splash_delay=1)91 self.assertTrue(dl._cache.current)92 def test_open_application_splash_catch_double(self):93 dl = DesktopLibrary()94 subprocess.Popen = MagicMock()95 webdriver.Remote = WebdriverRemoteMock96 self.assertFalse(dl._cache.current)97 dl.open_application('remote_url', window_name='test', app='testApp', splash_delay=1)98 self.assertTrue(dl._cache.current)99 dl.open_application('remote_url', window_name='test2', app='testApp', splash_delay=1)100 self.assertTrue(dl._cache.current)101 def test_open_application_window_name_non_exact(self):102 dl = DesktopLibrary()103 subprocess.Popen = MagicMock()104 webdriver.Remote = WebdriverRemoteMock105 webdriver.Remote.find_element_by_xpath = MagicMock()106 self.assertFalse(dl._cache.current)107 dl.open_application('remote_url', window_name='test', app='testApp', exact_match=False)108 self.assertTrue(dl._cache.current)109 def test_switch_application_with_end_whitespace(self):110 dl = DesktopLibrary()111 dl._run_on_failure = MagicMock()112 webdriver.Remote = WebdriverRemoteMock113 webdriver.Remote.find_element_by_name = MagicMock()114 dl.switch_application_by_name('remote_url', window_name='name with end whitespace ')115 webdriver.Remote.find_element_by_name.assert_called_with('name with end whitespace ')116 def test_switch_application_failure(self):117 dl = DesktopLibrary()118 dl._run_on_failure = MagicMock()119 webdriver.Remote = WebdriverRemoteMock120 webdriver.Remote.find_element_by_name = MagicMock(side_effect=[WebDriverException, WebDriverException])121 self.assertRaisesRegex(AssertionError, 'Error finding window "test" in the desktop session. Is it a top level '122 'window handle?.', dl.switch_application_by_name,123 'remote_url', window_name='test')124 def test_switch_application_failure_2(self):125 dl = DesktopLibrary()126 dl._run_on_failure = MagicMock()127 webdriver.Remote = WebdriverRemoteMock128 webdriver.Remote.find_element_by_name = MagicMock()129 webdriver.Remote.find_element_by_name.side_effect = [WebDriverException, "Window", "Window"]130 self.assertRaisesRegex(AssertionError, 'Error finding window "test" in the desktop session. Is it a top level '131 'window handle?.', dl.switch_application_by_name,132 'remote_url', window_name='test')133 def test_switch_application_failure_3(self):134 dl = DesktopLibrary()135 dl._run_on_failure = MagicMock()136 web_driver_mock = WebdriverRemoteMock137 webdriver.Remote = MagicMock(side_effect=[web_driver_mock, Exception])138 web_driver_mock.find_element_by_name = MagicMock()139 web_driver_mock.quit = MagicMock(return_value=True)140 self.assertRaisesRegex(AssertionError, 'Error connecting webdriver to window "test".',141 dl.switch_application_by_name, 'remote_url', window_name='test')142 def test_switch_application_failure_4(self):143 dl = DesktopLibrary()144 dl._run_on_failure = MagicMock()145 webdriver.Remote = WebdriverRemoteMock146 webdriver.Remote.find_element_by_xpath = MagicMock(side_effect=[WebDriverException, MagicMock(), MagicMock()])147 dl.switch_application_by_name('remote_url', window_name='test', exact_match=False)148 def test_switch_application_by_locator_success(self):149 dl = DesktopLibrary()150 dl._run_on_failure = MagicMock()151 webdriver.Remote = WebdriverRemoteMock152 webdriver.Remote.find_element_by_class_name = MagicMock(side_effect=[MagicMock()])153 dl.switch_application_by_locator('remote_url', locator='class=test')154 self.assertTrue(dl._cache.current)155 def test_switch_application_by_locator_success_2(self):156 dl = DesktopLibrary()157 dl._run_on_failure = MagicMock()158 webdriver.Remote = WebdriverRemoteMock159 webdriver.Remote.find_element_by_class_name = MagicMock(WebDriverException, MagicMock(), MagicMock())160 dl.switch_application_by_locator('remote_url', locator='class=test')161 self.assertTrue(dl._cache.current)162 def test_switch_application_by_locator_success_3(self):163 dl = DesktopLibrary()164 dl._run_on_failure = MagicMock()165 webdriver.Remote = WebdriverRemoteMock166 webdriver.Remote.find_element_by_name = MagicMock(side_effect=[MagicMock()])167 dl.switch_application_by_locator('remote_url', name='test', app='some_app')168 self.assertTrue(dl._cache.current)169 def test_switch_application_by_locator_failure(self):170 dl = DesktopLibrary()171 dl._run_on_failure = MagicMock()172 webdriver.Remote = WebdriverRemoteMock173 webdriver.Remote.find_element_by_class_name = MagicMock(side_effect=[WebDriverException, WebDriverException])174 self.assertRaisesRegex(AssertionError, 'Error finding window "class=test" in the desktop session. Is it a top level '175 'window handle?.', dl.switch_application_by_locator,176 'remote_url', locator='class=test')177 def test_switch_application_by_locator_failure_2(self):178 dl = DesktopLibrary()179 dl._run_on_failure = MagicMock()180 webdriver.Remote = WebdriverRemoteMock181 webdriver.Remote.find_element_by_name = MagicMock()182 webdriver.Remote.find_element_by_name.side_effect = [WebDriverException, MagicMock(), WebDriverException]183 self.assertRaisesRegex(AssertionError, 'Error finding window "name=test" in the desktop session. Is it a top level '184 'window handle?.', dl.switch_application_by_locator,185 'remote_url', locator='name=test')186 def test_switch_application_by_locator_failure_3(self):187 dl = DesktopLibrary()188 dl._run_on_failure = MagicMock()189 web_driver_mock = WebdriverRemoteMock190 webdriver.Remote = MagicMock(side_effect=[web_driver_mock, Exception])191 web_driver_mock.find_element_by_xpath = MagicMock()192 web_driver_mock.quit = MagicMock(return_value=True)193 self.assertRaisesRegex(AssertionError, 'Error connecting webdriver to window "xpath=//test".',194 dl.switch_application_by_locator, 'remote_url', locator='xpath=//test')195 def test_switch_application_multi_desktop_successful(self):196 dl = DesktopLibrary()197 webdriver.Remote = WebdriverRemoteMock198 dl.open_application('remote_url', alias='App1')199 dl.open_application('remote_url', alias='App2', desktop_alias='Desktop2')200 self.assertEqual(dl.current_desktop, 'Desktop2')201 dl.switch_application('App1')202 self.assertEqual(dl.current_desktop, 'Desktop2')203 dl.switch_application('App1', 'Desktop')204 self.assertEqual(dl.current_desktop, 'Desktop')205 def test_switch_application_no_alias_or_index_failure(self):206 dl = DesktopLibrary()207 webdriver.Remote = WebdriverRemoteMock208 dl.open_application('remote_url', alias='App1')209 dl.open_application('remote_url', alias='App2', desktop_alias='Desktop2')210 dl.switch_application(None)211 self.assertFalse(dl._cache.current)212 def test_launch_application_successful(self):213 dl = DesktopLibrary()214 webdriver.Remote = WebdriverRemoteMock215 self.assertFalse(dl._cache.current)216 dl.open_application('remote_url')217 dl.quit_application()218 dl.launch_application()219 self.assertTrue(dl._cache.current)220 def test_maximize_window_successful(self):221 mock_desk = MagicMock()222 self.assertTrue(DesktopLibrary.maximize_window(mock_desk))223 def test_wait_for_and_clear_text_simple(self):224 mock_desk = MagicMock()225 DesktopLibrary.wait_for_and_clear_text(mock_desk, "some_locator")226 mock_desk.current_element.clear.assert_called()227 def test_wait_for_and_click_element(self):228 mock_desk = MagicMock()229 DesktopLibrary.wait_for_and_click_element(mock_desk, "some_locator")230 mock_desk.current_element.click.assert_called()231 def test_click_element(self):232 mock_desk = MagicMock()233 DesktopLibrary.click_element(mock_desk, "some_locator")234 mock_desk._element_find.assert_called_with("some_locator", True, True)235 def test_wait_for_and_input_password(self):236 mock_desk = MagicMock()237 DesktopLibrary.wait_for_and_input_password(mock_desk, "some_locator", "some_text")238 mock_desk.current_element.send_keys.assert_called_with("some_text")239 def test_wait_for_and_input_text(self):240 mock_desk = MagicMock()241 DesktopLibrary.wait_for_and_input_text(mock_desk, "some_locator", "some_text")242 mock_desk.current_element.send_keys.assert_called_with("some_text")243 @patch("appium.webdriver.common.touch_action.TouchAction.press")244 def test_wait_for_and_long_press(self, press):245 mock_desk = MagicMock()246 DesktopLibrary.wait_for_and_long_press(mock_desk, "some_locator", 1000)247 press.assert_called()248 def test_wait_until_element_contains(self):249 mock_desk = MagicMock()250 DesktopLibrary.wait_until_element_contains(mock_desk, "some_locator", 'test_text')251 mock_desk.element_should_contain_text.assert_called_with(unittest.mock.ANY, "test_text", None)252 def test_wait_until_element_does_not_contain(self):253 mock_desk = MagicMock()254 DesktopLibrary.wait_until_element_does_not_contain(mock_desk, "some_locator", 'test_text')255 mock_desk.element_should_not_contain_text.assert_called_with(unittest.mock.ANY, "test_text", None)256 def test_element_should_be_enabled(self):257 mock_desk = MagicMock()258 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=True)259 DesktopLibrary.element_should_be_enabled(mock_desk, "some_locator")260 mock_desk._check_for_cached_element().is_enabled.assert_called_with()261 def test_element_should_be_enabled_error(self):262 mock_desk = MagicMock()263 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=False)264 self.assertRaisesRegex(AssertionError, "Element 'some_locator' should be enabled but did "265 "not", DesktopLibrary.element_should_be_enabled, mock_desk,266 "some_locator")267 mock_desk._check_for_cached_element().is_enabled.assert_called_with()268 def test_element_should_be_enabled_current_element_set(self):269 mock_desk = MagicMock()270 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=True)271 DesktopLibrary.element_should_be_enabled(mock_desk, mock_desk.current_element)272 mock_desk._check_for_cached_element().is_enabled.assert_called_with()273 def test_element_should_be_disabled(self):274 mock_desk = MagicMock()275 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=False)276 DesktopLibrary.element_should_be_disabled(mock_desk, "some_locator")277 mock_desk._check_for_cached_element().is_enabled.assert_called_with()278 def test_element_should_be_disabled_error(self):279 mock_desk = MagicMock()280 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=True)281 self.assertRaisesRegex(AssertionError, "Element 'some_locator' should be disabled but did "282 "not", DesktopLibrary.element_should_be_disabled, mock_desk,283 "some_locator")284 mock_desk._check_for_cached_element().is_enabled.assert_called_with()285 def test_element_should_be_disabled_current_element_set(self):286 mock_desk = MagicMock()287 mock_desk.current_element = MagicMock()288 mock_desk._check_for_cached_element().is_enabled = MagicMock(return_value=False)289 DesktopLibrary.element_should_be_disabled(mock_desk, mock_desk.current_element)290 mock_desk._check_for_cached_element().is_enabled.assert_called_with()291 def test_wait_until_element_is_enabled(self):292 mock_desk = MagicMock()293 DesktopLibrary.wait_until_element_is_enabled(mock_desk, "some_locator")294 mock_desk.element_should_be_enabled.assert_called_with(unittest.mock.ANY)295 def test_wait_until_element_is_disabled(self):296 mock_desk = MagicMock()297 DesktopLibrary.wait_until_element_is_disabled(mock_desk, "some_locator")298 mock_desk.element_should_be_disabled.assert_called_with(unittest.mock.ANY)299 def test_is_disabled(self):300 mock_desk = MagicMock()301 mock_element = MagicMock()302 mock_element.is_enabled = MagicMock(return_value=False)303 self.assertTrue(DesktopLibrary.is_disabled(mock_desk, mock_element))304 def test_mouse_over_element(self):305 mock_desk = MagicMock()306 DesktopLibrary.mouse_over_element(mock_desk, "some_locator")307 mock_desk._move_to_element.assert_called_with(unittest.mock.ANY, unittest.mock.ANY, 0, 0)308 def test_mouse_over_element_current_element_set(self):309 mock_desk = MagicMock()310 mock_desk.current_element = MagicMock()311 DesktopLibrary.mouse_over_element(mock_desk, mock_desk.current_element)312 mock_desk._move_to_element.assert_called_with(unittest.mock.ANY, unittest.mock.ANY, 0, 0)313 def test_mouse_over_element_with_offset(self):314 mock_desk = MagicMock()315 DesktopLibrary.mouse_over_element(mock_desk, "some_locator", x_offset=100, y_offset=100)316 mock_desk._move_to_element.assert_called_with(unittest.mock.ANY, unittest.mock.ANY, 100, 100)317 def test_mouse_over_and_click_element(self):318 mock_desk = MagicMock()319 DesktopLibrary.mouse_over_and_click_element(mock_desk, "some_locator")320 mock_desk.mouse_over_element.assert_called_with("some_locator", x_offset=0, y_offset=0)321 mock_desk.click_a_point.assert_called_with(double_click=False)322 def test_mouse_over_and_click_element_with_offset(self):323 mock_desk = MagicMock()324 DesktopLibrary.mouse_over_and_click_element(mock_desk, "some_locator", x_offset=100, y_offset=100)325 mock_desk.mouse_over_element.assert_called_with("some_locator", x_offset=100, y_offset=100)326 mock_desk.click_a_point.assert_called_with(double_click=False)327 def test_mouse_over_and_context_click_element(self):328 mock_desk = MagicMock()329 DesktopLibrary.mouse_over_and_context_click_element(mock_desk, "some_locator")330 mock_desk.mouse_over_element.assert_called_with("some_locator", x_offset=0, y_offset=0)331 mock_desk.context_click_a_point.assert_called_with()332 def test_mouse_over_and_context_click_element_with_offset(self):333 mock_desk = MagicMock()334 DesktopLibrary.mouse_over_and_context_click_element(mock_desk, "some_locator", x_offset=100, y_offset=100)335 mock_desk.mouse_over_element.assert_called_with("some_locator", x_offset=100, y_offset=100)336 mock_desk.context_click_a_point.assert_called_with()337 def test_mouse_over_and_click_element_with_double_click(self):338 mock_desk = MagicMock()339 DesktopLibrary.mouse_over_and_click_element(mock_desk, "some_locator", True)340 mock_desk.mouse_over_element.assert_called_with("some_locator", x_offset=0, y_offset=0)341 mock_desk.click_a_point.assert_called_with(double_click=True)342 def test_wait_for_and_mouse_over_element(self):343 mock_desk = MagicMock()344 DesktopLibrary.wait_for_and_mouse_over_element(mock_desk, "some_locator")345 mock_desk.mouse_over_element.assert_called_with(unittest.mock.ANY, 0, 0)346 def test_wait_for_and_mouse_over_element_with_offset(self):347 mock_desk = MagicMock()348 DesktopLibrary.wait_for_and_mouse_over_element(mock_desk, "some_locator", x_offset=100, y_offset=100)349 mock_desk.mouse_over_element.assert_called_with(unittest.mock.ANY, 100, 100)350 def test_wait_for_and_mouse_over_and_click_element(self):351 mock_desk = MagicMock()352 DesktopLibrary.wait_for_and_mouse_over_and_click_element(mock_desk, "some_locator")353 mock_desk.mouse_over_and_click_element.assert_called_with(unittest.mock.ANY, False, 0, 0)354 def test_wait_for_and_mouse_over_and_click_element_with_offset(self):355 mock_desk = MagicMock()356 DesktopLibrary.wait_for_and_mouse_over_and_click_element(mock_desk, "some_locator", x_offset=100, y_offset=100)357 mock_desk.mouse_over_and_click_element.assert_called_with(unittest.mock.ANY, False, 100, 100)358 def test_wait_for_and_mouse_over_and_click_element_with_double_click(self):359 mock_desk = MagicMock()360 DesktopLibrary.wait_for_and_mouse_over_and_click_element(mock_desk, "some_locator", double_click=True)361 mock_desk.mouse_over_and_click_element.assert_called_with(unittest.mock.ANY, True, 0, 0)362 def test_element_find_by_name(self):363 mock_desk = MagicMock()364 mock_desk._parse_locator = MagicMock(return_value=['name', 'Capture'])365 DesktopLibrary._element_find(mock_desk, "Name='Capture'", True, True)366 mock_desk._current_application().find_element_by_name.assert_called_with('Capture')367 def test_elements_find_by_name(self):368 mock_desk = MagicMock()369 mock_desk._parse_locator = MagicMock(return_value=['name', 'Capture'])370 DesktopLibrary._element_find(mock_desk, "Name='Capture'", False, True)371 mock_desk._current_application().find_elements_by_name.assert_called_with('Capture')372 def test_element_find_by_image(self):373 mock_desk = MagicMock()374 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])375 DesktopLibrary._element_find(mock_desk, "image='file.png", True, True)376 mock_desk._current_application().find_element_by_image.assert_called_with('file.png')377 def test_element_find_by_image_fail(self):378 mock_desk = MagicMock()379 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])380 mock_desk._current_application().find_element_by_image = \381 MagicMock(side_effect=InvalidSelectorException)382 self.assertRaisesRegex(AssertionError, 'Selecting by image is only available when using '383 'Appium v1.18.0 or higher', DesktopLibrary._element_find, mock_desk,384 'file.png', True, True)385 def test_elements_find_by_image(self):386 mock_desk = MagicMock()387 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])388 DesktopLibrary._element_find(mock_desk, "image='file.png", False, True)389 mock_desk._current_application().find_elements_by_image.assert_called_with('file.png')390 def test_elements_find_by_image_fail(self):391 mock_desk = MagicMock()392 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])393 mock_desk._current_application().find_elements_by_image = \394 MagicMock(side_effect=InvalidSelectorException)395 self.assertRaisesRegex(AssertionError, 'Selecting by image is only available when using '396 'Appium v1.18.0 or higher', DesktopLibrary._element_find, mock_desk,397 'file.png', False, True)398 def test_element_find_by_accessibility_id(self):399 mock_desk = MagicMock()400 mock_desk._parse_locator = MagicMock(return_value=['accessibility_id', 'Capture'])401 DesktopLibrary._element_find(mock_desk, "accessibility_id='Capture'", True, True)402 mock_desk._current_application().find_element_by_accessibility_id.assert_called_with('Capture')403 def test_elements_find_by_accessibility_id(self):404 mock_desk = MagicMock()405 mock_desk._parse_locator = MagicMock(return_value=['accessibility_id', 'Capture'])406 DesktopLibrary._element_find(mock_desk, "accessibility_id='Capture'", False, True)407 mock_desk._current_application().find_elements_by_accessibility_id.assert_called_with('Capture')408 def test_element_find_by_element(self):409 mock_desk = MagicMock()410 mock_element = WebElement(MagicMock(), MagicMock())411 value = DesktopLibrary._element_find(mock_desk, mock_element, True, True)412 self.assertEqual(mock_element, value)413 def test_element_find_by_elements(self):414 mock_desk = MagicMock()415 mock_element = WebElement(MagicMock(), MagicMock())416 value = DesktopLibrary._element_find(mock_desk, mock_element, False, True)417 self.assertEqual([mock_element], value)418 def test_element_find_by_class_name(self):419 mock_desk = MagicMock()420 mock_desk._parse_locator = MagicMock(return_value=['class', 'Capture'])421 DesktopLibrary._element_find(mock_desk, "class='Capture'", True, True)422 mock_desk._current_application().find_element_by_class_name.assert_called_with('Capture')423 def test_elements_find_by_class_name(self):424 mock_desk = MagicMock()425 mock_desk._parse_locator = MagicMock(return_value=['class', 'Capture'])426 DesktopLibrary._element_find(mock_desk, "class='Capture'", False, True)427 mock_desk._current_application().find_elements_by_class_name.assert_called_with('Capture')428 def test_element_find_by_xpath(self):429 mock_desk = MagicMock()430 mock_desk._parse_locator = MagicMock(return_value=['xpath', 'Capture'])431 DesktopLibrary._element_find(mock_desk, "xpath=//TreeItem[@Name='Capture']", True, True)432 mock_desk._current_application().find_element_by_xpath.assert_called_with('Capture')433 def test_elements_find_by_xpath(self):434 mock_desk = MagicMock()435 mock_desk._parse_locator = MagicMock(return_value=['xpath', 'Capture'])436 DesktopLibrary._element_find(mock_desk, "xpath=//TreeItem[@Name='Capture']", False, True)437 mock_desk._current_application().find_elements_by_xpath.assert_called_with('Capture')438 def test_element_find_by_default_xpath(self):439 mock_desk = MagicMock()440 mock_desk._parse_locator = MagicMock(return_value=[None, "//TreeItem[@Name='Capture']"])441 DesktopLibrary._element_find(mock_desk, "//TreeItem[@Name='Capture']", True, True)442 mock_desk._current_application().find_element_by_xpath.assert_called_with("//TreeItem[@Name='Capture']")443 def test_elements_find_by_default_xpath(self):444 mock_desk = MagicMock()445 mock_desk._parse_locator = MagicMock(return_value=[None, "//TreeItem[@Name='Capture']"])446 DesktopLibrary._element_find(mock_desk, "//TreeItem[@Name='Capture']", False, True)447 mock_desk._current_application().find_elements_by_xpath.assert_called_with("//TreeItem[@Name='Capture']")448 def test_element_find_by_default_accessibility_id(self):449 mock_desk = MagicMock()450 mock_desk._parse_locator = MagicMock(return_value=[None, "Capture"])451 DesktopLibrary._element_find(mock_desk, "Capture", True, True)452 mock_desk._current_application().find_element_by_accessibility_id.assert_called_with('Capture')453 def test_elements_find_by_default_accessibility_id(self):454 mock_desk = MagicMock()455 mock_desk._parse_locator = MagicMock(return_value=[None, "Capture"])456 DesktopLibrary._element_find(mock_desk, "Capture", False, True)457 mock_desk._current_application().find_elements_by_accessibility_id.assert_called_with('Capture')458 def test_element_find_fail(self):459 mock_desk = MagicMock()460 mock_desk._parse_locator = MagicMock(return_value=['blockbuster_id', '123456789'])461 self.assertRaisesRegex(AssertionError, "Element locator with prefix 'blockbuster_id' is not supported",462 DesktopLibrary._element_find, mock_desk, "blockbuster_id=123456789", True, True)463 def test_is_element_present_by_name(self):464 mock_desk = MagicMock()465 mock_desk._parse_locator = MagicMock(return_value=['name', 'Capture'])466 DesktopLibrary._is_element_present(mock_desk, "Name='Capture'")467 mock_desk._current_application().find_elements_by_name.assert_called_with('Capture')468 def test_is_element_present_by_accessibility_id(self):469 mock_desk = MagicMock()470 mock_desk._parse_locator = MagicMock(return_value=['accessibility_id', 'Capture'])471 DesktopLibrary._is_element_present(mock_desk, "accessibility_id='Capture'")472 mock_desk._current_application().find_elements_by_accessibility_id.assert_called_with(473 'Capture')474 def test_is_element_present_by_class_name(self):475 mock_desk = MagicMock()476 mock_desk._parse_locator = MagicMock(return_value=['class', 'Capture'])477 DesktopLibrary._is_element_present(mock_desk, "class='Capture'")478 mock_desk._current_application().find_elements_by_class_name.assert_called_with('Capture')479 def test_is_element_present_by_xpath(self):480 mock_desk = MagicMock()481 mock_desk._parse_locator = MagicMock(return_value=['xpath', 'Capture'])482 DesktopLibrary._is_element_present(mock_desk, "xpath=//TreeItem[@Name='Capture']")483 mock_desk._current_application().find_elements_by_xpath.assert_called_with('Capture')484 def test_is_element_present_by_default_xpath(self):485 mock_desk = MagicMock()486 mock_desk._parse_locator = MagicMock(return_value=[None, "//TreeItem[@Name='Capture']"])487 DesktopLibrary._is_element_present(mock_desk, "//TreeItem[@Name='Capture']")488 mock_desk._current_application().find_elements_by_xpath.assert_called_with(489 "//TreeItem[@Name='Capture']")490 def test_is_element_present_by_default_accessibility_id(self):491 mock_desk = MagicMock()492 mock_desk._parse_locator = MagicMock(return_value=[None, "Capture"])493 DesktopLibrary._is_element_present(mock_desk, "Capture")494 mock_desk._current_application().find_elements_by_accessibility_id.assert_called_with(495 'Capture')496 def test_is_element_present_by_image(self):497 mock_desk = MagicMock()498 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])499 DesktopLibrary._is_element_present(mock_desk, "image='file.png")500 mock_desk._current_application().find_elements_by_image.assert_called_with('file.png')501 def test_is_element_present_by_image_fail(self):502 mock_desk = MagicMock()503 mock_desk._parse_locator = MagicMock(return_value=['image', 'file.png'])504 mock_desk._current_application().find_elements_by_image = \505 MagicMock(side_effect=InvalidSelectorException)506 self.assertRaisesRegex(AssertionError, 'Selecting by image is only available when using '507 'Appium v1.18.0 or higher', DesktopLibrary._is_element_present, mock_desk,508 'file.png')509 def test_is_element_present_fail(self):510 mock_desk = MagicMock()511 mock_desk._parse_locator = MagicMock(return_value=['blockbuster_id', '123456789'])512 self.assertRaisesRegex(AssertionError,513 "Element locator with prefix 'blockbuster_id' is not supported",514 DesktopLibrary._is_element_present, mock_desk,515 "blockbuster_id=123456789")516 def test_is_element_present_list_greater_than_0(self):517 mock_desk = MagicMock()518 mock_desk._parse_locator = MagicMock(return_value=['name', 'Capture'])519 mock_desk._current_application().find_elements_by_name = \520 MagicMock(return_value=[MagicMock(), MagicMock()])521 DesktopLibrary._is_element_present(mock_desk, "Name='Capture'")522 mock_desk._current_application().find_elements_by_name.assert_called_with('Capture')523 def test_parse_locator_xpath(self):524 mock_desk = MagicMock()525 parse = DesktopLibrary._parse_locator(mock_desk, '//test')526 self.assertEqual(parse, (None, '//test'))527 def test_parse_locator(self):528 mock_desk = MagicMock()529 parse = DesktopLibrary._parse_locator(mock_desk, 'name=test')530 self.assertEqual(parse, ('name', 'test'))531 @patch("selenium.webdriver.common.action_chains.ActionChains.move_by_offset")532 def test_mouse_over_by_offset(self, action):533 mock_desk = MagicMock()534 DesktopLibrary.mouse_over_by_offset(mock_desk, 100, 100)535 action.assert_called_with(100, 100)536 @patch("selenium.webdriver.common.action_chains.ActionChains.click")537 def test_click_a_point(self, action):538 mock_desk = MagicMock()539 DesktopLibrary.click_a_point(mock_desk)540 action.assert_called_with()541 @patch("selenium.webdriver.common.action_chains.ActionChains.move_by_offset")542 @patch("selenium.webdriver.common.action_chains.ActionChains.click")543 def test_click_a_point_with_offset(self, click, move):544 mock_desk = MagicMock()545 DesktopLibrary.click_a_point(mock_desk, x_offset=100, y_offset=100)546 move.assert_called_with(100, 100)547 click.assert_called_with()548 @patch("selenium.webdriver.common.action_chains.ActionChains.double_click")549 def test_click_a_point_with_double_click(self, click):550 mock_desk = MagicMock()551 DesktopLibrary.click_a_point(mock_desk, double_click=True)552 click.assert_called_with()553 @patch("selenium.webdriver.common.action_chains.ActionChains.context_click")554 def test_context_click_a_point(self, click):555 mock_desk = MagicMock()556 DesktopLibrary.context_click_a_point(mock_desk)557 click.assert_called_with()558 @patch("selenium.webdriver.common.action_chains.ActionChains.move_by_offset")559 @patch("selenium.webdriver.common.action_chains.ActionChains.context_click")560 def test_context_click_a_point_with_offset(self, click, move):561 mock_desk = MagicMock()562 DesktopLibrary.context_click_a_point(mock_desk, x_offset=-400, y_offset=-400)563 move.assert_called_with(-400, -400)564 click.assert_called_with()565 def test_drag_and_drop(self):566 mock_desk = MagicMock()567 TouchAction.move_to = MagicMock()568 TouchAction.release = MagicMock()569 DesktopLibrary.drag_and_drop(mock_desk, "some_locator", "some_other_locator")570 mock_desk._platform_dependant_press.assert_called()571 TouchAction.move_to.assert_called_with(unittest.mock.ANY)572 TouchAction.release.assert_called()573 def test_drag_and_drop_with_offset(self):574 mock_desk = MagicMock()575 TouchAction.move_to = MagicMock()576 TouchAction.release = MagicMock()577 DesktopLibrary.drag_and_drop_by_offset(mock_desk, "some_locator", x_offset=100, y_offset=100)578 mock_desk._platform_dependant_press.assert_called()579 TouchAction.move_to.assert_called_with(x=unittest.mock.ANY, y=unittest.mock.ANY)580 TouchAction.release.assert_called()581 @patch("selenium.webdriver.common.action_chains.ActionChains")582 def test_move_to_element(self, move):583 mock_desk = MagicMock()584 DesktopLibrary._move_to_element(mock_desk, move, "some_locator", 0, 0)585 move.move_to_element.assert_called_with("some_locator")586 @patch("selenium.webdriver.common.action_chains.ActionChains")587 def test_move_to_element_with_offset(self, move):588 mock_desk = MagicMock()589 DesktopLibrary._move_to_element(mock_desk, move, "some_locator", 100, 100)590 move.move_to_element_with_offset.assert_called_with("some_locator", 100, 100)591 @patch("selenium.webdriver.common.action_chains.ActionChains.send_keys")592 def test_send_keys(self, send_keys):593 mock_desk = MagicMock()594 DesktopLibrary.send_keys(mock_desk, 'test', '\ue007')595 send_keys.assert_called_with('\ue007')596 @patch('robot.libraries.BuiltIn.BuiltIn.fail')597 def test_send_keys_without_args(self, fail):598 mock_desk = MagicMock()599 DesktopLibrary.send_keys(mock_desk)600 fail.assert_called_with('No key arguments specified.')601 @patch("selenium.webdriver.common.action_chains.ActionChains.send_keys_to_element")602 def test_send_keys_to_element(self, send_keys):603 mock_desk = MagicMock()604 DesktopLibrary.send_keys_to_element(mock_desk, 'some_element', 'test', '\ue007')605 send_keys.assert_called_with(unittest.mock.ANY, '\ue007')606 @patch('robot.libraries.BuiltIn.BuiltIn.fail')607 def test_send_keys_to_element_without_args(self, fail):608 mock_desk = MagicMock()609 DesktopLibrary.send_keys_to_element(mock_desk, 'some_locator')610 fail.assert_called_with('No key arguments specified.')611 def test_capture_page_screenshot(self):612 mock_desk = MagicMock()613 mock_desk._get_screenshot_paths = MagicMock(return_value=['path', 'link'])614 DesktopLibrary.capture_page_screenshot(mock_desk)615 mock_desk._get_screenshot_paths.assert_called_with(None)616 def test_capture_page_screenshot_else_case(self):617 mock_desk = MagicMock()618 mock_desk._get_screenshot_paths = MagicMock(return_value=['path', 'link'])619 del mock_desk._current_application().get_screenshot_as_file620 DesktopLibrary.capture_page_screenshot(mock_desk, 'filename')621 mock_desk._get_screenshot_paths.assert_called_with('filename')622 def test_save_appium_screenshot(self):623 mock_desk = MagicMock()624 DesktopLibrary.save_appium_screenshot(mock_desk)625 mock_desk.capture_page_screenshot.assert_called_with(unittest.mock.ANY)626 def test_select_from_combobox_no_desktop(self):627 mock_desk = MagicMock()628 DesktopLibrary.select_element_from_combobox(mock_desk, 'some_locator', 'another_locator')629 mock_desk.click_element.assert_called_with('another_locator')630 def test_select_from_combobox_with_desktop(self):631 mock_desk = MagicMock()632 mock_desk.click_element = MagicMock(side_effect=[True, ValueError, True])633 DesktopLibrary.select_element_from_combobox(mock_desk, 'some_locator', 'another_locator')634 mock_desk.click_element.assert_called_with('another_locator')635 def test_select_from_combobox_skip_to_desktop(self):636 mock_desk = MagicMock()637 DesktopLibrary.select_element_from_combobox(mock_desk, 'some_locator', 'another_locator', True)638 mock_desk.click_element.assert_called_with('another_locator')639 def test_select_from_combobox_retry(self):640 mock_desk = MagicMock()641 mock_desk.click_element = MagicMock(side_effect=[True, NoSuchElementException, True])642 DesktopLibrary.select_element_from_combobox(mock_desk, 'some_locator', 'another_locator')643 mock_desk.click_element.assert_called_with('another_locator')644 def test_select_from_combobox_retry_desktop(self):645 mock_desk = MagicMock()646 mock_desk.click_element = MagicMock(side_effect=[True, NoSuchElementException, True])647 DesktopLibrary.select_element_from_combobox(mock_desk, 'some_locator', 'another_locator', True)648 mock_desk.click_element.assert_called_with('another_locator')649 def test_select_elements_from_menu_retry_desktop(self):650 mock_desk = MagicMock()651 mock_desk.click_element = MagicMock(side_effect=[True, NoSuchElementException, True])652 DesktopLibrary.select_elements_from_menu(mock_desk, 'some_locator', 'another_locator')653 mock_desk.click_element.assert_called_with('another_locator')654 def test_select_elements_from_menu_retry_desktop_2(self):655 mock_desk = MagicMock()656 mock_desk.click_element = MagicMock(side_effect=[True, NoSuchElementException, NoSuchElementException, True])657 DesktopLibrary.select_elements_from_menu(mock_desk, 'some_locator', 'another_locator')658 mock_desk.click_element.assert_called_with('another_locator')659 def test_select_elements_from_menu_no_desktop(self):660 mock_desk = MagicMock()661 DesktopLibrary.select_elements_from_menu(mock_desk, 'some_locator', 'another_locator')662 mock_desk.click_element.assert_called_with('another_locator')663 def test_select_elements_from_context_menu_retry_desktop(self):664 mock_desk = MagicMock()665 mock_desk.mouse_over_and_context_click_element = MagicMock(side_effect=[NoSuchElementException, True, True])666 DesktopLibrary.select_elements_from_context_menu(mock_desk, 'some_locator', 'another_locator')667 mock_desk.click_element.mouse_over_and_context_click('some_locator')668 mock_desk.click_element.assert_called_with('another_locator')669 def test_select_elements_from_context_menu_retry_desktop_2(self):670 mock_desk = MagicMock()671 mock_desk.mouse_over_and_context_click_element = MagicMock(side_effect=[NoSuchElementException, NoSuchElementException, True, True])672 DesktopLibrary.select_elements_from_context_menu(mock_desk, 'some_locator', 'another_locator')673 mock_desk.click_element.mouse_over_and_context_click('some_locator')674 mock_desk.click_element.assert_called_with('another_locator')675 def test_select_elements_from_context_menu_retry_desktop_3(self):676 mock_desk = MagicMock()677 mock_desk.click_element = MagicMock(side_effect=[NoSuchElementException, NoSuchElementException, True, True])678 DesktopLibrary.select_elements_from_context_menu(mock_desk, 'some_locator', 'another_locator')679 mock_desk.click_element.mouse_over_and_context_click('some_locator')680 mock_desk.click_element.assert_called_with('another_locator')681 def test_select_elements_from_context_menu_no_desktop(self):682 mock_desk = MagicMock()683 DesktopLibrary.select_elements_from_context_menu(mock_desk, 'some_locator', 'another_locator')684 mock_desk.click_element.mouse_over_and_context_click('some_locator')685 mock_desk.click_element.assert_called_with('another_locator')686 def test_wait_until_page_contains_private(self):687 mock_desk = MagicMock()688 DesktopLibrary._wait_until_page_contains(mock_desk, 'some_text', 5)689 mock_desk._wait_until.asser_called_with('some_text', 5)690 def test_wait_until_page_contains_element_private(self):691 mock_desk = MagicMock()692 DesktopLibrary._wait_until_page_contains_element(mock_desk, 'some_element', 5)693 mock_desk._wait_until.assert_called_with(5, "Element 'some_element' did not appear in "694 "<TIMEOUT>", unittest.mock.ANY, 'some_element')695 def test_wait_until_no_error_timeout(self):696 mock_desk = MagicMock()697 self.assertRaisesRegex(AssertionError,698 'Error', DesktopLibrary._wait_until_no_error, mock_desk,699 1, _long_running_function)700 @patch("selenium.webdriver.common.touch_actions.TouchActions.flick")701 def test_flick(self, flick):702 mock_desk = MagicMock()703 DesktopLibrary.flick(mock_desk, 50, 100)704 flick.assert_called_with(50, 100)705 @patch("selenium.webdriver.common.touch_actions.TouchActions.flick_element")706 def test_flick_from_element(self, flick_element):707 mock_desk = MagicMock()708 DesktopLibrary.flick_from_element(mock_desk, "some_locator", 50, 100, 10)709 flick_element.assert_called_with(unittest.mock.ANY, 50, 100, 10)710 @patch("selenium.webdriver.common.touch_actions.TouchActions.flick_element")711 def test_flick_from_element_current_element_set(self, flick_element):712 mock_desk = MagicMock()713 mock_desk.current_element = MagicMock()714 DesktopLibrary.flick_from_element(mock_desk, mock_desk.current_element, 50, 100, 10)715 flick_element.assert_called_with(unittest.mock.ANY, 50, 100, 10)716 def test_wait_for_and_flick_from_element(self):717 mock_desk = MagicMock()718 DesktopLibrary.wait_for_and_flick_from_element(mock_desk, "some_locator", 50, 100, 10)719 mock_desk.flick_from_element.assert_called_with(unittest.mock.ANY, 50, 100, 10)720 @patch("selenium.webdriver.common.touch_actions.TouchActions.scroll")721 def test_scroll(self, scroll):722 mock_desk = MagicMock()723 DesktopLibrary.scroll(mock_desk, 50, 100)724 scroll.assert_called_with(50, 100)725 @patch("selenium.webdriver.common.touch_actions.TouchActions.scroll_from_element")726 def test_scroll_from_element(self, scroll_from_element):727 mock_desk = MagicMock()728 DesktopLibrary.scroll_from_element(mock_desk, "some_locator", 50, 100)729 scroll_from_element.assert_called_with(unittest.mock.ANY, 50, 100)730 @patch("selenium.webdriver.common.touch_actions.TouchActions.scroll_from_element")731 def test_scroll_from_element_current_element_set(self, scroll_from_element):732 mock_desk = MagicMock()733 mock_desk.current_element = MagicMock()734 DesktopLibrary.scroll_from_element(mock_desk, mock_desk.current_element, 50, 100)735 scroll_from_element.assert_called_with(unittest.mock.ANY, 50, 100)736 def test_wait_for_and_scroll_from_element(self):737 mock_desk = MagicMock()738 DesktopLibrary.wait_for_and_scroll_from_element(mock_desk, "some_locator", 50, 100)739 mock_desk.scroll_from_element.assert_called_with(unittest.mock.ANY, 50, 100)740 @patch("selenium.webdriver.common.touch_actions.TouchActions.double_tap")741 def test_double_tap(self, double_tap):742 mock_desk = MagicMock()743 DesktopLibrary.double_tap(mock_desk, "some_locator")744 double_tap.assert_called_with(unittest.mock.ANY)745 @patch("selenium.webdriver.common.touch_actions.TouchActions.double_tap")746 def test_double_tap_current_element_set(self, double_tap):747 mock_desk = MagicMock()748 mock_desk.current_element = MagicMock()749 DesktopLibrary.double_tap(mock_desk, mock_desk.current_element)750 double_tap.assert_called_with(unittest.mock.ANY)751 @patch("appium.webdriver.common.touch_action.TouchAction.tap")752 def test_wait_for_and_tap(self, tap):753 mock_desk = MagicMock()754 DesktopLibrary.wait_for_and_tap(mock_desk, "some_locator")755 tap.assert_called_with(unittest.mock.ANY)756 def test_wait_for_and_double_tap(self):757 mock_desk = MagicMock()758 DesktopLibrary.wait_for_and_double_tap(mock_desk, "some_locator")759 mock_desk.double_tap.assert_called_with(unittest.mock.ANY)760 @patch("selenium.webdriver.common.touch_actions.TouchActions.tap_and_hold")761 def test_drag_and_drop_by_touch(self, tap_and_hold):762 mock_desk = MagicMock()763 DesktopLibrary.drag_and_drop_by_touch(mock_desk, "some_locator", "some_other_locator")764 tap_and_hold.assert_called_with(unittest.mock.ANY, unittest.mock.ANY)765 @patch("selenium.webdriver.common.touch_actions.TouchActions.tap_and_hold")766 def test_drag_and_drop_by_touch_offset(self, tap_and_hold):767 mock_desk = MagicMock()768 DesktopLibrary.drag_and_drop_by_touch_offset(mock_desk, "some_locator", 50, 100)769 tap_and_hold.assert_called_with(unittest.mock.ANY, unittest.mock.ANY)770 def test_start_screen_recording(self):771 mock_desk = MagicMock()772 mock_desk._recording = None773 DesktopLibrary.start_screen_recording(mock_desk)774 self.assertTrue(mock_desk._recording == unittest.mock.ANY)775 def test_stop_screen_recording(self):776 mock_desk = MagicMock()777 mock_desk._recording = None778 DesktopLibrary.start_screen_recording(mock_desk)779 file = DesktopLibrary.stop_screen_recording(mock_desk)780 self.assertTrue(file == unittest.mock.ANY)781 def test_save_recording(self):782 mock_desk = MagicMock()783 mock_desk._recording = b'some data'784 mock_desk._is_remotepath_set = MagicMock(return_value=False)785 options = ["username=test"]786 mock_desk._get_screenrecord_paths = MagicMock(return_value=("path", "link"))787 file = DesktopLibrary._save_recording(mock_desk, "filename", options)788 self.assertTrue(file == "path")789 os.remove("path")790 def test_get_text(self):791 mock_desk = MagicMock()792 mock_desk.current_element = None793 DesktopLibrary._get_text(mock_desk, 1)794 mock_desk._check_for_cached_element.assert_called_with(1)795 def test_get_text_current_element_set(self):796 mock_desk = MagicMock()797 mock_desk.current_element = MagicMock()798 DesktopLibrary._get_text(mock_desk, mock_desk.current_element)799 mock_desk._element_find.assert_not_called()800 def test_get_text_element_none(self):801 mock_desk = MagicMock()802 mock_desk._check_for_cached_element = MagicMock(return_value=None)803 result = DesktopLibrary._get_text(mock_desk, mock_desk.current_element)804 self.assertEqual(result, None)805 def test_check_for_cached_element_true(self):806 mock_desk = MagicMock()807 mock_desk.current_element = "a locator"808 result = DesktopLibrary._check_for_cached_element(mock_desk, "a locator")809 self.assertEqual(result, "a locator")810 def test_check_for_cached_element_false(self):811 mock_desk = MagicMock()812 DesktopLibrary._check_for_cached_element(mock_desk, "a locator")813 mock_desk._element_find.assert_called_with("a locator", True, True)814 def test_platform_dependant_press_private(self):815 mock_desk = MagicMock()...
_screenrecord.py
Source:_screenrecord.py
...81 with open(path, 'wb') as screenrecording:82 screenrecording.write(decoded)83 # Embed the Screen Recording to the log file84 # if the current platform is Android and no remotePath is set.85 if self._is_android() and not self._is_remotepath_set(options):86 self._html('</td></tr><tr><td colspan="3"><a href="{vid}">'87 '<video width="800px" controls>'88 '<source src="{vid}" type="video/mp4">'89 '</video></a>'.format(vid=link)90 )91 # Empty Screen Record Variable92 self._recording = None93 return path94 def _set_output_format(self):95 return '.ffmpeg' if self._is_ios() else '.mp4'96 def _get_screenrecord_paths(self, options, filename=None):97 if filename is None:98 self._screenrecord_index += 199 filename = 'appium-screenrecord-{index}{ext}'.format(index=self._screenrecord_index,100 ext=self._output_format101 )102 else:103 filename = (filename.replace('/', os.sep)) + self._output_format104 logdir = options['remotePath'] if self._is_remotepath_set(options) \105 else self._get_log_dir()106 path = os.path.join(logdir, filename)107 link = robot.utils.get_link_path(path, logdir)108 return path, link109 def _is_remotepath_set(self, options):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!