Update example tests
This commit is contained in:
parent
6aeebf2847
commit
5e9ec258d4
|
@ -9,14 +9,12 @@ class GitHubTests(BaseCase):
|
|||
# To avoid this automation blocker, two steps are being taken:
|
||||
# 1. self.slow_click() is being used to slow down Selenium actions.
|
||||
# 2. The browser's User Agent is modified to avoid Selenium-detection
|
||||
# when running in headless mode on Chrome or Edge (Chromium).
|
||||
if self.headless and (
|
||||
self.browser == "chrome" or self.browser == "edge"
|
||||
):
|
||||
# when running in headless mode.
|
||||
if self.headless:
|
||||
self.get_new_driver(
|
||||
agent="""Mozilla/5.0 """
|
||||
"""AppleWebKit/537.36 (KHTML, like Gecko) """
|
||||
"""Chrome/92.0.4515.159 Safari/537.36"""
|
||||
"""Chrome/Version 96.0.4664.55 Safari/537.36"""
|
||||
)
|
||||
self.open("https://github.com/search?q=SeleniumBase")
|
||||
self.slow_click('a[href="/seleniumbase/SeleniumBase"]')
|
||||
|
|
|
@ -3,8 +3,6 @@ from seleniumbase import BaseCase
|
|||
|
||||
class HandleAlertTests(BaseCase):
|
||||
def test_alerts(self):
|
||||
if self.browser == "safari":
|
||||
self.skip("This test doesn't run on Safari! (alert issues)")
|
||||
self.open("about:blank")
|
||||
self.execute_script('window.alert("ALERT!!!");')
|
||||
self.sleep(1) # Not needed (Lets you see the alert pop up)
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
""" Visual Layout Testing with different Syntax Formats """
|
||||
|
||||
from seleniumbase import BaseCase
|
||||
|
||||
|
||||
class VisualLayout_FixtureTests():
|
||||
def test_python_home_change(sb):
|
||||
sb.open("https://python.org/")
|
||||
print('\nCreating baseline in "visual_baseline" folder.')
|
||||
sb.check_window(name="python_home", baseline=True)
|
||||
# Remove the "Donate" button
|
||||
sb.remove_element("a.donate-button")
|
||||
print("(This test should fail)") # due to missing button
|
||||
sb.check_window(name="python_home", level=3)
|
||||
|
||||
|
||||
class VisualLayoutFailureTests(BaseCase):
|
||||
def test_applitools_change(self):
|
||||
self.open("https://applitools.com/helloworld?diff1")
|
||||
|
@ -10,18 +23,9 @@ class VisualLayoutFailureTests(BaseCase):
|
|||
self.click('a[href="?diff1"]')
|
||||
# Click a button that makes a hidden element visible
|
||||
self.click("button")
|
||||
print("(This test should fail)")
|
||||
print("(This test should fail)") # due to image now seen
|
||||
self.check_window(name="helloworld", level=3)
|
||||
|
||||
def test_python_home_change(self):
|
||||
self.open("https://python.org/")
|
||||
print('\nCreating baseline in "visual_baseline" folder.')
|
||||
self.check_window(name="python_home", baseline=True)
|
||||
# Remove the "Donate" button
|
||||
self.remove_element("a.donate-button")
|
||||
print("(This test should fail)")
|
||||
self.check_window(name="python_home", level=3)
|
||||
|
||||
def test_xkcd_logo_change(self):
|
||||
self.open("https://xkcd.com/554/")
|
||||
print('\nCreating baseline in "visual_baseline" folder.')
|
||||
|
@ -29,5 +33,5 @@ class VisualLayoutFailureTests(BaseCase):
|
|||
# Change height: (83 -> 110) , Change width: (185 -> 120)
|
||||
self.set_attribute('[alt="xkcd.com logo"]', "height", "110")
|
||||
self.set_attribute('[alt="xkcd.com logo"]', "width", "120")
|
||||
print("(This test should fail)")
|
||||
print("(This test should fail)") # due to a resized logo
|
||||
self.check_window(name="xkcd_554", level=3)
|
||||
|
|
Loading…
Reference in New Issue