Update example tests

This commit is contained in:
Michael Mintz 2022-02-03 22:17:24 -05:00
parent b420059e74
commit b31dd11cdf
10 changed files with 39 additions and 42 deletions

View File

@ -44,7 +44,7 @@ class DialogBoxTests(BaseCase):
break
self.open("https://xkcd.com/1117/")
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_cs.png"
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png"
self.set_attributes("#news img", "src", sb_banner_logo)
options = [("theme", "material"), ("width", "52%")]
message = 'With one button, you can press "Enter/Return", "Y", or "1".'
@ -97,13 +97,14 @@ class DialogBoxTests(BaseCase):
message = "Now let's combine form inputs with multiple button options!"
message += "<br /><br />"
message += "Pick something to search. Then pick the site to search on."
buttons = ["XKCD.com Store", "Wikipedia.org"]
buttons = ["SeleniumBase.io", "Wikipedia.org"]
text, choice = self.get_jqc_form_inputs(message, buttons)
if choice == "XKCD.com Store":
self.open("https://store.xkcd.com/search")
if choice == "SeleniumBase.io":
self.open("https://seleniumbase.io/")
self.highlight_type('input[aria-label="Search"]', text + "\n")
else:
self.open("https://en.wikipedia.org/wiki/Special:Search")
self.highlight_type('input[id*="search"]', text + "\n")
self.highlight_type('input[id*="search"]', text + "\n")
self.wait_for_ready_state_complete()
self.sleep(1)
self.highlight("body")

View File

@ -15,7 +15,7 @@ class HackTests(BaseCase):
ayb = "ALL YOUR BASE"
abtu = "ARE BELONG TO US"
aybabtu = "%s %s" % (ayb, abtu)
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_ds.png"
sb_banner_logo = "//seleniumbase.io/cdn/img/sb_logo_10.png"
sb_dashboard_logo = "//seleniumbase.io/img/dash_pie_3.png"
yt_chip = "#chips yt-chip-cloud-chip-renderer:nth-of-type"
wiki = "https://en.wikipedia.org/wiki/All_your_base_are_belong_to_us"
@ -215,12 +215,12 @@ class HackTests(BaseCase):
self.set_text_content('a[href="/archive"]', "ALL")
self.set_text_content('a[href*="what-if"]', "YOUR")
self.set_text_content('a[href*="//blag."]', "BASE")
self.set_text_content('a[href*="how-to"]', "ARE")
self.set_text_content('a[href*="/store"]', "BELONG")
self.set_text_content('a[href*="/about"]', "TO")
self.set_text_content('a[href*="/atom."]', "US")
self.remove_element('a:contains("Email")')
self.set_text_content('a[href*="/about"]', abtu)
self.remove_element('li:contains("Feed")')
self.remove_element('li:contains("TW")')
self.remove_element('li:contains("Books")')
self.remove_element('li:contains("What")')
self.remove_element('li:contains("WI")')
self.set_attributes("#news img", "src", sb_banner_logo)
self.set_text_content('#ctitle', aybabtu)
self.set_text_content('a[rel="prev"]', "All")
@ -230,10 +230,7 @@ class HackTests(BaseCase):
self.highlight('a[href="/archive"]', loops=1, scroll=False)
self.highlight('a[href*="what-if"]', loops=1, scroll=False)
self.highlight('a[href*="//blag."]', loops=2, scroll=False)
self.highlight('a[href*="how-to"]', loops=1, scroll=False)
self.highlight('a[href*="/store"]', loops=1, scroll=False)
self.highlight('a[href*="/about"]', loops=1, scroll=False)
self.highlight('a[href*="/atom."]', loops=2, scroll=False)
self.highlight('a[href*="/about"]', loops=5, scroll=False)
self.highlight('a[rel="prev"]', loops=1, scroll=False)
self.highlight('a[href*="random"]', loops=1, scroll=False)
self.highlight('a[rel="next"]', loops=3, scroll=False)
@ -247,14 +244,6 @@ class HackTests(BaseCase):
self.highlight('button[data-section*="news"]', loops=4, scroll=False)
self.highlight("h2", loops=6, scroll=False)
self.open("https://store.xkcd.com/search")
self.set_text_content('a[href="/pages/about-us"]', ayb)
self.set_text_content('a:contains("the comic")', abtu)
self.set_text_content('#search-form input[name="q"]', aybabtu)
self.highlight('a[href="/pages/about-us"]', loops=4, scroll=False)
self.highlight('a[href="http://xkcd.com"]', loops=4, scroll=False)
self.highlight('#search-form', loops=8, scroll=False)
self.open("https://support.gog.com/hc/en-us?product=gog")
self.set_text_content("div.intro-title", aybabtu)
self.set_text_content("h4", aybabtu)
@ -405,10 +394,11 @@ class HackTests(BaseCase):
self.open("https://teamtreehouse.com/")
self.set_text_content("li.nav-item-free-trial", aybabtu)
self.set_text_content("h1", aybabtu)
self.set_text_content("h2", aybabtu)
self.set_text_content("p.homepage-signup-form-banner", aybabtu)
self.highlight("li.nav-item-free-trial", loops=6, scroll=False)
self.highlight("h2", loops=6, scroll=False)
self.highlight("h1", loops=6, scroll=False)
self.highlight('p[class*="signup-form"]', loops=8, scroll=False)
self.open("https://pragprog.com/")

