|
1 | 1 | name: Microsoft Playwright Tests in Azure |
2 | 2 | on: |
3 | 3 | workflow_dispatch: |
4 | | - |
| 4 | + |
| 5 | +permissions: # Required when using Microsoft Entra ID to authenticate |
| 6 | + id-token: write |
| 7 | + contents: read |
| 8 | + |
5 | 9 | 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 | + |
28 | 44 |
|
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 | + |
0 commit comments