-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace integration-tests karma with playwright (#887)
- Loading branch information
Showing
172 changed files
with
6,323 additions
and
4,880 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: 'Install playwright' | ||
description: 'Install Playwright browser binaries and OS dependencies' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Get installed Playwright version | ||
id: playwright-version | ||
shell: bash | ||
working-directory: ./packages/integration-tests | ||
run: | | ||
PLAYWRIGHT_VERSION=$(npm ls --json "@playwright/test" | jq --raw-output '.dependencies["@playwright/test"].version') | ||
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | ||
- name: Set up path for Playwright cache | ||
shell: bash | ||
run: echo "PLAYWRIGHT_CACHE_PATH=$(if [[ $RUNNER_OS == 'macOS' ]]; then echo '~/Library/Caches/ms-playwright'; else echo '~/.cache/ms-playwright'; fi)" >> $GITHUB_ENV | ||
|
||
- name: Cache Playwright binaries | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 | ||
id: playwright-cache | ||
with: | ||
path: ${{ env.PLAYWRIGHT_CACHE_PATH }} | ||
key: '${{ runner.os }}-playwright-cache-${{ env.PLAYWRIGHT_VERSION }}-splunk-otel-js-web-artifacts' | ||
|
||
- name: Install Playwright browser binaries | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
npx playwright install --with-deps | ||
npx playwright install chrome | ||
npx playwright install msedge | ||
npx playwright install webkit | ||
- name: Install Playwright OS dependencies | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: npx playwright install-deps |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Playwright tests | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
playwright: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
browser: [chromium, firefox, chrome, edge] | ||
name: Playwright Tests - ${{ matrix.browser }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.2.1 | ||
- uses: actions/setup-node@v4.0.3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run compile | ||
|
||
- name: Install playwright | ||
uses: ./.github/actions/install-playwright | ||
|
||
- name: Run Playwright tests | ||
run: | | ||
npx playwright test --project=${{ matrix.browser }} | ||
working-directory: ./packages/integration-tests | ||
|
||
- name: Upload blob report to GitHub Actions Artifacts | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a | ||
with: | ||
name: blob-report-${{ matrix.browser }}-attempt-${{ github.run_attempt }} | ||
path: packages/integration-tests/blob-report | ||
retention-days: 1 | ||
|
||
playwright-macos: | ||
timeout-minutes: 60 | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
browser: [webkit] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.2.1 | ||
- uses: actions/setup-node@v4.0.3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run compile | ||
|
||
- name: Install playwright | ||
uses: ./.github/actions/install-playwright | ||
|
||
- name: Run Playwright tests | ||
run: | | ||
npx playwright test --project=${{ matrix.browser }} | ||
working-directory: ./packages/integration-tests | ||
|
||
- name: Upload blob report to GitHub Actions Artifacts | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a | ||
with: | ||
name: blob-report-${{ matrix.browser }}-attempt-${{ github.run_attempt }} | ||
path: packages/integration-tests/blob-report | ||
retention-days: 1 | ||
|
||
merge-reports: | ||
if: ${{ !cancelled() }} | ||
needs: [playwright, playwright-macos] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.2.1 | ||
- uses: actions/setup-node@v4.0.3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run compile | ||
|
||
- name: Download blob reports from GitHub Actions Artifacts | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 | ||
with: | ||
path: packages/integration-tests/all-blob-reports | ||
pattern: blob-report-* | ||
merge-multiple: true | ||
|
||
- name: Merge into HTML Report | ||
run: npx playwright merge-reports --reporter html ./all-blob-reports -c playwright.config.ts | ||
working-directory: ./packages/integration-tests | ||
|
||
- name: Upload HTML report | ||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a | ||
with: | ||
name: playwright-report--attempt-${{ github.run_attempt }} | ||
path: packages/integration-tests/playwright-report | ||
retention-days: 14 | ||
|
||
check-failure: | ||
needs: [playwright, playwright-macos, merge-reports] | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
steps: | ||
- name: Check if any playwright tests failed | ||
run: | | ||
if [ "${{ needs.playwright.result }}" != "success" ] || [ "${{ needs['playwright-macos'].result }}" != "success" ]; then | ||
echo "One or more tests failed." | ||
exit 1 | ||
else | ||
echo "All tests passed." | ||
fi |
Oops, something went wrong.