Skip to content

Commit b31dd11

Browse files
committed
Update example tests
1 parent b420059 commit b31dd11

10 files changed

+39
-42
lines changed

examples/dialog_boxes/dialog_box_tour.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_dialog_boxes(self):
4444
break
4545

4646
self.open("https://xkcd.com/1117/")
47-
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_cs.png"
47+
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png"
4848
self.set_attributes("#news img", "src", sb_banner_logo)
4949
options = [("theme", "material"), ("width", "52%")]
5050
message = 'With one button, you can press "Enter/Return", "Y", or "1".'
@@ -97,13 +97,14 @@ def test_dialog_boxes(self):
9797
message = "Now let's combine form inputs with multiple button options!"
9898
message += "<br /><br />"
9999
message += "Pick something to search. Then pick the site to search on."
100-
buttons = ["XKCD.com Store", "Wikipedia.org"]
100+
buttons = ["SeleniumBase.io", "Wikipedia.org"]
101101
text, choice = self.get_jqc_form_inputs(message, buttons)
102-
if choice == "XKCD.com Store":
103-
self.open("https://store.xkcd.com/search")
102+
if choice == "SeleniumBase.io":
103+
self.open("https://seleniumbase.io/")
104+
self.highlight_type('input[aria-label="Search"]', text + "\n")
104105
else:
105106
self.open("https://en.wikipedia.org/wiki/Special:Search")
106-
self.highlight_type('input[id*="search"]', text + "\n")
107+
self.highlight_type('input[id*="search"]', text + "\n")
107108
self.wait_for_ready_state_complete()
108109
self.sleep(1)
109110
self.highlight("body")

examples/hack_the_planet.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_all_your_base_are_belong_to_us(self):
1515
ayb = "ALL YOUR BASE"
1616
abtu = "ARE BELONG TO US"
1717
aybabtu = "%s %s" % (ayb, abtu)
18-
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_ds.png"
18+
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png"
1919
sb_dashboard_logo = "//seleniumbase.io/img/dash_pie_3.png"
2020
yt_chip = "#chips yt-chip-cloud-chip-renderer:nth-of-type"
2121
wiki = "https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"
@@ -215,12 +215,12 @@ def test_all_your_base_are_belong_to_us(self):
215215
self.set_text_content('a[href="/archive"]', "ALL")
216216
self.set_text_content('a[href*="what-if"]', "YOUR")
217217
self.set_text_content('a[href*="//blag."]', "BASE")
218-
self.set_text_content('a[href*="how-to"]', "ARE")
219-
self.set_text_content('a[href*="/store"]', "BELONG")
220-
self.set_text_content('a[href*="/about"]', "TO")
221-
self.set_text_content('a[href*="/atom."]', "US")
222-
self.remove_element('a:contains("Email")')
218+
self.set_text_content('a[href*="/about"]', abtu)
219+
self.remove_element('li:contains("Feed")')
223220
self.remove_element('li:contains("TW")')
221+
self.remove_element('li:contains("Books")')
222+
self.remove_element('li:contains("What")')
223+
self.remove_element('li:contains("WI")')
224224
self.set_attributes("#news img", "src", sb_banner_logo)
225225
self.set_text_content('#ctitle', aybabtu)
226226
self.set_text_content('a[rel="prev"]', "All")
@@ -230,10 +230,7 @@ def test_all_your_base_are_belong_to_us(self):
230230
self.highlight('a[href="/archive"]', loops=1, scroll=False)
231231
self.highlight('a[href*="what-if"]', loops=1, scroll=False)
232232
self.highlight('a[href*="//blag."]', loops=2, scroll=False)
233-
self.highlight('a[href*="how-to"]', loops=1, scroll=False)
234-
self.highlight('a[href*="/store"]', loops=1, scroll=False)
235-
self.highlight('a[href*="/about"]', loops=1, scroll=False)
236-
self.highlight('a[href*="/atom."]', loops=2, scroll=False)
233+
self.highlight('a[href*="/about"]', loops=5, scroll=False)
237234
self.highlight('a[rel="prev"]', loops=1, scroll=False)
238235
self.highlight('a[href*="random"]', loops=1, scroll=False)
239236
self.highlight('a[rel="next"]', loops=3, scroll=False)
@@ -247,14 +244,6 @@ def test_all_your_base_are_belong_to_us(self):
247244
self.highlight('button[data-section*="news"]', loops=4, scroll=False)
248245
self.highlight("h2", loops=6, scroll=False)
249246

