Skip to content

Commit eb2f770

Browse files
committed
Update example tests
1 parent c6c69bb commit eb2f770

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

examples/offline_examples/test_demo_page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def test_demo_page(self):
2525
# Assert that a text substring appears in an element
2626
self.assert_text("Demo Page", "h1")
2727

28-
# Type text into various text fields and then verify
28+
# Type text into various text fields and then assert
2929
self.type("#myTextInput", "This is Automated")
3030
self.type("textarea.area1", "Testing Time!\n")
3131
self.type('[name="preText2"]', "Typing Text!")
3232
self.assert_text("This is Automated", "#myTextInput")
3333
self.assert_text("Testing Time!\n", "textarea.area1")
3434
self.assert_text("Typing Text!", '[name="preText2"]')
3535

36-
# Verify that a hover dropdown link changes page text
36+
# Hover & click a dropdown element and assert results
3737
self.assert_text("Automation Practice", "h3")
3838
try:
3939
self.hover_and_click("#myDropdown", "#dropOption2", timeout=1)
@@ -42,7 +42,7 @@ def test_demo_page(self):
4242
self.js_click("#dropOption2")
4343
self.assert_text("Link Two Selected", "h3")
4444

45-
# Verify that a button click changes text on the page
45+
# Click a button and then verify the expected results
4646
self.assert_text("This Text is Green", "#pText")
4747
self.click('button:contains("Click Me")')
4848
self.assert_text("This Text is Purple", "#pText")

examples/test_demo_site.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
from seleniumbase import BaseCase
2-
from seleniumbase import version_tuple
32

43

54
class DemoSiteTests(BaseCase):
65
def test_demo_site(self):
6+
# Open a web page in the active browser window
77
self.open("https://seleniumbase.io/demo_page")
88

9-
# Fail if the seleniumbase version is less than 4.0.0
10-
if version_tuple < (4, 0, 0):
11-
self.fail("This test requires seleniumbase>=4.0.0")
12-
139
# Assert the title of the current web page
1410
self.assert_title("Web Testing Page")
1511

@@ -19,15 +15,15 @@ def test_demo_site(self):
1915
# Assert that a text substring appears in an element
2016
self.assert_text("Demo Page", "h1")
2117

22-
# Type text into various text fields and then verify
18+
# Type text into various text fields and then assert
2319
self.type("#myTextInput", "This is Automated")
2420
self.type("textarea.area1", "Testing Time!\n")
2521
self.type('[name="preText2"]', "Typing Text!")
2622
self.assert_text("This is Automated", "#myTextInput")
2723
self.assert_text("Testing Time!\n", "textarea.area1")
2824
self.assert_text("Typing Text!", '[name="preText2"]')
2925

30-
# Verify that a hover dropdown link changes page text
26+
# Hover & click a dropdown element and assert results
3127
self.assert_text("Automation Practice", "h3")
3228
try:
3329
self.hover_and_click("#myDropdown", "#dropOption2", timeout=1)
@@ -36,7 +32,7 @@ def test_demo_site(self):
3632
self.js_click("#dropOption2")
3733
self.assert_text("Link Two Selected", "h3")
3834

39-
# Verify that a button click changes text on the page
35+
# Click a button and then verify the expected results
4036
self.assert_text("This Text is Green", "#pText")
4137
self.click('button:contains("Click Me")')
4238
self.assert_text("This Text is Purple", "#pText")
@@ -119,9 +115,3 @@ def test_demo_site(self):
119115
self.demo_mode = True
120116
self.type("input", "Have a Nice Day!")
121117
self.assert_text("SeleniumBase", "h2")
122-
123-
# Assert no broken links (Can be slow if many links)
124-
# self.assert_no_404_errors()
125-
126-
# Assert no JavaScript errors (Can also detect 404s)
127-
# self.assert_no_js_errors()

integrations/node_js/test_demo_site.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
from seleniumbase import BaseCase
2-
from seleniumbase import version_tuple
32

43

54
class DemoSiteTests(BaseCase):
65
def test_demo_site(self):
6+
# Open a web page in the active browser window
77
self.open("https://seleniumbase.io/demo_page")
88

9-
# Fail if the seleniumbase version is less than 4.0.0
10-
if version_tuple < (4, 0, 0):
11-
self.fail("This test requires seleniumbase>=4.0.0")
12-
139
# Assert the title of the current web page
1410
self.assert_title("Web Testing Page")
1511

@@ -19,15 +15,15 @@ def test_demo_site(self):
1915
# Assert that a text substring appears in an element
2016
self.assert_text("Demo Page", "h1")
2117

22-
# Type text into various text fields and then verify
18+
# Type text into various text fields and then assert
2319
self.type("#myTextInput", "This is Automated")
2420
self.type("textarea.area1", "Testing Time!\n")
2521
self.type('[name="preText2"]', "Typing Text!")
2622
self.assert_text("This is Automated", "#myTextInput")
2723
self.assert_text("Testing Time!\n", "textarea.area1")
2824
self.assert_text("Typing Text!", '[name="preText2"]')
2925

30-
# Verify that a hover dropdown link changes page text
26+
# Hover & click a dropdown element and assert results
3127
self.assert_text("Automation Practice", "h3")
3228
try:
3329
self.hover_and_click("#myDropdown", "#dropOption2", timeout=1)
@@ -36,7 +32,7 @@ def test_demo_site(self):
3632
self.js_click("#dropOption2")
3733
self.assert_text("Link Two Selected", "h3")
3834

39-
# Verify that a button click changes text on the page
35+
# Click a button and then verify the expected results
4036
self.assert_text("This Text is Green", "#pText")
4137
self.click('button:contains("Click Me")')
4238
self.assert_text("This Text is Purple", "#pText")
@@ -119,9 +115,3 @@ def test_demo_site(self):
119115
self.demo_mode = True
120116
self.type("input", "Have a Nice Day!")
121117
self.assert_text("SeleniumBase", "h2")
122-
123-
# Assert no broken links (Can be slow if many links)
124-
# self.assert_no_404_errors()
125-
126-
# Assert no JavaScript errors (Can also detect 404s)
127-
# self.assert_no_js_errors()

0 commit comments

Comments
 (0)