def test_accepts_provided_access_key(self): key = 'abcd-1234-5678' session = SauceSession() session.access_key = key assert session.access_key == key
def test_raises_exception_if_no_username_set(self): session = SauceSession() session.username = None with pytest.raises(KeyError): session.start()
def test_raises_exception_if_no_access_key_set(self): session = SauceSession() session.access_key = None with pytest.raises(KeyError): session.start()
def test_accepts_provided_username(self): user = '******' session = SauceSession() session.username = user assert session.username == user
def test_raises_exception_if_no_username_set(self): del os.environ['SAUCE_USERNAME'] session = SauceSession() with pytest.raises(KeyError): session.start() os.environ['SAUCE_USERNAME'] = SAUCE_USERNAME_HOLDER
def test_raises_exception_if_no_access_key_set(self): del os.environ['SAUCE_ACCESS_KEY'] session = SauceSession() with pytest.raises(KeyError): session.start() os.environ['SAUCE_ACCESS_KEY'] = SAUCE_ACCESS_KEY_HOLDER
def test_update_method(self): session = SauceSession() session.start() session.update_test_result(True) session.stop()
def driver(request): opts = SauceOptions() opts.name = request.node.name sauce = SauceSession(options=opts) sauce.start() yield sauce.driver # report results # use the test result to send the pass/fail status to Sauce Labs if request.node.rep_call.failed: sauce.setTestStatus("failed") else: sauce.setTestStatus("passed") sauce.stop()
def test_accepts_provided_username_and_access_key(self): user = '******' access_key = 'abce-defg-hijk' session = SauceSession(username=user, access_key=access_key) assert session.username == user assert session.access_key == access_key
def test_accepts_provided_options_instance(self): options = SauceOptions() session = SauceSession(options) assert session.options.browser_name == 'chrome' assert session.options.browser_version == 'latest' assert session.options.platform_name == 'Windows 10'
def driver(request): opts = SauceOptions(browserName=request.param) sauce = SauceSession(options=opts) sauce.start() yield sauce.driver sauce.stop()
def driver(request): opts = SauceOptions() opts.name = request.node.name sauce = SauceSession(options=opts) sauce.start() yield sauce.driver # report results # use the test result to send the pass/fail status to Sauce Labs result = not request.node.rep_call.failed sauce.stop(result)
def test_user_can_override_default_url(self): session = SauceSession() session.remote_url = 'https://*****:*****@foobar.com/wd/hub' assert session.remote_url == 'https://*****:*****@foobar.com/wd/hub'
"""Most basic example of using Simple Sauce. Here we start a session on Sauce, perform some actions then close the session. """ from simplesauce.session import SauceSession session = SauceSession() session.start() session.driver.get("https://www.saucedemo.com") assert "Swag" in session.driver.title session.stop()
def test_raises_exception_if_data_center_is_invalid(self): with pytest.raises(KeyError): SauceSession(data_center='uu') with pytest.raises(KeyError): SauceSession(data_center='')
def test_it_quits_the_driver(self): session = SauceSession() session.start() session.stop()
def test_raises_exception_if_data_center_is_invalid(self): session = SauceSession() with pytest.raises(ValueError): session.data_center = 'invalid'
def test_creates_a_session_on_sauce_labs(self): session = SauceSession() session.start() assert session.driver.session_id
def test_generates_default_options_instance_if_not_provided(self): session = SauceSession() assert session.options.browser_name == 'chrome' assert session.options.browser_version == 'latest' assert session.options.platform_name == 'Windows 10'
def test_overrides_default_value_for_data_center(self): session = SauceSession() session.data_center = 'eu' assert "eu-central-1" in session.remote_url
def test_uses_username_and_access_key_if_ENV_variables_are_defined(self): session = SauceSession() assert session.username == os.environ['SAUCE_USERNAME'] assert session.access_key == os.environ['SAUCE_ACCESS_KEY']
def test_defaults_to_us_west_data_center(self): session = SauceSession() assert "us-west-1" in session.remote_url
def test_failing_case(self): session = SauceSession() session.start() session.stop(False)
def test_passing_case(self): session = SauceSession() session.start() session.stop(True)
"""Most basic example of using Simple Sauce. Here we start a session on Sauce, perform some actions then close the session. """ from simplesauce.session import SauceSession session = SauceSession() session.start() session.driver.get("https://www.saucedemo.com") result = "Swag" in session.driver.title session.stop(result)