def test_navigator(platform: crosstest.Platform, request): t = time.time() test = platform.setup(request) print('time to get test platform {}'.format(time.time() - t)) t = time.time() driver = test.driver() print('time to get driver {}'.format(time.time() - t)) t = time.time() app = App(driver) print('time to get app model {}'.format(time.time() - t)) # manual navigation connection configuration navigate = Navigator(app.google_home) navigate.connect_all( (app.google_home.navigate_to_GoogleSearchPage, app.google_search), (app.google_search.navigate_to_LinkedinHomePage, app.linkedin_home)) # money time for this feature t = time.time() navigate.to(app.linkedin_home) print('time to get navigation calc {}'.format(time.time() - t)) t = time.time() navigate.perform() print('time to get navigation {}'.format(time.time() - t)) # this is what the tester will want to test app.linkedin_home.register.register_and_submit(firstname='test123', lastname='456', email='testmail', password='******') app.driver.quit()
def test_models_with_drivers(platform: crosstest.Platform, request): test = platform.setup(request) driver = test.driver() if test.platform["api"] == crosstest.API.WEB: driver.get("https://github.com/SeleniumHQ/selenium/wiki/Grid2") elif test.platform["api"] == crosstest.API.MOBILE: driver.find_element_by_accessibility_id("Add Contact").click() driver.quit()
def test_platforms_and_data(platform: crosstest.Platform, data, request): test = platform.setup(request) if test.platform["api"] == WebDriver: assert test.platform[ "command_executor"] == platforms.web.command_executor assert test.platform["desired_capabilities"]["browserName"] in ( "firefox", "chrome", "internet explorer") elif test.platform["api"] == MobileDriver: assert test.platform["command_executor"] == settings.mobiledriver_url assert test.platform["desired_capabilities"]['platformName'] in ( "Android", ) else: raise Exception("test case object not as expected: {}".format( vars(test))) assert data == from_zero_to_hero
def test_navigator_with_auto_connect(platform: crosstest.Platform, request): test = platform.setup(request) driver = test.driver() app = App(driver) try: app.navigate.to(app.linkedin_home) app.navigate.perform() # this is what the tester will want to test app.linkedin_home.register.register_and_submit( firstname='test123', lastname='456', email='testmail', password='******') finally: try: driver.quit() except: pass