Skip to content

Commit b8e29d4

Browse files
committed
Update examples
1 parent 8cbbd19 commit b8e29d4

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

examples/swag_labs_suite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class SwagLabsTests(BaseCase):
77

8-
def login(self, username="standard_user"):
8+
def login_to_swag_labs(self, username="standard_user"):
99
""" Login to Swag Labs and verify that login was successful. """
1010
self.open("https://www.saucedemo.com/")
1111
if username not in self.get_text("#login_credentials"):
@@ -24,7 +24,7 @@ def login(self, username="standard_user"):
2424
def test_swag_labs_basic_functional_flow(self, username):
2525
""" This test checks functional flow of the Swag Labs store.
2626
This test is parameterized, and receives the user for login. """
27-
self.login(username=username)
27+
self.login_to_swag_labs(username=username)
2828

2929
# Verify that the "Test.allTheThings() T-Shirt" appears on the page
3030
item_name = "Test.allTheThings() T-Shirt"
@@ -87,5 +87,5 @@ def test_swag_labs_basic_functional_flow(self, username):
8787
def test_swag_labs_products_page_resource_verification(self, username):
8888
""" This test checks for 404 errors on the Swag Labs products page.
8989
This test is parameterized, and receives the user for login. """
90-
self.login(username=username)
90+
self.login_to_swag_labs(username=username)
9191
self.assert_no_404_errors()

examples/test_login.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from seleniumbase import BaseCase
2+
3+
4+
class SwagLabsLoginTests(BaseCase):
5+
6+
def login_to_swag_labs(self):
7+
""" Login to Swag Labs and verify that login was successful. """
8+
self.open("https://www.saucedemo.com/")
9+
self.type("#user-name", "standard_user")
10+
self.type("#password", "secret_sauce")
11+
self.click('input[type="submit"]')
12+
13+
def test_swag_labs_login(self):
14+
""" This test checks standard login for the Swag Labs store. """
15+
self.login_to_swag_labs()
16+
self.assert_element("div.header_label div.app_logo")
17+
self.assert_text("Products", "div.product_label")

examples/test_swag_labs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class SwagLabsTests(BaseCase):
55

6-
def login(self, username="standard_user"):
6+
def login_to_swag_labs(self, username="standard_user"):
77
""" Login to Swag Labs and verify that login was successful. """
88
self.open("https://www.saucedemo.com/")
99
if username not in self.get_text("#login_credentials"):
@@ -16,7 +16,7 @@ def login(self, username="standard_user"):
1616

1717
def test_swag_labs_basic_flow(self):
1818
""" This test checks functional flow of the Swag Labs store. """
19-
self.login(username="standard_user")
19+
self.login_to_swag_labs(username="standard_user")
2020

2121
# Verify that the "Test.allTheThings() T-Shirt" appears on the page
2222
item_name = "Test.allTheThings() T-Shirt"

0 commit comments

Comments
 (0)