Пример #1
0
 def test_changes_when_the_session_name_changes(self):
     object_id = id(capybara.current_session())
     capybara.session_name = "administrator"
     assert capybara.session_name == "administrator"
     assert id(capybara.current_session()) != object_id
     capybara.session_name = "default"
     assert capybara.session_name == "default"
     assert id(capybara.current_session()) == object_id
Пример #2
0
    def test_persists_event_across_driver_changes(self):
        object_id = id(capybara.current_session())
        assert id(capybara.current_session()) == object_id

        capybara.current_driver = "selenium"
        assert capybara.current_session().mode == "selenium"
        assert id(capybara.current_session()) != object_id

        capybara.current_driver = "werkzeug"
        assert id(capybara.current_session()) == object_id
Пример #3
0
def before_all(context):
    print("> Starting the browser")

    global chrome_options

    if USE_WEBDRIVER_WRAPPER == WebdriverWrapperType.RAW:
        context.driver = webdriver.Chrome(chrome_options=chrome_options)
    elif USE_WEBDRIVER_WRAPPER == WebdriverWrapperType.ELEMENTIUM:
        context.driver = SeElements(
            webdriver.Chrome(chrome_options=chrome_options))
    elif USE_WEBDRIVER_WRAPPER == WebdriverWrapperType.CAPYBARA:
        capybara.current_driver = "selenium_chrome"  # headless
        #capybara.current_driver = "selenium_remote_chrome"  # gui
        capybara.default_max_wait_time = 10
        capybara.current_session().current_window.resize_to(1920, 1080)
Пример #4
0
def before_all(context):
    print("> Starting the browser")

    global chrome_options
    global webdriver_wrapper

    if webdriver_wrapper == WebdriverWrapperType.RAW:
        context.driver = webdriver.Chrome(
            #executable_path=CHROME_EXE_PATH,
            chrome_options=chrome_options)
    elif webdriver_wrapper == WebdriverWrapperType.ELEMENTIUM:
        context.driver = SeElements(
            webdriver.Chrome(
                #executable_path=CHROME_EXE_PATH,
                chrome_options=chrome_options))
    elif webdriver_wrapper == WebdriverWrapperType.CAPYBARA:
        if webdriver_headless_mode:
            capybara.current_driver = "selenium_chrome"         # headless
        else:
            capybara.current_driver = "selenium_remote_chrome"  # gui
        capybara.default_max_wait_time = 10
        capybara.current_session().current_window.resize_to(1920, 1080)
Пример #5
0
 def test_changes_when_changing_the_application(self):
     object_id = id(capybara.current_session())
     assert id(capybara.current_session()) == object_id
     capybara.app = lambda: None
     assert id(capybara.current_session()) != object_id
     assert capybara.current_session().app == capybara.app
Пример #6
0
 def test_uses_app_as_the_application(self):
     capybara.app = lambda: None
     assert capybara.current_session().app == capybara.app
Пример #7
0
 def __getattr__(self, attr):
     return getattr(capybara.current_session(), attr)
Пример #8
0
 def test_changes_with_the_current_driver(self):
     assert capybara.current_session().mode == "werkzeug"
     capybara.current_driver = "selenium"
     assert capybara.current_session().mode == "selenium"