Skip to content

Commit 5286d7b

Browse files
Added the HEADLESS env var back
1 parent 7b1db78 commit 5286d7b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/conftest.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
USE_ULTRAFAST_GRID = True
2626
USE_EXECUTION_CLOUD = False
27-
HEADLESS = False
2827

2928

3029
# --------------------------------------------------------------------------------
@@ -41,6 +40,17 @@ def api_key():
4140
return os.getenv('APPLITOOLS_API_KEY')
4241

4342

43+
@pytest.fixture(scope='session')
44+
def headless():
45+
"""
46+
Reads the headless mode setting from an environment variable.
47+
Uses headless mode for Continuous Integration (CI) execution.
48+
Uses headed mode for local development.
49+
"""
50+
h = os.getenv('HEADLESS', default='false')
51+
return h.lower() == 'true'
52+
53+
4454
@pytest.fixture(scope='session')
4555
def runner():
4656
"""
@@ -114,14 +124,14 @@ def configuration(api_key: str, batch_info: BatchInfo):
114124
# --------------------------------------------------------------------------------
115125

116126
@pytest.fixture(scope='function')
117-
def webdriver():
127+
def webdriver(headless: bool):
118128
"""
119129
Creates a WebDriver object for Chrome.
120130
After the test function finishes execution, quits the browser.
121131
"""
122132

123133
options = ChromeOptions()
124-
options.headless = HEADLESS
134+
options.headless = headless
125135

126136
if USE_EXECUTION_CLOUD:
127137
driver = Remote(

0 commit comments

Comments
 (0)