Update example tests

This commit is contained in:
Michael Mintz 2023-12-07 22:56:00 -05:00
parent 9fabde06ef
commit 04aacbb959
6 changed files with 14 additions and 11 deletions

View File

@ -17,5 +17,5 @@ class GitHubTests(BaseCase):
self.assert_element("div.repository-content")
self.assert_text("SeleniumBase", "strong a")
self.click('a[title="seleniumbase"]')
self.slow_click('a[aria-describedby="item-type-fixtures"]')
self.assert_element('a[aria-describedby="item-type-base_case.py"]')
self.slow_click('td[class*="large"] a[title="fixtures"]')
self.assert_element('td[class*="large"] a[title="base_case.py"]')

View File

@ -29,13 +29,17 @@ class UCPresentationClass(BaseCase):
self.get_new_driver(undetectable=True)
try:
self.driver.uc_open_with_tab("https://nowsecure.nl/#relax")
self.driver.uc_open_with_reconnect(
"https://nowsecure.nl/#relax", reconnect_time=3
)
try:
self.assert_text("OH YEAH, you passed!", "h1", timeout=4)
self.post_message("Selenium wasn't detected!", duration=4)
except Exception:
self.clear_all_cookies()
self.driver.uc_open_with_tab("https://nowsecure.nl/#relax")
self.driver.uc_open_with_reconnect(
"https://nowsecure.nl/#relax", reconnect_time=3
)
self.assert_text("OH YEAH, you passed!", "h1", timeout=4)
self.post_message("Selenium wasn't detected!", duration=4)
finally:
@ -51,8 +55,7 @@ class UCPresentationClass(BaseCase):
"</mk-1></p>"
)
self.begin_presentation(filename="uc_presentation.html")
subprocess.Popen("pytest multi_uc.py --uc -q -n3", shell=True)
self.sleep(6)
subprocess.Popen("pytest multi_uc.py --uc -n3", shell=True).wait()
self.create_presentation(theme="serif", transition="fade")
self.add_slide(
"<p>Not just an army of bots, but an army of bots<br />"

View File

@ -1,7 +1,7 @@
"""SB Manager using UC Mode for evading bot-detection."""
from seleniumbase import SB
with SB(uc=True) as sb:
with SB(uc=True, test=True) as sb:
sb.driver.uc_open_with_tab("https://nowsecure.nl/#relax")
sb.sleep(1.2)
if not sb.is_text_visible("OH YEAH, you passed!", "h1"):

View File

@ -26,7 +26,7 @@ class HackingTests(BaseCase):
self.highlight_click('[href="/seleniumbase/SeleniumBase"]')
self.highlight_click('a[title="examples"]')
self.assert_text("examples", "#file-name-id-wide")
self.highlight('a[aria-describedby="item-type-test_hack_search.py"]')
self.click('a[aria-describedby="item-type-test_hack_search.py"]')
self.highlight('td[class*="large"] a[title="test_hack_search.py"]')
self.click('td[class*="large"] a[title="test_hack_search.py"]')
self.assert_text("test_hack_search.py", "#file-name-id-wide")
self.highlight("#file-name-id-wide")

View File

@ -63,7 +63,7 @@ class ShadowDomTests(BaseCase):
)
remove_button = (
"downloads-manager::shadow #downloadsList"
" downloads-item::shadow #remove"
" downloads-item::shadow #remove-old"
)
no_downloads_area = "downloads-manager::shadow #no-downloads"

View File

@ -32,4 +32,4 @@ class YouTubeSearchTests(BaseCase):
'Actual text was "%s"!' % (search_term, top_result),
)
self.click(result_selector)
self.assert_element_present('a[aria-label*="SeleniumBase"]')
self.sleep(1)