Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hosted playwright reports #840

Merged
merged 20 commits into from
Feb 4, 2025
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defaults:
shell: bash

jobs:
tests:
playwright-tests:
permissions:
contents: 'read'
id-token: 'write'
Expand All @@ -31,7 +31,7 @@ jobs:
CSAE_PARALLEL_TESTS_COUNT: ${{ vars.CSAE_PARALLEL_TESTS_COUNT }}
CSAE_WORKERS_COUNT: ${{ vars.CSAE_WORKERS_COUNT }}
TEST_ENV: ${{ github.event.inputs.test_env || 'PROD' }}
CSAE_CI_JOB_IDX: 0
CSAE_CI_JOB_IDX: 1
CSAE_CI_JOB_COUNT: 1
name: Playwirght Test
timeout-minutes: 1440
Expand Down
67 changes: 58 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ defaults:
shell: bash

jobs:
tests:
playwright-tests:
permissions:
contents: 'read'
id-token: 'write'
contents: 'read'
id-token: 'write'
strategy:
fail-fast: false
matrix: ${{ github.event.inputs.notebooks == '' && fromJson('{"idx":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}') || fromJson('{"idx":[0]}') }}
matrix: ${{ github.event.inputs.notebooks == '' && fromJson('{"idx":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}') || fromJson('{"idx":[1]}') }}
env:
CSAE_NOTEBOOKS: ${{ github.event.inputs.notebooks }}
CSAE_ENV_PASSWORD: ${{ secrets.CSAE_ENV_PASSWORD }}
Expand All @@ -43,6 +43,7 @@ jobs:
TEST_ENV: ${{ github.event.inputs.test_env || 'PROD' }}
CSAE_CI_JOB_COUNT: ${{ github.event.inputs.notebooks == '' && '10' || '1' }}
IGNORE_BLACKLIST: ${{ github.event.inputs.ignore_blacklist || 'false' }}
CI_ENV: 'nightly'
name: Job ${{ matrix.idx }}
timeout-minutes: 1440
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,13 +97,61 @@ jobs:
run: npx ts-node pre_create_env.ts
- name: Run Playwright tests
run: |
npx playwright test
npx playwright test --shard=${{matrix.idx}}/10
- name: Delete test environments
if: always()
run: npx ts-node post_delete_env.ts
- uses: actions/upload-artifact@v4
if: always()
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.idx }}
path: .tests/blob-report
retention-days: 1

merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: ${{ !cancelled() }}
permissions:
pages: 'write'
contents: 'read'
id-token: 'write'
needs: [playwright-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
name: playwright-report-job-${{ matrix.idx }}
path: .tests/all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report-attempt-${{ github.run_attempt }}
path: .tests/playwright-report/
retention-days: 30
retention-days: 14

- name: Setup pages
uses: actions/configure-pages@v5
- name: Upload report to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: .tests/playwright-report/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Job summary
run: |
echo "# Deployment result" >> $GITHUB_STEP_SUMMARY
echo "View the [Playwright report](https://teradata.github.io/jupyter-demos/)" >> $GITHUB_STEP_SUMMARY


1 change: 1 addition & 0 deletions .tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
.DS_Store
node_modules/
playwright-report/
blob-report/
files.txt
.env
32 changes: 16 additions & 16 deletions .tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.44.1",
"@types/node": "^20.17.6",
"@playwright/test": "^1.50.1",
"@types/node": "^20.17.16",
"dotenv-cli": "^7.4.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion .tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineConfig({
/* Opt out of parallel tests on CI. Dave-changed from 1 to 3 */
workers: process.env.CSAE_WORKERS_COUNT ? parseInt(process.env.CSAE_WORKERS_COUNT):undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: process.env.CI_ENV === 'nightly'? 'blob' : 'html',
/* 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). */
Expand Down
13 changes: 2 additions & 11 deletions .tests/tests/jupytertest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const CSAE_WORKERS_COUNT = parseInt(process.env.CSAE_WORKERS_COUNT || '1');
const CSAE_PARALLEL_TESTS_COUNT = parseInt(process.env.CSAE_PARALLEL_TESTS_COUNT || '1');
const envPool = new EnvPool(Math.floor(CSAE_WORKERS_COUNT / CSAE_PARALLEL_TESTS_COUNT));

const CSAE_CI_JOB_IDX = parseInt(process.env.CSAE_CI_JOB_IDX || '0');
const CSAE_CI_JOB_COUNT = parseInt(process.env.CSAE_CI_JOB_COUNT || '1');
const CI_BRANCH = process.env.CI_BRANCH || 'main';
const IGNORE_BLACKLIST = process.env.IGNORE_BLACKLIST || 'false';

Expand Down Expand Up @@ -66,20 +64,13 @@ if(process.env.CSAE_NOTEBOOKS){
}
}

const testCount = Math.ceil(files.length / CSAE_CI_JOB_COUNT);

for (let i = 0; i < testCount; i++) {

const idx = i * CSAE_CI_JOB_COUNT + CSAE_CI_JOB_IDX;
if (idx >= files.length) {
break;
}
const name = files[idx];
for (let i = 0; i < files.length ; i++) {
const name = files[i];
if (name === '') {
continue;
}


test(`test ${i}: ${name}`, async ({ page }, testInfo) => {
test.setTimeout(10800000);

Expand Down