Skip to content

Commit 5e9ec25

Browse files
committed
Update example tests
1 parent 6aeebf2 commit 5e9ec25

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

examples/github_test.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ def test_github(self):
99
# To avoid this automation blocker, two steps are being taken:
1010
# 1. self.slow_click() is being used to slow down Selenium actions.
1111
# 2. The browser's User Agent is modified to avoid Selenium-detection
12-
# when running in headless mode on Chrome or Edge (Chromium).
13-
if self.headless and (
14-
self.browser == "chrome" or self.browser == "edge"
15-
):
12+
# when running in headless mode.
13+
if self.headless:
1614
self.get_new_driver(
1715
agent="""Mozilla/5.0 """
1816
"""AppleWebKit/537.36 (KHTML, like Gecko) """
19-
"""Chrome/92.0.4515.159 Safari/537.36"""
17+
"""Chrome/Version 96.0.4664.55 Safari/537.36"""
2018
)
2119
self.open("https://github.com/search?q=SeleniumBase")
2220
self.slow_click('a[href="/seleniumbase/SeleniumBase"]')

examples/handle_alert_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
class HandleAlertTests(BaseCase):
55
def test_alerts(self):
6-
if self.browser == "safari":
7-
self.skip("This test doesn't run on Safari! (alert issues)")
86
self.open("about:blank")
97
self.execute_script('window.alert("ALERT!!!");')
108
self.sleep(1) # Not needed (Lets you see the alert pop up)
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1+
""" Visual Layout Testing with different Syntax Formats """
2+
13
from seleniumbase import BaseCase
24

35

6+
class VisualLayout_FixtureTests():
7+
def test_python_home_change(sb):
8+
sb.open("https://python.org/")
9+
print('\nCreating baseline in "visual_baseline" folder.')
10+
sb.check_window(name="python_home", baseline=True)
11+
# Remove the "Donate" button
12+
sb.remove_element("a.donate-button")
13+
print("(This test should fail)") # due to missing button
14+
sb.check_window(name="python_home", level=3)
15+
16+
417
class VisualLayoutFailureTests(BaseCase):
518
def test_applitools_change(self):
619
self.open("https://applitools.com/helloworld?diff1")
@@ -10,24 +23,15 @@ def test_applitools_change(self):
1023
self.click('a[href="?diff1"]')
1124
# Click a button that makes a hidden element visible
1225
self.click("button")
13-
print("(This test should fail)")
26+
print("(This test should fail)") # due to image now seen
1427
self.check_window(name="helloworld", level=3)
1528

16-
def test_python_home_change(self):
17-
self.open("https://python.org/")
18-
print('\nCreating baseline in "visual_baseline" folder.')
19-
self.check_window(name="python_home", baseline=True)
20-
# Remove the "Donate" button
21-
self.remove_element("a.donate-button")
22-
print("(This test should fail)")
23-
self.check_window(name="python_home", level=3)
24-
2529
def test_xkcd_logo_change(self):
2630
self.open("https://xkcd.com/554/")
2731
print('\nCreating baseline in "visual_baseline" folder.')
2832
self.check_window(name="xkcd_554", baseline=True)
2933
# Change height: (83 -> 110) , Change width: (185 -> 120)
3034
self.set_attribute('[alt="xkcd.com logo"]', "height", "110")
3135
self.set_attribute('[alt="xkcd.com logo"]', "width", "120")
32-
print("(This test should fail)")
36+
print("(This test should fail)") # due to a resized logo
3337
self.check_window(name="xkcd_554", level=3)

0 commit comments

Comments
 (0)