Skip to content

Commit 9932510

Browse files
committed
Add dotenv support for headless mode configuration and update .gitignore
1 parent 9b3eb79 commit 9932510

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HEADLESS=false

.env.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HEADLESS=false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*.iml
99
.DS_Store
1010

11+
.env
1112
/htmlReport/
1213

1314
# The following files are generated/updated by vaadin-maven-plugin

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@
107107
<scope>test</scope>
108108
</dependency>
109109

110+
<dependency>
111+
<groupId>io.github.cdimascio</groupId>
112+
<artifactId>dotenv-java</artifactId>
113+
<version>3.0.0</version>
114+
</dependency>
115+
110116
<dependency>
111117
<groupId>com.microsoft.playwright</groupId>
112118
<artifactId>playwright</artifactId>

src/test/java/org/javadominicano/PlaywrightIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.javadominicano;
22

33
import com.microsoft.playwright.*;
4+
import io.github.cdimascio.dotenv.Dotenv;
45
import org.junit.jupiter.api.AfterAll;
56
import org.junit.jupiter.api.AfterEach;
67
import org.junit.jupiter.api.BeforeAll;
@@ -22,8 +23,10 @@ public static void beforeAll() {
2223
playwright = Playwright.create();
2324
BrowserType browserType = playwright.chromium();
2425

26+
Dotenv dotenv = Dotenv.load();
27+
2528
boolean headless = Boolean.parseBoolean(
26-
System.getenv().getOrDefault("HEADLESS", "true")
29+
dotenv.get("HEADLESS", "true")
2730
);
2831

2932
BrowserType.LaunchOptions launchOptions = new BrowserType.LaunchOptions()

0 commit comments

Comments
 (0)