250-
self.open("https://store.xkcd.com/search")
251-
self.set_text_content('a[href="/pages/about-us"]', ayb)
252-
self.set_text_content('a:contains("the comic")', abtu)
253-
self.set_text_content('#search-form input[name="q"]', aybabtu)
254-
self.highlight('a[href="/pages/about-us"]', loops=4, scroll=False)
255-
self.highlight('a[href="http://xkcd.com"]', loops=4, scroll=False)
256-
self.highlight('#search-form', loops=8, scroll=False)
257-
258247
self.open("https://support.gog.com/hc/en-us?product=gog")
259248
self.set_text_content("div.intro-title", aybabtu)
260249
self.set_text_content("h4", aybabtu)
@@ -405,10 +394,11 @@ def test_all_your_base_are_belong_to_us(self):
405394

406395
self.open("https://teamtreehouse.com/")
407396
self.set_text_content("li.nav-item-free-trial", aybabtu)
397+
self.set_text_content("h1", aybabtu)
408398
self.set_text_content("h2", aybabtu)
409399
self.set_text_content("p.homepage-signup-form-banner", aybabtu)
410400
self.highlight("li.nav-item-free-trial", loops=6, scroll=False)
411-
self.highlight("h2", loops=6, scroll=False)
401+
self.highlight("h1", loops=6, scroll=False)
412402
self.highlight('p[class*="signup-form"]', loops=8, scroll=False)
413403

414404
self.open("https://pragprog.com/")

examples/master_qa/basic_masterqa_test_0.py

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

44
class MasterQATests(MasterQA):
55
def test_masterqa(self):
6+
self.open("https://seleniumbase.io/devices/")
7+
self.highlight("div.mockup-wrapper")
8+
self.verify("Do you see 4 computer devices?")
9+
self.open("https://seleniumbase.io/demo_page")
10+
self.highlight('table')
11+
self.verify("Do you see elements in a table?")
612
self.open("https://xkcd.com/1700/")
13+
self.highlight("#comic")
714
self.verify("Do you see a webcomic?")
8-
self.open("https://store.xkcd.com/collections/everything")
9-
self.highlight_click('[title="things for walls"]')
10-
self.verify("Do you see posters for sale?")
11-
self.highlight_update_text("input.search-input", "book\n")
12-
self.verify("Do you see books in the search results?")

examples/master_qa/masterqa_test_1.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ def test_xkcd(self):
1515
self.verify("Can you find the moon?")
1616
self.click('a[rel="next"]')
1717
self.verify("Do the drones look safe?")
18-
self.open("https://store.xkcd.com/search")
19-
self.type("input.search-input", "book\n")
20-
self.verify("Do you see books in the search results?")
18+
19+
self.open("https://seleniumbase.io/devices/")
20+
self.type("input#urlInput", "seleniumbase.io/error_page\n")
21+
self.verify("Do you see Octocat in a Jedi knight robe?")
22+
2123
self.open("https://xkcd.com/213/")
2224
for i in range(5):
2325
self.click('a[rel="prev"]')

examples/tour_examples/bootstrap_google_tour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ def test_google_tour(self):
1111
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
1212
self.play_tour()
1313

14-
self.highlight_update_text('input[title="Search"]', "Google")
14+
self.highlight_type('input[title="Search"]', "Google")
1515
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1616

