def test_measure_ensure_sync_with_underlying_driver_performance( driver, eyes, page_desc, url, far_frame_path, load_time, test_desc, driver_frames, eyes_frames, i, ): driver_frames = far_frame_path if driver_frames == "far" else driver_frames eyes_frames = far_frame_path if eyes_frames == "far" else eyes_frames driver.get(url) time.sleep(load_time) eyes_driver = EyesWebDriver(driver, eyes) for n in eyes_frames: eyes_driver.switch_to.frame(n) for n in driver_frames: driver.switch_to.frame(n) ts = time.monotonic() eyes_driver.ensure_sync_with_underlying_driver() r = time.monotonic() - ts with open("ensure_sync_with_underlying_driver_perf.txt", "a") as f: f.write("{page_desc}; {test_desc}; {i}; {r:.0f}\n".format( page_desc=page_desc, test_desc=test_desc, i=i, r=r * 1000))
def test_iframe_unselected_with_raw_selenium_driver_is_synced(eyes, driver): driver.get( "https://applitools.github.io/demo/TestPages/CorsTestPage/index.html") eyes_driver = EyesWebDriver(driver, eyes) eyes_driver.switch_to.frame(0) driver.switch_to.default_content() eyes_driver.ensure_sync_with_underlying_driver() assert eyes_driver.frame_chain.peek is None
def test_iframe_selected_with_raw_selenium_driver_is_synced(eyes, driver): driver.get( "https://applitools.github.io/demo/TestPages/CorsTestPage/index.html") eyes_driver = EyesWebDriver(driver, eyes) driver.switch_to.frame(0) driver.switch_to.frame(0) eyes_driver.ensure_sync_with_underlying_driver() assert (eyes_driver.frame_chain.peek.scroll_root_element.get_attribute( "class") == "no-js")