Add a test with the Page Object Model and the "sb" fixture

This commit is contained in:
Michael Mintz 2021-03-23 02:45:52 -04:00
parent b15d2084d9
commit 20403f267b
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
""" Classic Page Object Model with the "sb" fixture """
class LoginPage():
def login_to_swag_labs(self, sb, username):
sb.open("https://www.saucedemo.com/")
sb.type("#user-name", username)
sb.type("#password", "secret_sauce")
sb.click('input[type="submit"]')
class MyTests():
def test_swag_labs_login(self, sb):
LoginPage().login_to_swag_labs(sb, "standard_user")
sb.assert_element("#inventory_container")
sb.assert_text("Products", "div.product_label")