Skip to content

[Charts V9] Storybook Test coverage #8

[Charts V9] Storybook Test coverage

[Charts V9] Storybook Test coverage #8

name: "[Charts V9] Storybook Test coverage"
on:
schedule:
- cron: "30 1 * * *" # Runs every day at 07:00 AM IST (01:30 AM UTC)
workflow_dispatch:
inputs:
repo:
description: "Repo to run the tests on"
required: true
default: "microsoft/fluentui"
branch:
description: "Branch to run the tests on"
required: true
default: "master"
permissions:
contents: write
pages: write
id-token: write
jobs:
run_tests:
strategy:
matrix:
os: [windows-latest]
runs-on: ${{ matrix.os }}
outputs:
test_coverage: ${{ steps.run_tests.outputs }}
windows_artifact_name: ${{ steps.windows.outputs.COVERAGE_FILENAME_WINDOWS }}
steps:
- name: Enable Git long paths
run: git config --global core.longpaths true
- name: Checkout [react-charting]
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.repo || 'microsoft/fluentui'}}
ref: ${{ github.event.inputs.branch || 'master'}}
path: repo1
- name: Display Input Repo and Branch in Summary
shell: pwsh
run: |
echo "### Workflow Inputs" >> $env:GITHUB_STEP_SUMMARY
echo "- **Repository**: ${{ github.event.inputs.repo }}" >> $env:GITHUB_STEP_SUMMARY
echo "- **Branch**: ${{ github.event.inputs.branch }}" >> $env:GITHUB_STEP_SUMMARY
- name: Show current directory
run: echo "$PWD" && ls
- name: Show repo1 repository
run: ls ./repo1
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install packages
run: |
cd ./repo1
yarn
- name: Checkout [main] of current repo
uses: actions/checkout@v4
with:
path: contrib_repo
- name: Install packages
run: |
cd contrib_repo/apps/plotly_examples
yarn
- name: Run Playwright test script (with webServer)
run: |
cd contrib_repo/apps/plotly_examples
npx playwright install
npx playwright test tests/FluentUIv9ChartsSnapshotTests.spec.ts --config playwright-storybook-v9.config.ts || true
continue-on-error: true
- name: Zip Playwright report
shell: pwsh
run: |
cd contrib_repo/apps/plotly_examples
Compress-Archive -Path playwright-report -DestinationPath playwright-report.zip
- name: Compute number of total tests and failures
uses: ./contrib_repo/.github/actions/playwright_metrics
with:
current_report: contrib_repo/apps/plotly_examples/playwright-report.json
baseline_report: contrib_repo/apps/plotly_examples/reports/playwright-report-v9Storybook.json
- name: Upload Playwright HTML report as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-html-report
path: contrib_repo/apps/plotly_examples/playwright-report/
- name: Upload Playwright JSON report as artifact
uses: actions/upload-artifact@v4
with:
name: playwright-json-report
path: contrib_repo/apps/plotly_examples/playwright-report.json
- name: Move Playwright JSON report to reports folder for scheduled runs
if: github.event_name == 'schedule'
shell: bash
run: |
cd contrib_repo/apps/plotly_examples
mv playwright-report.json reports/playwright-report-v9Storybook.json
git add reports/playwright-report-v9Storybook.json
- name: Create branch name for scheduled report
if: github.event_name == 'schedule'
id: branch
shell: bash
run: |
BRANCH="playwright-report-v9Storybook-$(date +'%Y%m%d-%H%M%S')"
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Commit and push v9 scheduled report
if: github.event_name == 'schedule'
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ steps.branch.outputs.branch }}
create_branch: true
commit_message: "chore: (auto) Update v9 playwright report"
file_pattern: apps/plotly_examples/reports/playwright-report-v9Storybook.json
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
repository: contrib_repo
- name: "Publish Notification for scheduled report commit"
if: steps.auto-commit-action.outputs.changes_detected == 'true'
shell: bash
run: |
echo "v9 Playwright report committed. [Create a pull request](https://github.com/${{ github.repository }}/pull/new/${{ steps.branch.outputs.branch }})" >> $GITHUB_STEP_SUMMARY