Skip to content

Commit e9b4a67

Browse files
committed
modified ms playwright config to add ms entra id as authentication
1 parent 74ab1d4 commit e9b4a67

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

.github/workflows/msplaywright.yml

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
11
name: Microsoft Playwright Tests in Azure
22
on:
33
workflow_dispatch:
4-
4+
5+
permissions: # Required when using Microsoft Entra ID to authenticate
6+
id-token: write
7+
contents: read
8+
59
jobs:
6-
test:
7-
timeout-minutes: 60
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions/setup-node@v3
12-
with:
13-
node-version: lts/*
14-
- name: Install dependencies
15-
working-directory: . # update accordingly
16-
run: |
17-
npm ci
18-
npm install --save dotenv
19-
20-
- name: Run Playwright tests
21-
working-directory: . # update accordingly
22-
env:
23-
# Access token and regional endpoint for Microsoft Playwright Testing
24-
PLAYWRIGHT_SERVICE_ACCESS_TOKEN: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_TOKEN }}
25-
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
26-
PLAYWRIGHT_SERVICE_RUN_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.sha }}
27-
run: npx playwright test -c playwright.service.config.ts --workers=20
10+
test:
11+
timeout-minutes: 60
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Login to Azure with AzPowershell (enableAzPSSession true)
17+
uses: azure/login@v2
18+
with:
19+
client-id: ${{ secrets.AZURE_CLIENT_ID }} # GitHub Open ID connect values copied in previous steps
20+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
21+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
22+
enable-AzPSSession: true
23+
24+
- name: Install dependencies
25+
working-directory: path/to/playwright/folder # update accordingly
26+
run: npm ci
27+
28+
- name: Run Playwright tests
29+
working-directory: path/to/playwright/folder # update accordingly
30+
env:
31+
# Regional endpoint for Microsoft Playwright Testing
32+
PLAYWRIGHT_SERVICE_URL: ${{ secrets.PLAYWRIGHT_SERVICE_URL }}
33+
# PLAYWRIGHT_SERVICE_ACCESS_TOKEN: ${{ secrets.PLAYWRIGHT_SERVICE_ACCESS_TOKEN }} # Not recommended, use Microsoft Entra ID authentication.
34+
run: npx playwright test -c playwright.service.config.ts --workers=20
35+
36+
- name: Upload Playwright report
37+
uses: actions/upload-artifact@v3
38+
if: always()
39+
with:
40+
name: playwright-report
41+
path: playwright-report # update accordingly
42+
retention-days: 10
43+
2844

29-
- name: Upload Playwright report
30-
uses: actions/upload-artifact@v3
31-
if: always()
32-
with:
33-
name: playwright-report
34-
path: playwright-report # update accordingly
35-
retention-days: 10
45+

playwright.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export default defineConfig({
5050

5151
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
5252
trace: 'on-first-retry',
53+
video:'retain-on-failure',
54+
screenshot:'on'
5355
},
5456

5557
/* Configure projects for major browsers */

0 commit comments

Comments
 (0)