-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Setup VRT #3894
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
amanmahajan7
wants to merge
47
commits into
main
Choose a base branch
from
am-vrt
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
Setup VRT #3894
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
9189d89
Initial commit
amanmahajan7 6222e0e
Merge branch 'main' into am-vrt
amanmahajan7 f5bbca7
Fix typo
amanmahajan7 210826e
Fix typo
amanmahajan7 c2854b0
Move visual folder inside test folder
amanmahajan7 de666b2
Use version instead of SHA
amanmahajan7 cc4849d
eslint fixes
amanmahajan7 e55c86f
Fix path
amanmahajan7 df282b7
Ignore __screenshots__ in the browser folder
amanmahajan7 cf29892
Update screenshots
github-actions[bot] 2996304
Update node version
amanmahajan7 7005363
Delete screenshots
amanmahajan7 4062d69
Update screenshots
github-actions[bot] 4f643e7
Try `workflow_dispatch`
amanmahajan7 4519eca
delete screenshots
amanmahajan7 3d21369
Add `workflow_dispatch:`
amanmahajan7 f7f64bc
Update screenshots
github-actions[bot] a096041
Remove `workflow_dispatch:`
amanmahajan7 ab59a4d
try to trigger ci workflow
nstepien e7ae777
add test
nstepien 9608fdd
Update screenshots
github-actions[bot] 299291b
add permission
nstepien d095013
Update screenshots
github-actions[bot] cdcaad3
ci: add workflow_dispatch trigger
nstepien a13bed7
Merge branch 'main' into am-vrt
nstepien 683e360
geren
nstepien 7786a0a
Update screenshots
github-actions[bot] 6ba34e9
add workflow_dispatch there
nstepien 9f69fe2
Remove the color test
amanmahajan7 b6d6406
Manually delete screenshots for now
amanmahajan7 c2f6f93
Remove directory before generating screenshots
amanmahajan7 20d2c1d
rename screenshots
amanmahajan7 100d715
Fix command
amanmahajan7 c45dc52
Update screenshots
github-actions[bot] 942b81d
Revert name
amanmahajan7 a01b976
Update screenshots
github-actions[bot] dabbaed
Update .github/workflows/update-screenshots.yml
amanmahajan7 86025f2
fix viewport
amanmahajan7 8437c47
Remove `--set-upstream`
amanmahajan7 09d556e
Update screenshots
github-actions[bot] 312a62a
Update test/visual/basicGrid.test.tsx
amanmahajan7 6928269
Try gh cli
amanmahajan7 3a3257b
Revert "Try gh cli"
amanmahajan7 9cf8557
try `gh pr edit`
amanmahajan7 f428b77
Remove invalid token
amanmahajan7 1f231f1
Add env
amanmahajan7 fd10290
Update screenshots
github-actions[bot] 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Update Screenshots | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| AUTHOR_NAME: 'github-actions[bot]' | ||
| AUTHOR_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com' | ||
| COMMIT_MESSAGE: | | ||
| Update screenshots | ||
|
|
||
| Co-authored-by: ${{ github.actor }} | ||
|
|
||
| jobs: | ||
| update-screenshots: | ||
| if: ${{ github.event.label.name == 'Update Screenshots' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| # one at a time per branch | ||
| concurrency: | ||
| group: update-screenshots@${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 25 | ||
| check-latest: true | ||
| - name: Remove label | ||
| uses: actions-ecosystem/action-remove-labels@v1 | ||
| with: | ||
| labels: 'Update Screenshots' | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
amanmahajan7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Install dependencies | ||
| run: npm i | ||
| - name: Install Playwright Browsers | ||
| run: npx playwright install chromium firefox | ||
| - name: Update screenshots | ||
| run: | | ||
| rm -r test/visual/__screenshots__ | ||
| node --run visual:update | ||
| - name: Push new screenshots | ||
| run: | | ||
| git config --global user.name "${{ env.AUTHOR_NAME }}" | ||
| git config --global user.email "${{ env.AUTHOR_EMAIL }}" | ||
| git add test/visual/__screenshots__/. | ||
| git diff-index --quiet HEAD || git commit -m "${{ env.COMMIT_MESSAGE }}" | ||
| git push | ||
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
Binary file added
BIN
+17.6 KB
test/visual/__screenshots__/basicGrid.test.tsx/basic-grid-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.8 KB
test/visual/__screenshots__/basicGrid.test.tsx/basic-grid-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,54 @@ | ||
| import { page } from 'vitest/browser'; | ||
|
|
||
| import { DataGrid, SelectColumn, type Column } from '../../src'; | ||
| import { getGrid } from '../browser/utils'; | ||
|
|
||
| interface Row { | ||
| id: number; | ||
| name: string; | ||
| } | ||
|
|
||
| const columns: readonly Column<Row, Row>[] = [ | ||
| SelectColumn, | ||
| { | ||
| key: 'name', | ||
| name: 'Name', | ||
| renderSummaryCell(props) { | ||
| return props.row.name; | ||
| } | ||
| } | ||
| ]; | ||
|
|
||
| const rows: readonly Row[] = [ | ||
| { id: 1, name: 'Row 1' }, | ||
| { id: 2, name: 'Row 2' }, | ||
| { id: 3, name: 'Row 3' } | ||
| ]; | ||
|
|
||
| const topSummaryRows: readonly Row[] = [ | ||
| { id: 4, name: 'Top Summary Row 1' }, | ||
| { id: 5, name: 'Top Summary Row 2' } | ||
| ]; | ||
|
|
||
| const bottomSummaryRows: readonly Row[] = [ | ||
| { id: 4, name: 'Top Summary Row 1' }, | ||
| { id: 5, name: 'Top Summary Row 2' } | ||
amanmahajan7 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ]; | ||
|
|
||
| function rowKeyGetter(row: Row) { | ||
| return row.id; | ||
| } | ||
|
|
||
| test('basic grid', async () => { | ||
| await page.render( | ||
| <DataGrid | ||
| rowKeyGetter={rowKeyGetter} | ||
| columns={columns} | ||
| rows={rows} | ||
| topSummaryRows={topSummaryRows} | ||
| bottomSummaryRows={bottomSummaryRows} | ||
| /> | ||
| ); | ||
|
|
||
| await expect(getGrid()).toMatchScreenshot('basic-grid'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can tweak the match options if needed |
||
| }); | ||
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
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.
Copied some of the instructions from https://vitest.dev/guide/browser/visual-regression-testing.html#the-update-workflow