22import com .applitools .eyes .BatchInfo ;
33import com .applitools .eyes .EyesRunner ;
44import com .applitools .eyes .RectangleSize ;
5+ import com .applitools .eyes .TestResultContainer ;
56import com .applitools .eyes .TestResultsSummary ;
67import com .applitools .eyes .selenium .BrowserType ;
78import com .applitools .eyes .selenium .Configuration ;
@@ -50,7 +51,7 @@ public static void main(String [] args) {
5051
5152 // Start Applitools Visual AI Test
5253 eyes .open (driver ,"ACME Bank" , "Selenium Java Basic: Quickstart" , new RectangleSize (1200 , 600 ));
53- driver .get ("https://sandbox.applitools.com/bank?layoutAlgo=true " );
54+ driver .get ("https://sandbox.applitools.com/bank" );
5455
5556 // Full Page - Visual AI Assertion
5657 eyes .check (Target .window ().fully ().withName ("Login page" ));
@@ -62,6 +63,7 @@ public static void main(String [] args) {
6263 // Full Page - Visual AI Assertion
6364 eyes .check (
6465 Target .window ().fully ().withName ("Main page" )
66+
6567 // Uncomment to apply Layout regions and have test pass
6668 /* .layout(
6769 By.cssSelector(".dashboardOverview_accountBalances__3TUPB"),
@@ -79,11 +81,20 @@ public static void main(String [] args) {
7981 } finally {
8082 if (driver != null )
8183 driver .quit ();
84+
8285 if (runner != null ) {
8386 TestResultsSummary allTestResults = runner .getAllTestResults ();
84- System .out .println (allTestResults );
87+ for (TestResultContainer container : allTestResults .getAllResults ()) {
88+ if (container .getTestResults () != null && !container .getTestResults ().isPassed ()) {
89+ System .exit (1 );
90+ }
91+ }
8592 }
86- System .exit (0 );
93+
94+ System .exit (0 ); // All tests passed
95+ }
96+
97+ System .exit (0 ); // Will not be reached if mismatch occurred
8798 }
8899 }
89100}
0 commit comments