-
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
Setup VRT #3894
Changes from 7 commits
9189d89
6222e0e
f5bbca7
210826e
c2854b0
de666b2
cc4849d
e55c86f
df282b7
cf29892
2996304
7005363
4062d69
4f643e7
4519eca
3d21369
f7f64bc
a096041
ab59a4d
e7ae777
9608fdd
299291b
d095013
cdcaad3
a13bed7
683e360
7786a0a
6ba34e9
9f69fe2
b6d6406
c2f6f93
20d2c1d
100d715
c45dc52
942b81d
a01b976
dabbaed
86025f2
8437c47
09d556e
312a62a
6928269
3a3257b
9cf8557
f428b77
1f231f1
fd10290
238322e
2819940
87bac9d
e0e8cc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Update Screenshots | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
|
|
||
| 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: 24 | ||
| 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: 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 visual/__screenshots__/. | ||
| git diff-index --quiet HEAD || git commit -m "${{ env.COMMIT_MESSAGE }}" | ||
| git push --set-upstream origin ${{ github.head_ref }} | ||
|
||
| 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'); | ||
|
Check failure on line 53 in test/visual/basicGrid.test.tsx
|
||
|
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 |
||
| }); | ||
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