Skip to content

Commit d010845

Browse files
committed
Update example tests
1 parent 3010075 commit d010845

File tree

8 files changed

+22
-13
lines changed

8 files changed

+22
-13
lines changed

examples/edge_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from seleniumbase import BaseCase
55

66

7-
class EdgeTestClass(BaseCase):
7+
class EdgeTests(BaseCase):
88

99
def test_edge(self):
1010
if self.browser != "edge":
1111
print("\n This test is only for Microsoft Edge (Chromium)!")
12-
print(" (Run with: '--browser=edge')")
13-
self.skip("This test is only for Microsoft Edge (Chromium)!")
12+
print(' (Run this test using "--edge" or "--browser=edge")')
13+
self.skip('Use "--edge" or "--browser=edge"')
1414
self.open("edge://settings/help")
1515
self.assert_element('img[alt="Edge logo"] + span')
1616
self.highlight('#section_about div + div')

examples/swag_labs_suite.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def test_swag_labs_basic_flow(self, username):
2828
""" This test checks functional flow of the Swag Labs store.
2929
This test is parameterized on the login user. """
3030
self.login_to_swag_labs(username=username)
31+
if username == "problem_user":
32+
print("\n(This test should fail)")
3133

3234
# Verify that the "Test.allTheThings() T-Shirt" appears on the page
3335
item_name = "Test.allTheThings() T-Shirt"
@@ -91,6 +93,8 @@ def test_swag_labs_products_page_links(self, username):
9193
""" This test checks for 404s on the Swag Labs products page.
9294
This test is parameterized on the login user. """
9395
self.login_to_swag_labs(username=username, v1=True)
96+
if username == "problem_user":
97+
print("\n(This test should fail)")
9498
self.assert_no_404_errors()
9599

96100
@parameterized.expand([
@@ -102,6 +106,8 @@ def test_swag_labs_visual_regressions(self, username):
102106
""" This test checks for visual regressions on the Swag Labs page.
103107
This test is parameterized on the login user. """
104108
self.login_to_swag_labs(username="standard_user")
109+
if username == "problem_user":
110+
print("\n(This test should fail)")
105111
self.check_window(baseline=True)
106112
self.login_to_swag_labs(username=username)
107113
self.check_window(level=3)

examples/test_deferred_asserts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MyTestClass(BaseCase):
1313
def test_deferred_asserts(self):
1414
self.open('https://xkcd.com/993/')
1515
self.wait_for_element('#comic')
16-
print("\n(This test fails on purpose)")
16+
print("\n(This test should fail)")
1717
self.deferred_assert_element('img[alt="Brand Identity"]')
1818
self.deferred_assert_element('img[alt="Rocket Ship"]') # Will Fail
1919
self.deferred_assert_element('#comicmap')

examples/test_fail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ class MyTestClass(BaseCase):
1313
@pytest.mark.expected_failure
1414
def test_find_army_of_robots_on_xkcd_desert_island(self):
1515
self.open("https://xkcd.com/731/")
16-
print("\n(This test fails on purpose)")
16+
print("\n(This test should fail)")
1717
self.assert_element("div#ARMY_OF_ROBOTS", timeout=1)

examples/test_skype_site.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
from seleniumbase import BaseCase
1010

1111

12-
class SkypeWebsiteTestClass(BaseCase):
12+
class SkypeTests(BaseCase):
1313

14-
def test_skype_website_on_mobile(self):
14+
def test_skype_mobile_site(self):
1515
if not self.mobile_emulator:
16-
print("\n This test is only for mobile devices / emulators!")
17-
print(" (Usage: '--mobile' with a Chromium-based browser.)")
18-
self.skip("Please rerun this test using '--mobile' !!!")
16+
print("\n This test is only for mobile-device web browsers!")
17+
print(' (Use "--mobile" to run this test in Mobile Mode!)')
18+
self.skip('Use "--mobile" to run this test in Mobile Mode!')
1919
self.open("https://www.skype.com/en/")
2020
self.assert_text("Install Skype", "div.appInfo")
2121
self.highlight("div.appBannerContent")

examples/test_suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_1(self):
1515

1616
@pytest.mark.expected_failure
1717
def test_2(self):
18-
print("\n(This test fails on purpose)")
18+
print("\n(This test should fail)")
1919
self.open("https://xkcd.com/1675/")
2020
raise Exception("FAKE EXCEPTION: This test fails on purpose.")
2121

@@ -27,6 +27,6 @@ def test_3(self):
2727

2828
@pytest.mark.expected_failure
2929
def test_4(self):
30-
print("\n(This test fails on purpose)")
30+
print("\n(This test should fail)")
3131
self.open("https://xkcd.com/1670/")
3232
self.assert_element("FakeElement.DoesNotExist", timeout=0.5)

examples/timeout_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ class MyTestClass(BaseCase):
1515
def test_time_limit_feature(self):
1616
self.set_time_limit(5) # Fail test if time exceeds 5 seconds
1717
self.open("https://xkcd.com/1658/")
18-
print("\n(This test fails on purpose)")
18+
print("\n(This test should fail)")
1919
self.sleep(7)

examples/visual_testing/test_layout_fail.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def test_applitools_change(self):
1111
self.click('a[href="?diff1"]')
1212
# Click a button that makes a hidden element visible
1313
self.click("button")
14+
print("(This test should fail)")
1415
self.check_window(name="helloworld", level=3)
1516

1617
def test_python_home_change(self):
@@ -19,6 +20,7 @@ def test_python_home_change(self):
1920
self.check_window(name="python_home", baseline=True)
2021
# Remove the "Donate" button
2122
self.remove_element('a.donate-button')
23+
print("(This test should fail)")
2224
self.check_window(name="python_home", level=3)
2325

2426
def test_xkcd_logo_change(self):
@@ -28,4 +30,5 @@ def test_xkcd_logo_change(self):
2830
# Change height: (83 -> 110) , Change width: (185 -> 120)
2931
self.set_attribute('[alt="xkcd.com logo"]', "height", "110")
3032
self.set_attribute('[alt="xkcd.com logo"]', "width", "120")
33+
print("(This test should fail)")
3134
self.check_window(name="xkcd_554", level=3)

0 commit comments

Comments
 (0)