@@ -30,10 +30,10 @@ public class AcmeBankTests {
3030 // These could be set by environment variables or other input mechanisms.
3131 // They are hard-coded here to keep the example project simple.
3232 private final static boolean USE_ULTRAFAST_GRID = true ;
33- private final static boolean HEADLESS = false ;
3433
3534 // Test control inputs to read once and share for all tests
3635 private static String applitoolsApiKey ;
36+ private static boolean headless ;
3737
3838 // Applitools objects to share for all tests
3939 private static BatchInfo batch ;
@@ -56,6 +56,11 @@ public static void setUpConfigAndRunner() {
5656 // Read the Applitools API key from an environment variable.
5757 applitoolsApiKey = System .getenv ("APPLITOOLS_API_KEY" );
5858
59+ // Read the headless mode setting from an environment variable.
60+ // Use headless mode for Continuous Integration (CI) execution.
61+ // Use headed mode for local development.
62+ headless = Boolean .parseBoolean (System .getenv ().getOrDefault ("HEADLESS" , "true" ));
63+
5964 if (USE_ULTRAFAST_GRID ) {
6065 // Create the runner for the Ultrafast Grid.
6166 // Concurrency refers to the number of visual checkpoints Applitools will perform in parallel.
@@ -101,7 +106,7 @@ public static void setUpConfigAndRunner() {
101106
102107 // Start Playwright and launch the browser.
103108 playwright = Playwright .create ();
104- browser = playwright .chromium ().launch (new com .microsoft .playwright .BrowserType .LaunchOptions ().setHeadless (HEADLESS ));
109+ browser = playwright .chromium ().launch (new com .microsoft .playwright .BrowserType .LaunchOptions ().setHeadless (headless ));
105110 }
106111
107112 @ BeforeEach
0 commit comments