File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
name : Playwright Tests
2
2
3
+ env :
4
+ CI : true
5
+
3
6
on :
4
7
push :
5
8
branches :
@@ -16,16 +19,16 @@ jobs:
16
19
- name : Checkout repository
17
20
uses : actions/checkout@v4
18
21
19
- - name : Set up Python (latest)
22
+ - name : Set up Python (latest stable version )
20
23
uses : actions/setup-python@v4
21
24
with :
22
- python-version : ' latest '
25
+ python-version : ' 3.11 '
23
26
24
27
- name : Install dependencies
25
28
run : |
26
29
python -m pip install --upgrade pip
27
30
pip install -r requirements.txt
28
31
playwright install --with-deps
29
32
30
- - name : Run Playwright tests
31
- run : pytest tests
33
+ - name : Run Playwright tests in headless mode
34
+ run : pytest tests --headless
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ setup_and_run_tests:
23
23
paths :
24
24
- .cache/pip # Cache pip dependencies
25
25
- /ms-playwright # Cache Playwright browsers
26
+ variables :
27
+ CI : " true"
26
28
27
29
pages :
28
30
stage : pages
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ def request_context(
37
37
38
38
@pytest .fixture (scope = "session" )
39
39
def browser (playwright ):
40
- browser = playwright .chromium .launch (headless = False )
40
+ headless = os .getenv ("CI" , "false" ).lower () == "true" # Headless only in CI
41
+ browser = playwright .chromium .launch (headless = headless )
41
42
yield browser
42
43
browser .close ()
43
44
You can’t perform that action at this time.
0 commit comments