Skip to content

Commit caa8ca8

Browse files
committed
Add a visual test to verify the check_window() method
1 parent 0950aef commit caa8ca8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

examples/visual_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from seleniumbase import BaseCase
2+
3+
4+
class AutomatedVisualTest(BaseCase):
5+
6+
def test_applitools_helloworld(self):
7+
self.open('https://applitools.com/helloworld?diff1')
8+
print('Creating baseline in "visual_baseline" folder...')
9+
self.check_window(name="helloworld", baseline=True)
10+
self.click('a[href="?diff1"]')
11+
# Verify html tags match previous version
12+
self.check_window(name="helloworld", level=1)
13+
# Verify html tags + attributes match previous version
14+
self.check_window(name="helloworld", level=2)
15+
# Verify html tags + attributes + values match previous version
16+
self.check_window(name="helloworld", level=3)
17+
# Change the page enough for a Level-3 comparison to fail
18+
self.click("button")
19+
self.check_window(name="helloworld", level=1)
20+
self.check_window(name="helloworld", level=2)
21+
with self.assertRaises(Exception):
22+
self.check_window(name="helloworld", level=3)
23+
# Now that we know the exception was raised as expected,
24+
# let's print out the comparison results by running in Level-0.
25+
self.check_window(name="helloworld", level=0)

0 commit comments

Comments
 (0)