Skip to content

Commit 2126ad4

Browse files
author
Gaurav Singh
committed
Chapter 7: Checkpoints: Check region on page for a specific WebElement
Change log: 1. Added a new base method to validate element in conftest.py 2. Added a test to get element for agile testing book and pass it to the base function
1 parent 61887e0 commit 2126ad4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
from automation.tests.conftest import validate_window
1+
from automation.tests.conftest import validate_element
22

33

4-
def test_match_level_layout(driver, eyes):
5-
validate_window(driver, eyes)
4+
def test_book_by_region(driver, eyes):
5+
element = driver.find_element_by_id('pid3')
6+
validate_element(driver, eyes, element)
7+

automation/tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from automation.config.base import APPLITOOLS_API_KEY
77

8-
APP_NAME = 'the-internet'
9-
APP_UNDER_TEST = 'https://the-internet.herokuapp.com/large'
8+
APP_NAME = 'automation_bookstore'
9+
APP_UNDER_TEST = 'file:///Users/gaurav/Self/Dev/automated-visual-testing/website/index.html'
1010

1111

1212
@pytest.fixture(scope='function')
@@ -36,6 +36,12 @@ def validate_window(driver, eyes, tag=None):
3636
close_eyes(eyes)
3737

3838

39+
def validate_element(driver, eyes, element, tag=None):
40+
open_eyes(driver, eyes)
41+
eyes.check_region(element, tag=tag)
42+
close_eyes(eyes)
43+
44+
3945
def open_eyes(driver, eyes):
4046
eyes.open(driver, APP_NAME, test_name=get_test_name())
4147

0 commit comments

Comments
 (0)