test: fix e2e test case #473
This file contains 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
name: "ui-test" | |
on: | |
workflow_dispatch: | |
inputs: | |
target-testplan-name: | |
description: "For example: APIC240830. Sync test result to this test plan." | |
required: false | |
type: string | |
push: | |
branches: ["dev", "main"] | |
pull_request: | |
branches: ["dev", "main"] | |
jobs: | |
e2e-test: | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: lts/* | |
- name: Setup project | |
run: | | |
npm install | |
npm run package | |
- name: setup account | |
uses: jsdaniell/create-json@v1 | |
with: | |
name: "config.json" | |
json: ${{ secrets.ACCOUNT_CONFIG }} | |
dir: "./src/test/e2e" | |
- run: | | |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npx playwright test | |
working-directory: ./src/test/e2e | |
- if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
test-results | |
test-plan-update: | |
needs: e2e-test | |
if: ${{ always() && github.event.inputs.target-testplan-name != '' }} | |
environment: engineering | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-latest | |
env: | |
AUTO_TEST_PLAN_ID: 26611787 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Setup project | |
run: | | |
npm install | |
- uses: azure/login@v2 | |
with: | |
client-id: ${{secrets.DEVOPS_CLIENT_ID}} | |
tenant-id: ${{secrets.DEVOPS_TENANT_ID}} | |
subscription-id: ${{secrets.DEVOPS_SUB_ID}} | |
enable-AzPSSession: true | |
- name: Archive Test Plan | |
working-directory: ./src/test/e2e | |
run: | | |
testplanid=`npx ts-node scripts/testPlan.ts obtain vscode ${{ github.event.inputs.target-testplan-name }}` | |
echo "Testplan id is $testplanid" | |
npx ts-node scripts/testPlan.ts archive $testplanid | |
- name: Download TestPlan | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./test-results | |
- name: Sync to Azure DevOps Test Plan | |
working-directory: ./src/test/e2e | |
run: | | |
npx ts-node scripts/testPlan.ts report ./testplan.json ../../../test-results |