Skip to content

Commit 3ed8401

Browse files
committed
Update visual testing examples
1 parent 73cc04f commit 3ed8401

File tree

2 files changed

+10
-30
lines changed

2 files changed

+10
-30
lines changed

examples/visual_testing/layout_test.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,22 @@
33

44

55
class VisualLayoutTests(BaseCase):
6-
def test_applitools_layout_change(self):
6+
def test_xkcd_layout_change(self):
77
self.demo_mode = False # (It would interfere with html comparisons)
8-
self.open("https://applitools.com/helloworld/?diff1")
9-
self.wait_for_element('a[href="?diff1"]')
8+
self.open("https://xkcd.com/1424/")
109
print('\nCreating baseline in "visual_baseline" folder.')
1110
self.sleep(0.08)
12-
self.check_window(name="helloworld", baseline=True)
13-
# Click a button that changes the text of an element
14-
# (Text changes do not impact visual comparisons)
15-
self.sleep(0.06)
16-
self.click('a[href="?diff1"]')
17-
self.sleep(0.14)
11+
self.check_window(name="xkcd", baseline=True)
12+
# Go to a different comic
13+
self.open("https://xkcd.com/1425/")
1814
# Verify html tags match the baseline
19-
self.check_window(name="helloworld", level=1)
15+
self.check_window(name="xkcd", level=1)
2016
# Verify html tags and attribute names match the baseline
21-
self.check_window(name="helloworld", level=2)
22-
# Verify html tags and attribute values match the baseline
23-
self.check_window(name="helloworld", level=3)
24-
# Click a button that makes a hidden element visible
25-
self.click("button")
26-
self.check_window(name="helloworld", level=1)
27-
self.check_window(name="helloworld", level=2)
17+
self.check_window(name="xkcd", level=2)
18+
# Verify html tags and attribute values don't match the baseline
2819
with self.assert_raises(Exception):
29-
self.check_window(name="helloworld", level=3)
20+
self.check_window(name="xkcd", level=3)
3021
# Now that we know the Exception was raised as expected,
3122
# let's print out the comparison results by running a Level-0 check.
3223
# (NOTE: Running with level-0 will print but NOT raise an Exception.)
33-
self.check_window(name="helloworld", level=0)
24+
self.check_window(name="xkcd", level=0)

examples/visual_testing/test_layout_fail.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ def test_python_home_change(self, sb):
1515

1616

1717
class VisualLayoutFailureTests(BaseCase):
18-
def test_applitools_change(self):
19-
self.open("https://applitools.com/helloworld/?diff1")
20-
print('\nCreating baseline in "visual_baseline" folder.')
21-
self.check_window(name="helloworld", baseline=True)
22-
# Click a button that changes the text of an element
23-
self.click('a[href="?diff1"]')
24-
# Click a button that makes a hidden element visible
25-
self.slow_click("button")
26-
print("(This test should fail)") # due to image now seen
27-
self.check_window(name="helloworld", level=3)
28-
2918
def test_xkcd_logo_change(self):
3019
self.open("https://xkcd.com/554/")
3120
print('\nCreating baseline in "visual_baseline" folder.')

0 commit comments

Comments
 (0)