My Playwright test is running fine in debug and normal mode when I ran on local, but when I've tried the same through GitHub Actions it's hung to launch the application. My login involves Microsoft Authenticator and then it opens the application page and that works fine on local. It's not delay issue I tried with long delay there still it has not worked. I checked trace and that shows login is successful and after that it's in a blank processing window and never launched the landing page. Can anyone help me to figure out the issue? My workflow is:
name: Playwright Tests
on:
push:
branches: [ <MyBranch> ]
pull_request:
branches: [ <MyBranch> ]
workflow_dispatch: # Enable manual trigger
jobs:
test:
timeout-minutes: 30 # Timeout for the entire job
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
shard: [1/4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install
- name: Run Playwright Test on Microsoft Edge (Headless)
run: npx playwright test LoginTest.spec.js --shard ${{ matrix.shard }}
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
retention-days: 1
My Playwright test is running fine in debug and normal mode when I ran on local, but when I've tried the same through GitHub Actions it's hung to launch the application. My login involves Microsoft Authenticator and then it opens the application page and that works fine on local. It's not delay issue I tried with long delay there still it has not worked. I checked trace and that shows login is successful and after that it's in a blank processing window and never launched the landing page. Can anyone help me to figure out the issue? My workflow is:
name: Playwright Tests
on:
push:
branches: [ <MyBranch> ]
pull_request:
branches: [ <MyBranch> ]
workflow_dispatch: # Enable manual trigger
jobs:
test:
timeout-minutes: 30 # Timeout for the entire job
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
shard: [1/4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install
- name: Run Playwright Test on Microsoft Edge (Headless)
run: npx playwright test LoginTest.spec.js --shard ${{ matrix.shard }}
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report
retention-days: 1
Share
Improve this question
edited Mar 4 at 11:05
jonrsharpe
122k30 gold badges268 silver badges476 bronze badges
asked Mar 4 at 11:02
Prosenjit MukherjeeProsenjit Mukherjee
91 bronze badge
1 Answer
Reset to default 0My login involves Microsoft Authenticator and then it opens the application page and that works fine on local.
If you run it in GitHub Actions workflow, it runs on a different machine, which has no:
- display server (like X)
- web browser
What you could do though:
- Make the login token based, preferably short-lived
- Output the login link so you can access the website from your own workstation (making automation with GHA somewhat pointless) in order to login
- Install necessary dependencies in some kind of docker image
Also, from a quick check on playwright GitHub Actions documentation you should try adding --with-deps
flag:
...
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
...
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745048447a4608238.html
评论列表(0条)