Skip to content

Commit 2026470

Browse files
committed
Update an example test
1 parent d510100 commit 2026470

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

examples/swag_labs_suite.py

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

66
class SwagLabsTests(BaseCase):
77

8-
def login_to_swag_labs(self, username="standard_user"):
8+
def login_to_swag_labs(self, username="standard_user", v1=False):
99
""" Login to Swag Labs and verify success. """
10-
self.open("https://www.saucedemo.com/")
10+
url = "https://www.saucedemo.com"
11+
if v1:
12+
url += "/v1"
13+
self.open(url)
1114
if username not in self.get_text("#login_credentials"):
1215
self.fail("Invalid user for login: %s" % username)
1316
self.type("#user-name", username)
@@ -86,12 +89,8 @@ def test_swag_labs_basic_flow(self, username):
8689
@pytest.mark.run(order=2)
8790
def test_swag_labs_products_page_links(self, username):
8891
""" This test checks for 404s on the Swag Labs products page.
89-
This test is parameterized on the login user.
90-
Swag Labs replaced broken links with dog images for the
91-
"problem_user" login, so the test switches those back
92-
to demonstrate the "assert_no_404_errors()" method. """
93-
self.login_to_swag_labs(username=username)
94-
self.set_attributes('img[src*="/sl-404"]', "src", "/bad_link.jpg")
92+
This test is parameterized on the login user. """
93+
self.login_to_swag_labs(username=username, v1=True)
9594
self.assert_no_404_errors()
9695

9796
@parameterized.expand([

0 commit comments

Comments
 (0)