Add playwright example #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: playwright | |
on: | |
push: | |
branches: [master] | |
paths: | |
- "playwright/**" | |
pull_request: | |
paths: | |
- "playwright/**" | |
env: | |
LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN_PLAYWRIGHT }} | |
LAUNCHABLE_DEBUG: 1 | |
LAUNCHABLE_REPORT_ERROR: 1 | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: playwright | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
browser: [chromium, firefox, webkit] | |
steps: | |
- uses: actions/checkout@v4 | |
# for setup launchable command | |
- uses: actions/setup-python@v5 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 8 | |
distribution: 'temurin' | |
- name: Install launchable CLI | |
run: | | |
pip install git+https://github.com/launchableinc/cli.git@playwright | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Set up playwright | |
run: | | |
npm ci | |
npx playwright install --with-deps | |
- name: Record commits and build | |
run: 'launchable record build --name "$GITHUB_RUN_ID" --source ..' # care for working-directory path | |
- name: Subset | |
# playwright junit reporter doesn't include testDir path of the config file. So in this case, trim testDir path ourselves. | |
run: find ./tests/*.ts | sed -e 's/.\/tests\///' | launchable subset --confidence 80% --flavor browser=${{ matrix.browser }} playwright > launchable-subset.txt | |
- name: Run Playwright tests | |
run: npx playwright test --project=${{ matrix.browser }} ./tests/$(cat launchable-subset.txt) --reporter=junit > report.xml | |
- name: Record | |
run: launchable record tests playwright report.xml | |
if: always() |