2019-04-01 15:05:24 +08:00
|
|
|
from seleniumbase import BaseCase
|
|
|
|
|
|
|
|
|
2021-03-11 06:27:52 +08:00
|
|
|
class VisualLayoutTests(BaseCase):
|
2020-01-31 17:17:14 +08:00
|
|
|
def test_applitools_layout_change(self):
|
2021-05-04 10:39:14 +08:00
|
|
|
self.open("https://applitools.com/helloworld?diff1")
|
2020-01-31 17:51:39 +08:00
|
|
|
print('\nCreating baseline in "visual_baseline" folder.')
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", baseline=True)
|
2020-02-09 05:45:23 +08:00
|
|
|
# Click a button that changes the text of an element
|
|
|
|
# (Text changes do not impact visual comparisons)
|
2019-04-01 15:05:24 +08:00
|
|
|
self.click('a[href="?diff1"]')
|
2020-01-31 17:51:39 +08:00
|
|
|
# Verify html tags match the baseline
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", level=1)
|
2020-01-31 17:51:39 +08:00
|
|
|
# Verify html tags and attribute names match the baseline
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", level=2)
|
2020-01-31 17:51:39 +08:00
|
|
|
# Verify html tags and attribute values match the baseline
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", level=3)
|
2020-02-09 05:45:23 +08:00
|
|
|
# Click a button that makes a hidden element visible
|
2019-04-01 15:05:24 +08:00
|
|
|
self.click("button")
|
|
|
|
self.check_window(name="helloworld", level=1)
|
|
|
|
self.check_window(name="helloworld", level=2)
|
2021-08-10 06:25:26 +08:00
|
|
|
with self.assert_raises(Exception):
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", level=3)
|
2019-09-02 04:17:38 +08:00
|
|
|
# Now that we know the Exception was raised as expected,
|
2020-01-31 17:51:39 +08:00
|
|
|
# let's print out the comparison results by running a Level-0 check.
|
2019-09-02 04:17:38 +08:00
|
|
|
# (NOTE: Running with level-0 will print but NOT raise an Exception.)
|
2019-04-01 15:05:24 +08:00
|
|
|
self.check_window(name="helloworld", level=0)
|