1+ import org .junit .After ;
12import org .junit .Assert ;
23import org .junit .Ignore ;
34import org .junit .Test ;
1112@ Ignore
1213public class ResponsiveValidatorTest {
1314
15+ private static WebDriver driver ;
16+
1417 @ Test
1518 public void testThatResponsiveValidatorWorks () {
1619 System .setProperty ("IS_LOCAL" , "TRUE" );
1720 System .setProperty ("BROWSER" , "Firefox" );
1821
1922 WebDriverFactory driverFactory = new WebDriverFactory ();
20- WebDriver driver = driverFactory .getDriver ();
23+ driver = driverFactory .getDriver ();
2124 driver .manage ().window ().maximize ();
2225
2326 driver .get ("https://www.facey.top" );
@@ -26,47 +29,53 @@ public void testThatResponsiveValidatorWorks() {
2629
2730 ResponsiveUIValidator responsiveValidator = new ResponsiveUIValidator (driver );
2831
29- boolean res1 = responsiveValidator .init ()
32+ boolean res1 = responsiveValidator .init ("Grid validation" )
3033 .findElements (page .images ())
31- .alignedAsGrid (1 , 4 )
34+ .alignedAsGrid (1 , 3 )
3235 .areNotOverlappedWithEachOther ()
3336 .withSameSize ()
3437 .drawMap ()
3538 .validate ();
3639
37- // responsiveValidator.init()
38- // .findElement(page.newPhotos(), "New Photos")
39- // .changeMetricsUnitsTo(PERCENT)
40- // .widthBetween(30, 40)
41- // .heightBetween(5, 8)
42- // .changeMetricsUnitsTo(PX)
43- // .minOffset(2, 30, 50, 30)
44- // .maxOffset(5, 40, 70, 40)
45- // .notOverlapWith(page.header(), "Header")
46- // .notOverlapWith(page.myPhotos(), "My Photos")
47- // .notOverlapWith(page.topPhotos(), "Top Photos")
48- // .sameOffsetRightAs(page.logo(), "Logo")
49- // .withTopElement(page.header())
50- // .drawMap()
51- // .validate();
52- //
53- // responsiveValidator.init()
54- // .findElement(page.newPhotos(), "New Photos")
55- // .widthBetween(300, 400)
56- // .heightBetween(20, 50)
57- // .minOffset(10, 500, 500, 600)
58- // .maxOffset(200, 2000, 2000, 1000)
59- // .notOverlapWith(page.header(), "Header")
60- // .notOverlapWith(page.myPhotos(), "My Photos")
61- // .notOverlapWith(page.topPhotos(), "Top Photos")
62- // .sameOffsetRightAs(page.logo(), "Logo")
63- // .drawMap()
64- // .validate();
40+ responsiveValidator .init ()
41+ .findElement (page .newPhotos (), "New Photos" )
42+ .changeMetricsUnitsTo (PERCENT )
43+ .widthBetween (30 , 40 )
44+ .heightBetween (5 , 8 )
45+ .changeMetricsUnitsTo (PX )
46+ .minOffset (2 , 30 , 50 , 30 )
47+ .maxOffset (5 , 40 , 70 , 40 )
48+ .notOverlapWith (page .header (), "Header" )
49+ .notOverlapWith (page .myPhotos (), "My Photos" )
50+ .notOverlapWith (page .topPhotos (), "Top Photos" )
51+ .sameOffsetRightAs (page .logo (), "Logo" )
52+ .withTopElement (page .header ())
53+ .drawMap ()
54+ .validate ();
6555
66- responsiveValidator .generateReport ("Base_Page" );
56+ responsiveValidator .init ()
57+ .findElement (page .newPhotos (), "New Photos" )
58+ .widthBetween (300 , 400 )
59+ .heightBetween (20 , 50 )
60+ .minOffset (10 , 500 , 500 , 600 )
61+ .maxOffset (200 , 2000 , 2000 , 1000 )
62+ .notOverlapWith (page .header (), "Header" )
63+ .notOverlapWith (page .myPhotos (), "My Photos" )
64+ .notOverlapWith (page .topPhotos (), "Top Photos" )
65+ .sameOffsetRightAs (page .logo (), "Logo" )
66+ .drawMap ()
67+ .validate ();
6768
68- driver . quit ( );
69+ responsiveValidator . generateReport ( "Base_Page" );
6970
7071 Assert .assertTrue ("Validation is failed" , res1 );
7172 }
73+
74+ @ After
75+ public void tearDown (){
76+ if (driver != null ){
77+ driver .quit ();
78+ }
79+ }
80+
7281}
0 commit comments