Skip to content

Playwright: Use new GH Pages actions #787

Playwright: Use new GH Pages actions

Playwright: Use new GH Pages actions #787

Workflow file for this run

name: E2E tests
on:
pull_request:
paths:
- 'packages/plugin-e2e/**'
- '.github/workflows/playwright.yml'
permissions:
contents: write
id-token: write
pull-requests: write
jobs:
resolve-versions:
name: Resolve Grafana images
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
matrix: ${{ steps.resolve-versions.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve Grafana E2E versions
id: resolve-versions
uses: grafana/plugin-actions/e2e-version@main
with:
version-resolver-type: plugin-grafana-dependency
grafana-dependency: '>=8.5.0'
# limit: 0 # Uncomment to test all versions since 8.5.0. Useful when testing compatibility for new APIs.
playwright-tests:
needs: resolve-versions
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}}
name: ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build --w @grafana/plugin-e2e
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Get secrets for DockerHub login
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
common_secrets: |
DOCKERHUB_USERNAME=dockerhub:username
DOCKERHUB_PASSWORD=dockerhub:password
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_PASSWORD }}
- name: Start Grafana
run: |
cd packages/plugin-e2e
docker compose pull
ANONYMOUS_AUTH_ENABLED=false GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} docker compose up -d
- name: Wait for grafana server
uses: grafana/plugin-actions/wait-for-grafana@main
with:
url: http://localhost:3000/login
- name: Run Playwright tests
id: run-tests
run: npm run playwright:test --w @grafana/plugin-e2e
- name: Upload e2e test summary
## todo: change to main branch once the pr is merged
uses: grafana/plugin-actions/playwright-gh-pages/upload-report-artifacts@main
if: ${{ (always() && !cancelled()) }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-outcome: ${{ steps.run-tests.outcome }}
report-dir: packages/plugin-e2e/playwright-report
publish-report:
if: ${{ (always() && !cancelled()) }}
needs: [playwright-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish report
## todo: change to main branch once the pr is merged
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}