1717
self.create_bootstrap_tour()
1818
self.add_tour_step("Then click to search.", '[value="Google Search"]')
1919
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2020
self.play_tour()
2121

22-
self.highlight_update_text('input[title="Search"]', "GitHub\n")
22+
self.highlight_type('input[title="Search"]', "GitHub\n")
2323
self.ad_block()
2424
self.wait_for_element("#search")
2525

examples/tour_examples/google_tour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_google_tour(self):
1313
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
1414
self.play_tour()
1515

16-
self.highlight_update_text('input[title="Search"]', "Google")
16+
self.highlight_type('input[title="Search"]', "Google")
1717
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1818

1919
# Create a website tour using the ShepherdJS library with "light" theme
@@ -23,7 +23,7 @@ def test_google_tour(self):
2323
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2424
self.play_tour()
2525

26-
self.highlight_update_text('input[title="Search"]', "GitHub\n")
26+
self.highlight_type('input[title="Search"]', "GitHub\n")
2727
self.ad_block()
2828
self.wait_for_element("#search")
2929

examples/tour_examples/hopscotch_google_tour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ def test_google_tour(self):
1111
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
1212
self.play_tour()
1313

14-
self.highlight_update_text('input[title="Search"]', "Google")
14+
self.highlight_type('input[title="Search"]', "Google")
1515
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1616

1717
self.create_hopscotch_tour()
1818
self.add_tour_step("Then click to search.", '[value="Google Search"]')
1919
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2020
self.play_tour()
2121

22-
self.highlight_update_text('input[title="Search"]', "GitHub\n")
22+
self.highlight_type('input[title="Search"]', "GitHub\n")
2323
self.ad_block()
2424
self.wait_for_element("#search")
2525

examples/tour_examples/introjs_google_tour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ def test_google_tour(self):
1111
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
1212
self.play_tour()
1313

14-
self.highlight_update_text('input[title="Search"]', "Google")
14+
self.highlight_type('input[title="Search"]', "Google")
1515
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1616

1717
self.create_introjs_tour()
1818
self.add_tour_step("Then click to search.", '[value="Google Search"]')
1919
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2020
self.play_tour()
2121

22-
self.highlight_update_text('input[title="Search"]', "GitHub\n")
22+
self.highlight_type('input[title="Search"]', "GitHub\n")
2323
self.ad_block()
2424
self.wait_for_element("#search")
2525

examples/tour_examples/shepherd_google_tour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ def test_google_tour(self):
1111
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
1212
self.play_tour()
1313

14-
self.highlight_update_text('input[title="Search"]', "Google")
14+
self.highlight_type('input[title="Search"]', "Google")
1515
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1616

1717
self.create_shepherd_tour(theme="light")
1818
self.add_tour_step("Then click to search.", '[value="Google Search"]')
1919
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2020
self.play_tour()
2121

22-
self.highlight_update_text('input[title="Search"]', "GitHub\n")
22+
self.highlight_type('input[title="Search"]', "GitHub\n")
2323
self.ad_block()
2424
self.wait_for_element("#search")
2525

examples/youtube_search_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class YouTubeSearchTests(BaseCase):
55
def test_youtube_autocomplete_results(self):
66
""" Verify YouTube autocomplete search results. """
7+
self.get_new_driver(block_images=True) # Runs faster
78
self.open("https://www.youtube.com/")
89
search_term = "seleniumbase"
910
search_selector = "input#search"
@@ -24,6 +25,7 @@ def test_youtube_autocomplete_results(self):
2425

2526
def test_youtube_search_results(self):
2627
""" Verify finding a specific video by performing a YouTube search. """
28+
self.get_new_driver(block_images=True) # Runs faster
2729
self.open("https://www.youtube.com/")
2830
search_term = "SeleniumBase Common API Methods"
2931
search_selector = "input#search"

0 commit comments

Comments
 (0)