-
Notifications
You must be signed in to change notification settings - Fork 12
Added snapshot testing for v9 charts download button and handled lazy loading finicality in test for schema's selection list #627
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
Open
v-baambati
wants to merge
10
commits into
main
Choose a base branch
from
v-baambati/v9chartsSnapsTesting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7142c2a
updated v9 charts snaps
v-baambati 1766814
updated snaps for v9 charts from 501 to 991
v-baambati e2c3aac
Merge branch 'main' of https://github.com/microsoft/fluentui-charting…
v-baambati 8541d99
added new test file for v9 charts download button action
v-baambati e19b37b
moved snaps to respective folder
v-baambati dddde86
added v9 charts downlaod button workflow
v-baambati 043af42
removed snaps from PR
v-baambati 22540e6
Added work flow for updating v9charts download button snaps
v-baambati 9fee164
handled lazy loading funcatioli in schema's dropdown
v-baambati f058c62
handled lazy loading functionlity in schema's dropdown
v-baambati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
182 changes: 182 additions & 0 deletions
182
.github/workflows/plotlyTestCoverage_v9ChartsDownload.yml
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| name: "[v9] Plotly Test coverage v9 Charts Download" | ||
| on: | ||
| schedule: | ||
| - cron: "30 6 * * *" # Runs every day at 12:00 PM IST (02: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: '22.x' | ||
|
|
||
| - name: Install packages | ||
| run: | | ||
| cd ./repo1 | ||
| yarn | ||
|
|
||
| - name: Build | ||
| run: | | ||
| cd ./repo1 | ||
| yarn nx run react-charts:build | ||
|
|
||
| - name: Run yarn pack in chart-utilities to create .tgz file | ||
| run: | | ||
| cd ./repo1/packages/charts/chart-utilities | ||
| yarn pack --filename chart-utilities.tgz | ||
| id: pack-util | ||
|
|
||
| - name: Run yarn pack in react-charts to create .tgz file | ||
| run: | | ||
| cd ./repo1/packages/charts/react-charts/library | ||
| yarn pack --filename react-charts.tgz | ||
| id: pack-chart-v9-charts-download | ||
|
|
||
| - name: Upload chart-utilities.tgz as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: chart-utilities-tgz | ||
| path: ./repo1/packages/charts/chart-utilities/chart-utilities.tgz | ||
|
|
||
| - name: Upload react-charts.tgz as artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: react-charts-tgz | ||
| path: ./repo1/packages/charts/react-charts/library/react-charts.tgz | ||
|
|
||
| - name: Checkout [main] of current repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: contrib_repo | ||
|
|
||
| - name: Add chart-utils package to resolutions block | ||
| run: | | ||
| cd contrib_repo/apps/plotly_examples | ||
| npx json -I -f package.json -e "this.resolutions = this.resolutions || {}; this.resolutions['@fluentui/chart-utilities'] = 'file:../../../repo1/packages/charts/chart-utilities/chart-utilities.tgz';" | ||
|
|
||
|
|
||
| - name: Install .tgz file in Plotly examples | ||
| run: | | ||
| cd contrib_repo/apps/plotly_examples | ||
| yarn add ../../../repo1/packages/charts/react-charts/library/react-charts.tgz | ||
| yarn | ||
|
|
||
| - name: Start test app in background | ||
| shell: bash | ||
| run: | | ||
| cd contrib_repo/apps/plotly_examples | ||
| yarn build | ||
| nohup npx -y serve -s build -l 3000 > output.log 2>&1 & | ||
| npx wait-on http://localhost:3000/ --timeout 300000 | ||
|
|
||
| - name: Run Playwright test script | ||
| run: | | ||
| cd contrib_repo/apps/plotly_examples | ||
| npx playwright install | ||
| npx cross-env BASE_URL='http://localhost:3000/' npx playwright test tests/DeclarativeChart_v9ChartsDownload.spec.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-v9ChartsDownload.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-v9ChartsDownload.json | ||
| git add reports/playwright-report-v9ChartsDownload.json | ||
|
|
||
| - name: Create branch name for scheduled report | ||
| if: github.event_name == 'schedule' | ||
| id: branch | ||
| shell: bash | ||
| run: | | ||
| BRANCH="playwright-report-v9ChartsDownload-$(date +'%Y%m%d-%H%M%S')" | ||
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Commit and push v9 charts download 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 charts download playwright report" | ||
| file_pattern: apps/plotly_examples/reports/playwright-report-v9ChartsDownload.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: github.event_name == 'schedule' && steps.auto-commit-action.outputs.changes_detected == 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "v9 charts download button Playwright report committed. [Create a pull request](https://github.com/${{ github.repository }}/pull/new/${{ steps.branch.outputs.branch }})" >> $GITHUB_STEP_SUMMARY |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Update v9 Charts Download test snapshots | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["build and deploy to fluentchartseval"] # Name of Workflow A | ||
| types: | ||
| - completed | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| update_snapshots: | ||
| runs-on: windows-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Enable Git long paths | ||
| run: git config --global core.longpaths true | ||
|
|
||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
|
|
||
| - name: Install packages | ||
| run: | | ||
| cd apps/plotly_examples | ||
| yarn | ||
|
|
||
| - name: Skip if last commit is snapshot chore | ||
| id: skip_check | ||
| shell: bash | ||
| run: | | ||
| git fetch origin ${{ github.ref }} --depth=1 | ||
| last_msg=$(git log -1 --pretty=%B) | ||
| if [[ "$last_msg" == *"(chore) (auto) update react-charting snapshots"* || "$last_msg" == *"(chore) (auto) update react-charts snapshots"* || "$last_msg" == *"(chore) (auto) update react-charts storybook snapshots"* ]]; then | ||
| echo "skip_job=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "skip_job=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Run Playwright update snapshots | ||
| if: github.event_name == 'workflow_dispatch' || steps.skip_check.outputs.skip_job != 'true' | ||
| run: | | ||
| cd apps/plotly_examples | ||
| npx playwright install | ||
| npx cross-env BASE_URL='https://fluentchartseval.azurewebsites.net/' npx playwright test tests/DeclarativeChart_v9ChartsDownload.spec.ts --update-snapshots || true | ||
|
|
||
| - name: Create branch with timestamp | ||
| if: github.event_name == 'workflow_dispatch' || steps.skip_check.outputs.skip_job != 'true' | ||
| id: branch | ||
| shell: bash | ||
| run: | | ||
| BRANCH="update-v9ChartsDownload-snapshots-$(date +'%Y%m%d-%H%M%S')" | ||
| git checkout -b $BRANCH | ||
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Commit changes to repo | ||
| if: github.event_name == 'workflow_dispatch' || steps.skip_check.outputs.skip_job != 'true' | ||
| id: auto-commit-action | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| branch: ${{ steps.branch.outputs.branch }} | ||
| create_branch: true | ||
| commit_message: (chore) (auto) update react-charts snapshots | ||
| file_pattern: '*.png' | ||
|
|
||
| - name: "Publish Notification regarding changes" | ||
| if: (github.event_name == 'workflow_dispatch' || steps.skip_check.outputs.skip_job != 'true') && steps.auto-commit-action.outputs.changes_detected == 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "Create a pull request using this link: https://www.github.com/microsoft/fluentui-charting-contrib/pull/new/${{ steps.branch.outputs.branch }}" >> $GITHUB_STEP_SUMMARY |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are you handling lazy loading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically scrolls a virtualized listbox to load more options until the desired index is available or a maximum attempt limit is reached
Max attempt value is 5 for now
if request index is available in the list then it will break the loop.