pywright-cucumber/features/steps/playwright_example.py
Greg Gauthier 8749d7ab37
All checks were successful
Pylint / build (3.12) (push) Successful in 19s
initial commit
2024-07-24 21:25:00 +01:00

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!"