Skip to content

Commit 3463b97

Browse files
committed
Leverage merge_queue
1 parent da5ed4d commit 3463b97

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Custom merge queue browsers'
2+
description: 'Trim down pytest browsers to just chrome for merge_group events.'
3+
outputs:
4+
browsers:
5+
description: 'pytest browsers to use'
6+
value: ${{ steps.browsers.outputs.browser }}
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Determine browsers to use
11+
shell: bash
12+
id: browsers
13+
run: |
14+
if [ "${{ github.event_name }}" == "merge_group" ]; then
15+
echo "Using chrome browser only!"
16+
echo 'browsers=PYTEST_BROWSER="--browser chromium"' >> "$GITHUB_OUTPUT"
17+
else
18+
echo "No custom pytest browsers"
19+
fi

.github/workflows/pytest.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ jobs:
6565
with:
6666
python-version: ${{ matrix.python-version }}
6767

68+
- uses: ./.github/py-shiny/pytest-browers
69+
id: browsers
6870
- name: Run End-to-End tests
6971
timeout-minutes: 20
7072
run: |
71-
make playwright-shiny SUB_FILE=". -vv"
73+
make playwright-shiny SUB_FILE=". -vv" ${{ steps.browsers.outputs.browsers }}
7274
- uses: actions/upload-artifact@v4
7375
if: failure()
7476
with:
@@ -103,10 +105,12 @@ jobs:
103105
run: |
104106
npm ci
105107
108+
- uses: ./.github/py-shiny/pytest-browers
109+
id: browsers
106110
- name: Run example app tests
107111
timeout-minutes: 20
108112
run: |
109-
make playwright-examples SUB_FILE=". -vv"
113+
make playwright-examples SUB_FILE=". -vv" ${{ steps.browsers.outputs.browsers }}
110114
- uses: actions/upload-artifact@v4
111115
if: failure()
112116
with:

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ clean-js: FORCE
147147

148148
# Default `SUB_FILE` to empty
149149
SUB_FILE:=
150-
150+
PYTEST_BROWSERS:= --browser webkit --browser firefox --browser chromium
151151
install-playwright: FORCE
152152
playwright install --with-deps
153153

@@ -160,15 +160,15 @@ install-rsconnect: FORCE
160160

161161
# end-to-end tests with playwright; (SUB_FILE="" within tests/playwright/shiny/)
162162
playwright-shiny: install-playwright
163-
pytest tests/playwright/shiny/$(SUB_FILE)
163+
pytest tests/playwright/shiny/$(SUB_FILE) $(PYTEST_BROWSERS)
164164

165165
# end-to-end tests on deployed apps with playwright; (SUB_FILE="" within tests/playwright/deploys/)
166166
playwright-deploys: install-playwright install-rsconnect
167-
pytest tests/playwright/deploys/$(SUB_FILE)
167+
pytest tests/playwright/deploys/$(SUB_FILE) $(PYTEST_BROWSERS)
168168

169169
# end-to-end tests on all py-shiny examples with playwright; (SUB_FILE="" within tests/playwright/examples/)
170170
playwright-examples: install-playwright
171-
pytest tests/playwright/examples/$(SUB_FILE)
171+
pytest tests/playwright/examples/$(SUB_FILE) $(PYTEST_BROWSERS)
172172

173173
playwright-debug: install-playwright ## All end-to-end tests, chrome only, headed; (SUB_FILE="" within tests/playwright/)
174174
pytest -c tests/playwright/playwright-pytest.ini tests/playwright/$(SUB_FILE)
@@ -178,10 +178,10 @@ playwright-show-trace: ## Show trace of failed tests
178178

179179
# end-to-end tests with playwright and generate junit report
180180
testrail-junit: install-playwright install-trcli
181-
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml
181+
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml $(PYTEST_BROWSERS)
182182

183183
coverage: FORCE ## check combined code coverage (must run e2e last)
184-
pytest --cov-report term-missing --cov=shiny tests/pytest/ tests/playwright/shiny/$(SUB_FILE)
184+
pytest --cov-report term-missing --cov=shiny tests/pytest/ tests/playwright/shiny/$(SUB_FILE) $(PYTEST_BROWSERS)
185185
coverage html
186186
$(BROWSER) htmlcov/index.html
187187

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[pytest]
22
asyncio_mode=strict
33
testpaths=tests/pytest/
4-
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto --tracing=retain-on-failure --video=retain-on-failure
4+
; Note: Browsers are set within `./Makefile`
5+
addopts = --strict-markers --durations=6 --durations-min=5.0 --numprocesses auto --tracing=retain-on-failure --video=retain-on-failure

0 commit comments

Comments
 (0)