27 lines
848 B
Python
27 lines
848 B
Python
# pylint: disable=no-name-in-module,unused-argument,comparison-of-constants
|
|
from behave import given, when, then
|
|
|
|
from features import environment
|
|
|
|
|
|
@given("the browser is at the login page")
|
|
def the_browser_is_at_the_login_page(context):
|
|
"""
|
|
:type context: behave.runner.Context
|
|
"""
|
|
page = environment.get_page(context)
|
|
page.goto("https://www.saucedemo.com/")
|
|
|
|
|
|
@when("the user enters his login details")
|
|
def user_enters_details(context):
|
|
context.page.fill('#user-name', 'standard_user')
|
|
context.page.fill('#password', 'secret_sauce')
|
|
context.page.click('#login-button')
|
|
|
|
|
|
@then("the user is presented with the landing page")
|
|
def user_presented_with_landing_page(context):
|
|
header = context.page.get_by_text('Swag Labs')
|
|
assert "Swag Labs" in header.text_content(), "Login failed!"
|