diff --git a/.github/workflows/podcast-web.yml b/.github/workflows/podcast-web.yml index 44c595d..e10f267 100644 --- a/.github/workflows/podcast-web.yml +++ b/.github/workflows/podcast-web.yml @@ -125,6 +125,9 @@ jobs: needs: deploy timeout-minutes: 60 runs-on: ubuntu-latest + container: mcr.microsoft.com/playwright:v1.25.2-focal + env: + BASEURL: https://${{secrets.WEBAPP_NAME}}.azurewebsites.net defaults: run: working-directory: src/Web/E2E @@ -133,13 +136,21 @@ jobs: - uses: actions/setup-node@v2 with: node-version: '14.x' + - name: Install dependencies run: npm ci - - name: Install Playwright Browsers - run: npx playwright install --with-deps + - name: Run Playwright tests run: npx playwright test - - uses: actions/upload-artifact@v2 + + - name: Create test summary + uses: test-summary/action@dist + if: always() + with: + paths: test-results/junit.xml + + - name: Upload HTML report + uses: actions/upload-artifact@v2 if: always() with: name: playwright-report diff --git a/README.md b/README.md index a3bc998..1c15201 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ products: - azure-container-apps - azure-container-registry - azure-app-service-web +- playwright --- # .NET Podcasts - Sample Application diff --git a/src/Web/E2E/playwright.config.ts b/src/Web/E2E/playwright.config.ts index 913388a..0bec777 100644 --- a/src/Web/E2E/playwright.config.ts +++ b/src/Web/E2E/playwright.config.ts @@ -30,13 +30,16 @@ const config: PlaywrightTestConfig = { /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: process.env.CI ? [['github'], ['html']] : 'list', + reporter: [ + ['html'], + ['junit', { outputFile: './test-results/junit.xml' }], + ], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: 'https://mafellin-podcastwebapp.azurewebsites.net/', + baseURL: process.env.BASEURL, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on',