Skip to content
Open
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9189d89
Initial commit
amanmahajan7 Oct 23, 2025
6222e0e
Merge branch 'main' into am-vrt
amanmahajan7 Oct 24, 2025
f5bbca7
Fix typo
amanmahajan7 Oct 24, 2025
210826e
Fix typo
amanmahajan7 Oct 24, 2025
c2854b0
Move visual folder inside test folder
amanmahajan7 Oct 24, 2025
de666b2
Use version instead of SHA
amanmahajan7 Oct 24, 2025
cc4849d
eslint fixes
amanmahajan7 Oct 24, 2025
e55c86f
Fix path
amanmahajan7 Oct 24, 2025
df282b7
Ignore __screenshots__ in the browser folder
amanmahajan7 Oct 24, 2025
cf29892
Update screenshots
github-actions[bot] Oct 24, 2025
2996304
Update node version
amanmahajan7 Oct 24, 2025
7005363
Delete screenshots
amanmahajan7 Oct 24, 2025
4062d69
Update screenshots
github-actions[bot] Oct 24, 2025
4f643e7
Try `workflow_dispatch`
amanmahajan7 Oct 24, 2025
4519eca
delete screenshots
amanmahajan7 Oct 24, 2025
3d21369
Add `workflow_dispatch:`
amanmahajan7 Oct 24, 2025
f7f64bc
Update screenshots
github-actions[bot] Oct 24, 2025
a096041
Remove `workflow_dispatch:`
amanmahajan7 Oct 24, 2025
ab59a4d
try to trigger ci workflow
nstepien Oct 24, 2025
e7ae777
add test
nstepien Oct 24, 2025
9608fdd
Update screenshots
github-actions[bot] Oct 24, 2025
299291b
add permission
nstepien Oct 24, 2025
d095013
Update screenshots
github-actions[bot] Oct 24, 2025
cdcaad3
ci: add workflow_dispatch trigger
nstepien Oct 24, 2025
a13bed7
Merge branch 'main' into am-vrt
nstepien Oct 24, 2025
683e360
geren
nstepien Oct 24, 2025
7786a0a
Update screenshots
github-actions[bot] Oct 24, 2025
6ba34e9
add workflow_dispatch there
nstepien Oct 24, 2025
9f69fe2
Remove the color test
amanmahajan7 Oct 24, 2025
b6d6406
Manually delete screenshots for now
amanmahajan7 Oct 24, 2025
c2f6f93
Remove directory before generating screenshots
amanmahajan7 Oct 24, 2025
20d2c1d
rename screenshots
amanmahajan7 Oct 24, 2025
100d715
Fix command
amanmahajan7 Oct 24, 2025
c45dc52
Update screenshots
github-actions[bot] Oct 24, 2025
942b81d
Revert name
amanmahajan7 Oct 24, 2025
a01b976
Update screenshots
github-actions[bot] Oct 24, 2025
dabbaed
Update .github/workflows/update-screenshots.yml
amanmahajan7 Oct 24, 2025
86025f2
fix viewport
amanmahajan7 Oct 24, 2025
8437c47
Remove `--set-upstream`
amanmahajan7 Oct 24, 2025
09d556e
Update screenshots
github-actions[bot] Oct 24, 2025
312a62a
Update test/visual/basicGrid.test.tsx
amanmahajan7 Oct 24, 2025
6928269
Try gh cli
amanmahajan7 Oct 24, 2025
3a3257b
Revert "Try gh cli"
amanmahajan7 Oct 24, 2025
9cf8557
try `gh pr edit`
amanmahajan7 Oct 24, 2025
f428b77
Remove invalid token
amanmahajan7 Oct 24, 2025
1f231f1
Add env
amanmahajan7 Oct 24, 2025
fd10290
Update screenshots
github-actions[bot] Oct 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version: 25
check-latest: true
- name: npm install
- name: Install dependencies
run: npm i
- name: Biome
run: node --run biome:ci
Expand All @@ -33,6 +33,8 @@ jobs:
- name: Test
run: node --run test
timeout-minutes: 4
- name: Visual regression test
run: node --run visual
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/update-screenshots.yml
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'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}
- 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/lib
/node_modules
/package-lock.json
__screenshots__
test/browser/**/__screenshots__

npm-debug.log
**.orig
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@
"preview": "vite preview",
"build:website": "vite build",
"build": "rolldown -c",
"test": "vitest run",
"test:watch": "vitest watch",
"test": "vitest run --project browser --project node --coverage.reportsDirectory='./coverage/test'",
"test:watch": "vitest watch --project browser --project node",
"visual": "vitest run --project visual --coverage.reportsDirectory='./coverage/visual'",
"visual:update": "vitest run --project visual --update",
"format": "biome format --write",
"check": "biome check --error-on-warnings",
"biome:ci": "biome ci --error-on-warnings",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions test/visual/basicGrid.test.tsx
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' }
];

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');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});
20 changes: 20 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ export default defineConfig(
setupFiles: ['test/setupBrowser.ts']
}
},
{
extends: true,
test: {
name: 'visual',
include: ['test/visual/*.test.*'],
browser: {
enabled: true,
provider: playwright({
contextOptions: {
viewport
}
}),
instances: [{ browser: 'chromium' }, { browser: 'firefox' }],
viewport,
headless: true,
screenshotFailures: false
},
setupFiles: ['test/setupBrowser.ts']
}
},
{
extends: true,
test: {
Expand Down