def test_can_hold_autocreated_browser_open(): config.hold_browser_open = True open_url(start_page) webdriver = driver() factory.kill_all_started_drivers() assert factory.is_driver_still_open(webdriver) webdriver.quit()
def test_can_make_screenshot_with_custom_name(): open_url(start_page) actual = take_screenshot(filename="custom") expected = os.path.join(get_default_screenshot_folder(), 'custom.png') assert expected == actual assert os.path.exists(actual)
def test_can_make_screenshot_with_default_name(): open_url(start_page) actual = take_screenshot() expected = os.path.join(get_default_screenshot_folder(), 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.exists(actual)
def test_can_make_screenshot_automatically(): open_url(start_page) config.timeout = 0.1 with pytest.raises(TimeoutException) as ex: s("#selene_link").should_have(exact_text("Selen site")) expected = os.path.join(get_default_screenshot_folder(), 'screen_{id}.png'.format(id=get_screen_id())) assert os.path.exists(expected)
def test_can_get_latest_screenshot_path(): config.reports_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) with pytest.raises(TimeoutException): s("#s").should_be(visible) picture = latest_screenshot() assert os.path.exists(picture)
def test_can_save_screenshot_to_custom_folder_specified_as_parameter(): screenshot_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot(path=screenshot_folder) expected = os.path.join(screenshot_folder, 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)
def test_can_save_screenshot_to_custom_folder_specified_through_config(): config.reports_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot() expected = os.path.join(get_default_screenshot_folder(), 'screen_{id}.png'.format(id=get_screen_id())) assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)
def test_can_save_screenshot_to_custom_folder_with_custom_name(): screenshot_folder = os.path.dirname( os.path.abspath(__file__)) + '/../../build/screenshots' open_url(start_page) actual = take_screenshot(path=screenshot_folder, filename="custom_file_in_custom_folder") expected = os.path.join(screenshot_folder, 'custom_file_in_custom_folder.png') assert expected == actual assert os.path.isfile(actual) assert os.path.exists(actual)
def setup_function(f): global browser global shaded_browser set_driver(get_test_driver()) open_url(TODOMVC_URL) s("#new-todo").should_be(visible) browser = get_test_driver() browser.get(TODOMVC_URL) WebDriverWait(browser, 4).until( expected_conditions.visibility_of_element_located( (By.CSS_SELECTOR, "#new-todo"))) shaded_browser = get_test_driver()
def test_manual_start(): driver = get_test_driver() set_driver(driver) open_url(start_page) s("#header").should_have(exact_text("Selene"))
def test_can_init_custom_browser_on_visit(): selene.config.browser_name = BrowserName.MARIONETTE open_url(start_page) s("#selene_link").should_have(exact_text("Selene site"))
def test_can_init_default_browser_on_visit(): open_url(start_page) s("#header").should_have(exact_text("Selene"))
def test_should_wait_and_fail_for_incorrect_url(): config.timeout = 0.1 with pytest.raises(TimeoutException): open_url(start_page) wait_to(url("xttp:/"))
def test_can_auto_close_browser(): config.hold_browser_open = False open_url(start_page) webdriver = driver() factory.kill_all_started_drivers() assert factory.is_driver_still_open(webdriver) is False
def test_can_wait_for_part_of_url(): open_url(start_page) wait_to(url_containing("start_page.html"))
def test_auto_start(): open_url(start_page) s("#header").should_have(exact_text("Selene"))
def test_can_scroll_to(): open_url(start_page) # logging.warning(driver().current_url) # driver().set_window_size(300, 400) s("#invisible_link").scroll_to().click() assert "header" in browser.driver().current_url
def x_test_can_dismiss_confirm_dialog(): open_url(start_page) s("#alert_btn").click() driver().switch_to.alert.dismiss()
def x_test_can_accept_alert(): open_url(start_page) s("#alert_btn").click() driver().switch_to.alert.accept()
def test_auto_start_2(): open_url(start_page) s("#selene_link").should_have(exact_text("Selene site"))
def test_can_wait_for_exact_url(): open_url(start_page) wait_to(url(driver().current_url))