-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add e2e playwright tests #51929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bramkragten
wants to merge
23
commits into
dev
Choose a base branch
from
e2e-playwright-tests
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add e2e playwright tests #51929
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
908a518
Add e2e playwright tests
bramkragten 2024ce0
Update e2e.yaml
bramkragten 9aa6cd4
fixes
bramkragten a21cf5d
fix browserstack tests
bramkragten d32f5b6
fix
bramkragten 6eadf2f
fix gallery tests
bramkragten 897a339
fix browserstack ios tests
bramkragten 764961b
Update browserstack.capabilities.ts
bramkragten c3358e0
use bs-local.com for browserstack
bramkragten e32dd78
Use browserstack node SDK instead
bramkragten 0ccc582
test(e2e): use serial mode + shared page to fix BrowserStack iPhone c…
bramkragten 99c7a42
test(e2e): reuse pre-existing BrowserStack page; filter infra dynamic…
bramkragten d16aa48
test(e2e): fix WebKit dynamic-import filter and avoid concurrent wait…
bramkragten efe41b1
test(e2e): replace class-wildcard selector with explicit hui-* tag se…
bramkragten 5ca28bd
test(e2e): skip cards/dialog checks when dynamic imports fail over tu…
bramkragten 8b41964
test(e2e): use recursive shadow DOM evaluate poll instead of waitForS…
bramkragten 3fbc114
test(e2e): fix evaluate argument serialization on BrowserStack iOS
bramkragten 92e6f69
test(e2e): use evaluate for card visibility check on iOS where locato…
bramkragten 8905123
test(e2e): replace waitForSelector with evaluate polling in sidebar t…
bramkragten ce5a135
test(e2e): fix waitForShadow helper to use recursive shadow DOM trave…
bramkragten d355d9e
test(e2e): revert to locator.waitFor with BS iOS Internal error catch…
bramkragten 141dce9
test(e2e): skip on both dynamic-import errors and BrowserStack iOS In…
bramkragten d3c6897
test(e2e): handle skip return from waitForLocator in all sidebar wait…
bramkragten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,276 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - dev | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - dev | ||
| - master | ||
|
|
||
| env: | ||
| NODE_OPTIONS: --max_old_space_size=6144 | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # ── Build the demo once and share it across test jobs via artifact ────────── | ||
| build-demo: | ||
| name: Build demo | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Build demo | ||
| run: ./node_modules/.bin/gulp build-demo | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Upload demo build | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: demo-dist | ||
| path: demo/dist/ | ||
| if-no-files-found: error | ||
| retention-days: 3 | ||
|
|
||
| # ── Build the e2e test app and share it via artifact ──────────────────────── | ||
| build-e2e-test-app: | ||
| name: Build e2e test app | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Build e2e test app | ||
| run: ./node_modules/.bin/gulp build-e2e-test-app | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Upload e2e test app build | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: e2e-test-app-dist | ||
| path: test/e2e/app/dist/ | ||
| if-no-files-found: error | ||
| retention-days: 3 | ||
|
|
||
| # ── Build the gallery and share it via artifact ───────────────────────────── | ||
| build-gallery: | ||
| name: Build gallery | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Build gallery | ||
| run: ./node_modules/.bin/gulp build-gallery | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Upload gallery build | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: gallery-dist | ||
| path: gallery/dist/ | ||
| if-no-files-found: error | ||
| retention-days: 3 | ||
|
|
||
| # ── Run Playwright tests locally against Chromium ────────────────────────── | ||
| e2e-local: | ||
| name: E2E (local Chromium) | ||
| needs: [build-demo, build-e2e-test-app, build-gallery] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: npx playwright install chromium --with-deps | ||
|
|
||
| - name: Download demo build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: demo-dist | ||
| path: demo/dist/ | ||
|
|
||
| - name: Download e2e test app build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: e2e-test-app-dist | ||
| path: test/e2e/app/dist/ | ||
|
|
||
| - name: Download gallery build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: gallery-dist | ||
| path: gallery/dist/ | ||
|
|
||
| - name: Run Playwright tests (local) | ||
| run: yarn test:e2e | ||
|
|
||
| - name: Upload blob report | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| if: always() | ||
| with: | ||
| name: blob-report-local | ||
| path: test/e2e/reports/ | ||
| retention-days: 3 | ||
|
|
||
| # ── Run Playwright tests on BrowserStack (real devices + browsers) ───────── | ||
| # The BrowserStack SDK manages the Local tunnel and uploads results to the | ||
| # BrowserStack Automate dashboard automatically — no tunnel action needed. | ||
| e2e-browserstack: | ||
| name: E2E (BrowserStack) | ||
| needs: [build-demo, build-e2e-test-app, build-gallery] | ||
| runs-on: ubuntu-latest | ||
| environment: browserstack | ||
| env: | ||
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Download demo build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: demo-dist | ||
| path: demo/dist/ | ||
|
|
||
| - name: Download e2e test app build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: e2e-test-app-dist | ||
| path: test/e2e/app/dist/ | ||
|
|
||
| - name: Download gallery build | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| with: | ||
| name: gallery-dist | ||
| path: gallery/dist/ | ||
|
|
||
| - name: Run Playwright tests (BrowserStack) | ||
| run: yarn test:e2e:browserstack | ||
|
|
||
| # ── Merge local blob reports and post PR comment ─────────────────────────── | ||
| report: | ||
| name: Report | ||
| needs: [e2e-local, e2e-browserstack] | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Check out files from GitHub | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Download blob report (local) | ||
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | ||
| continue-on-error: true | ||
| with: | ||
| name: blob-report-local | ||
| path: test/e2e/reports/ | ||
|
|
||
| - name: Stage blobs for merge | ||
| run: node test/e2e/collect-blob-reports.mjs | ||
|
|
||
| - name: Merge blob reports | ||
| run: npx playwright merge-reports -c test/e2e/playwright.merge.config.ts test/e2e/reports/blob | ||
|
|
||
| - name: Upload merged HTML report | ||
| id: upload-report | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: playwright-report | ||
| path: test/e2e/reports/combined/ | ||
| retention-days: 14 | ||
|
|
||
| - name: Post report link to PR | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
| with: | ||
| script: | | ||
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
| const body = `## Playwright E2E test report\n\nThe combined HTML report is available as a workflow artifact.\n\n[View workflow run](${runUrl})`; | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body, | ||
| }); | ||
This file contains hidden or 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 hidden or 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,53 @@ | ||
| # BrowserStack Automate configuration for Home Assistant frontend e2e tests. | ||
| # Credentials are read from BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY | ||
| # environment variables set in GitHub Actions (or locally). | ||
| # See: https://www.browserstack.com/docs/automate/playwright/getting-started/nodejs | ||
|
|
||
| userName: ${BROWSERSTACK_USERNAME} | ||
| accessKey: ${BROWSERSTACK_ACCESS_KEY} | ||
|
|
||
| projectName: Home Assistant Frontend | ||
| buildName: e2e tests | ||
| buildIdentifier: "CI #${BUILD_NUMBER}" | ||
|
|
||
| # ── Platforms ──────────────────────────────────────────────────────────────── | ||
| platforms: | ||
| - os: Windows | ||
| osVersion: 11 | ||
| browserName: chrome | ||
| browserVersion: latest | ||
| - os: OS X | ||
| osVersion: Ventura | ||
| browserName: playwright-firefox | ||
| browserVersion: latest | ||
| - deviceName: iPad 6th | ||
| osVersion: 12 | ||
| browserName: playwright-webkit | ||
| - deviceName: iPhone 12 | ||
| osVersion: 14 | ||
| browserName: playwright-webkit | ||
| - deviceName: Samsung Galaxy S23 | ||
| osVersion: 13 | ||
| browserName: chrome | ||
| realMobile: true | ||
|
|
||
| parallelsPerPlatform: 1 | ||
|
|
||
| # ── Local tunnel ───────────────────────────────────────────────────────────── | ||
| # The SDK manages the BrowserStack Local tunnel automatically. | ||
| browserstackLocal: true | ||
|
|
||
| framework: playwright | ||
|
|
||
| # Pin to the latest Playwright version BrowserStack supports. Our local | ||
| # @playwright/test is newer (1.59.x) which BrowserStack does not yet support, | ||
| # causing a "Malformed endpoint" connection error if left unset. | ||
| # Update this when BrowserStack adds support for a newer version. | ||
| # Supported versions: https://www.browserstack.com/docs/automate/playwright/browsers-and-os | ||
| playwrightVersion: 1.latest | ||
|
|
||
| # ── Debugging ──────────────────────────────────────────────────────────────── | ||
| debug: false | ||
| networkLogs: false | ||
| consoleLogs: errors | ||
| testObservability: true |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weren't we going to run this only on demand?