示例#1
0
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()
示例#2
0
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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
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)
示例#6
0
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)
示例#7
0
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)
示例#8
0
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()
示例#10
0
def test_manual_start():
    driver = get_test_driver()
    set_driver(driver)
    open_url(start_page)
    s("#header").should_have(exact_text("Selene"))
示例#11
0
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"))
示例#12
0
def test_can_init_default_browser_on_visit():
    open_url(start_page)
    s("#header").should_have(exact_text("Selene"))
示例#13
0
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:/"))
示例#14
0
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
示例#15
0
def test_can_wait_for_part_of_url():
    open_url(start_page)
    wait_to(url_containing("start_page.html"))
示例#16
0
def test_auto_start():
    open_url(start_page)
    s("#header").should_have(exact_text("Selene"))
示例#17
0
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
示例#18
0
def x_test_can_dismiss_confirm_dialog():
    open_url(start_page)
    s("#alert_btn").click()
    driver().switch_to.alert.dismiss()
示例#19
0
def x_test_can_accept_alert():
    open_url(start_page)
    s("#alert_btn").click()
    driver().switch_to.alert.accept()
示例#20
0
def test_auto_start_2():
    open_url(start_page)
    s("#selene_link").should_have(exact_text("Selene site"))
示例#21
0
def test_can_wait_for_exact_url():
    open_url(start_page)
    wait_to(url(driver().current_url))