View File

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

View File

@ -15,9 +15,11 @@ class MasterQATests(MasterQA):
self.verify("Can you find the moon?")
self.click('a[rel="next"]')
self.verify("Do the drones look safe?")
self.open("https://store.xkcd.com/search")
self.type("input.search-input", "book\n")
self.verify("Do you see books in the search results?")
self.open("https://seleniumbase.io/devices/")
self.type("input#urlInput", "seleniumbase.io/error_page\n")
self.verify("Do you see Octocat in a Jedi knight robe?")
self.open("https://xkcd.com/213/")
for i in range(5):
self.click('a[rel="prev"]')

View File

@ -11,7 +11,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_bootstrap_tour()
@ -19,7 +19,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.highlight_type('input[title="Search"]', "GitHub\n")
self.ad_block()
self.wait_for_element("#search")

View File

@ -13,7 +13,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
# Create a website tour using the ShepherdJS library with "light" theme
@ -23,7 +23,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.highlight_type('input[title="Search"]', "GitHub\n")
self.ad_block()
self.wait_for_element("#search")

View File

@ -11,7 +11,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_hopscotch_tour()
@ -19,7 +19,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.highlight_type('input[title="Search"]', "GitHub\n")
self.ad_block()
self.wait_for_element("#search")

View File

@ -11,7 +11,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_introjs_tour()
@ -19,7 +19,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.highlight_type('input[title="Search"]', "GitHub\n")
self.ad_block()
self.wait_for_element("#search")

View File

@ -11,7 +11,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_shepherd_tour(theme="light")
@ -19,7 +19,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "GitHub\n")
self.highlight_type('input[title="Search"]', "GitHub\n")
self.ad_block()
self.wait_for_element("#search")

View File

@ -4,6 +4,7 @@ from seleniumbase import BaseCase
class YouTubeSearchTests(BaseCase):
def test_youtube_autocomplete_results(self):
""" Verify YouTube autocomplete search results. """
self.get_new_driver(block_images=True) # Runs faster
self.open("https://www.youtube.com/")
search_term = "seleniumbase"
search_selector = "input#search"
@ -24,6 +25,7 @@ class YouTubeSearchTests(BaseCase):
def test_youtube_search_results(self):
""" Verify finding a specific video by performing a YouTube search. """
self.get_new_driver(block_images=True) # Runs faster
self.open("https://www.youtube.com/")
search_term = "SeleniumBase Common API Methods"
search_selector = "input#search"