Skip to content

Commit 5de848d

Browse files
authored
Set up Browserstack to run the E2E tests on Chrome for Android (#1428)
* Set up browserstack * Set up browserstack in GHA * Tighten timeout
1 parent 06183d7 commit 5de848d

File tree

5 files changed

+3165
-41
lines changed

5 files changed

+3165
-41
lines changed

.github/workflows/test-build.yml

+54
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,60 @@ jobs:
643643
env:
644644
BUILD_DIR: ${{ runner.temp }}/artifacts/browser/package/build
645645

646+
e2e-browser-browserstack:
647+
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
648+
needs: [build-browser]
649+
650+
permissions:
651+
contents: read
652+
653+
runs-on: ubuntu-latest
654+
655+
steps:
656+
- name: 'BrowserStack Env Setup'
657+
uses: browserstack/github-actions/setup-env@master
658+
with:
659+
username: ${{ secrets.BROWSERSTACK_USERNAME }}
660+
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
661+
662+
- name: 'BrowserStack Local Tunnel Setup'
663+
uses: browserstack/github-actions/setup-local@master
664+
with:
665+
local-testing: start
666+
local-identifier: random
667+
668+
- uses: actions/checkout@v4
669+
with:
670+
persist-credentials: false
671+
- uses: actions/setup-node@v4
672+
with:
673+
node-version-file: ${{ env.node-version-file }}
674+
cache: 'yarn'
675+
676+
- name: Set up the e2e-tests environment
677+
run: yarn install --frozen-lockfile
678+
working-directory: packages/browser/e2e-tests
679+
680+
- run: mkdir -p ${{ runner.temp }}/artifacts/browser
681+
- uses: actions/download-artifact@v4
682+
with:
683+
name: stlite-browser
684+
path: ${{ runner.temp }}/artifacts/browser
685+
686+
- run: tar xzvf stlite-browser-v*.tgz
687+
working-directory: ${{ runner.temp }}/artifacts/browser
688+
689+
- name: Run the e2e-tests
690+
run: yarn test:browserstack
691+
working-directory: packages/browser/e2e-tests
692+
env:
693+
BUILD_DIR: ${{ runner.temp }}/artifacts/browser/package/build
694+
695+
- name: 'BrowserStackLocal Stop'
696+
uses: browserstack/github-actions/setup-local@master
697+
with:
698+
local-testing: stop
699+
646700
e2e-desktop:
647701
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
648702
needs: [build-desktop]

packages/browser/e2e-tests/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ dist/
77

88
# Logs
99
*.log
10+
log/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
projectName: Stlite
2+
buildName: "@stlite/browser:e2e-tests"
3+
4+
platforms:
5+
- deviceName: Pixel 9
6+
browserName: chrome
7+
osVersion: 15.0
8+
9+
browserstackLocal: true

packages/browser/e2e-tests/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"test:headed": "playwright test --headed",
88
"test:ui": "playwright test --ui",
99
"install:browsers": "playwright install --with-deps",
10+
"test:browserstack": "browserstack-node-sdk playwright test",
11+
"postinstall": "yarn upgrade browserstack-node-sdk",
1012
"typecheck": "tsc --noEmit"
1113
},
1214
"devDependencies": {
1315
"@playwright/test": "^1.42.1",
16+
"browserstack-node-sdk": "^1.34.46",
1417
"http-server": "^14.1.1",
1518
"typescript": "^5.8.2"
1619
}

0 commit comments

Comments
 (0)