File tree Expand file tree Collapse file tree 5 files changed +45
-8
lines changed Expand file tree Collapse file tree 5 files changed +45
-8
lines changed Original file line number Diff line number Diff line change 11# ###############
22# MY APP #
33# ###############
4- site.url =https://the-internet.herokuapp.com/large
4+ site.bookstore.url =file:///Users/angie/workspace/test_automation_u/visual_validation_course/website/index.html
5+ site.largedom.url =https://the-internet.herokuapp.com/large
6+ site.dynamic.url =https://the-internet.herokuapp.com/dynamic_content
57
68# ###############
79# SELENIUM #
Original file line number Diff line number Diff line change 11import base .BaseTests ;
2+ import com .applitools .eyes .MatchLevel ;
23import org .junit .Test ;
34
45public class DynamicTests extends BaseTests {
56
7+ private String APP_NAME = "The Internet" ;
8+
69 @ Test
710 public void testDynamicContent (){
8- validateWindow ();
11+ driver .get (System .getProperty ("site.dynamic.url" ));
12+ eyes .setMatchLevel (MatchLevel .LAYOUT );
13+ validateWindow (APP_NAME );
914 }
1015}
Original file line number Diff line number Diff line change 33
44public class ScrollTests extends BaseTests {
55
6+ private String APP_NAME = "The Internet" ;
7+
68 @ Test
79 public void testLargeDom () {
8- validateWindow ();
10+ driver .get (System .getProperty ("site.largedom.url" ));
11+ validateWindow (APP_NAME );
912 }
1013}
Original file line number Diff line number Diff line change 11import base .BaseTests ;
2+ import org .junit .Assert ;
3+ import org .junit .BeforeClass ;
24import org .junit .Test ;
5+ import org .openqa .selenium .By ;
6+ import pages .SearchPage ;
37
48public class SearchTests extends BaseTests {
59
10+ private String APP_NAME = "Automation Bookstore" ;
11+ private SearchPage page = new SearchPage (driver );
12+
13+ @ BeforeClass
14+ public static void launchApp (){
15+ driver .get (System .getProperty ("site.bookstore.url" ));
16+ }
17+
618 @ Test
719 public void testSearchByFullTitle (){
820 String title = "Agile Testing" ;
921 page .search (title );
10- validateWindow ();
22+ validateWindow (APP_NAME );
23+ }
24+
25+ @ Test
26+ public void testSearchByFullTitle_Element (){
27+ String title = "Agile Testing" ;
28+ page .search (title );
29+ validateElement (By .id ("pid3" ));
30+ Assert .assertEquals ("Number of books returned" ,
31+ 1 , page .getNumberOfVisibleBooks ());
1132 }
1233}
Original file line number Diff line number Diff line change 33import com .applitools .eyes .selenium .Eyes ;
44import org .junit .AfterClass ;
55import org .junit .BeforeClass ;
6+ import org .openqa .selenium .By ;
67import org .openqa .selenium .WebDriver ;
78import org .openqa .selenium .chrome .ChromeDriver ;
89
@@ -28,8 +29,6 @@ public static void setUp() {
2829
2930 driver = new ChromeDriver ();
3031 initiateEyes ();
31-
32- driver .get (System .getProperty ("site.url" ));
3332 }
3433
3534 @ AfterClass
@@ -43,10 +42,17 @@ private static void initiateEyes(){
4342 eyes .setApiKey (System .getProperty ("applitools.api.key" ));
4443 }
4544
46- public void validateWindow (){
47- eyes .open (driver , "The Internet" , Thread .currentThread ().getStackTrace ()[2 ].getMethodName ());
45+ public void validateWindow (String appName ){
46+ eyes .open (driver , appName , Thread .currentThread ().getStackTrace ()[2 ].getMethodName ());
4847 eyes .setForceFullPageScreenshot (true );
4948 eyes .checkWindow ();
5049 eyes .close ();
5150 }
51+
52+ public void validateElement (By locator ){
53+ eyes .open (driver , "Automation Bookstore" , Thread .currentThread ().getStackTrace ()[2 ].getMethodName ());
54+ eyes .checkElement (locator );
55+ eyes .close ();
56+ }
57+
5258}
You can’t perform that action at this time.
0 commit comments