-
Notifications
You must be signed in to change notification settings - Fork 15
chore: baseline styling screenshots (pre-fix) #607
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
paddymul
wants to merge
15
commits into
main
Choose a base branch
from
screenshots/baseline
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
15 commits
Select commit
Hold shift + click to select a range
d4f892d
add screenshot apparatus for baseline styling comparison
paddymul 135bc52
fix: checkout PR head SHA for screenshots, not merge ref
paddymul 137f480
fix: scroll grid body in pinned-index screenshots to expose #587
paddymul bed58fa
fix: pierce shadow DOM for pinned-index scroll in screenshots
paddymul 594dc74
fix: walk all shadow roots to find ag-body-viewport for scroll
paddymul 87a3d5b
fix: use long headers in pinned stories so grid requires horizontal s…
paddymul 9a5a30f
fix: use 400px container for pinned stories to force horizontal scroll
paddymul 5dae69f
fix: add minWidth:120 via ag_grid_specs on pinned stories to force ov…
paddymul b4c214d
fix: use keyboard End key to scroll pinned stories to rightmost column
paddymul f123635
feat: add A9 story for #595 — many cols, long headers, year-like data
paddymul 2b4c1e7
fix: A9 story — 25 long cols in 400px to force data truncation (#595)
paddymul 72abf2f
fix: A9 — force maxWidth:50 on columns to reproduce #595 truncation
paddymul b74e0ed
fix: update A9 story to use width:40 + suppressAutoSize for #595 repro
paddymul dca9ada
fix: update A9 story to use fitGridWidth + autoSizeStrategy override
paddymul 37ce057
fix: update A9 story to 25 cols for visible truncation repro
paddymul 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
107 changes: 107 additions & 0 deletions
107
packages/buckaroo-js-core/pw-tests/styling-issues-screenshots.spec.ts
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,107 @@ | ||
| /** | ||
| * Playwright screenshot capture for styling-issue stories. | ||
| * Follows the theme-screenshots.spec.ts pattern (light-only). | ||
| * | ||
| * SCREENSHOT_DIR env var controls output directory (default: screenshots/after). | ||
| * Run once on each commit to produce "before" and "after" sets: | ||
| * | ||
| * SCREENSHOT_DIR=screenshots/before npx playwright test pw-tests/styling-issues-screenshots.spec.ts | ||
| * SCREENSHOT_DIR=screenshots/after npx playwright test pw-tests/styling-issues-screenshots.spec.ts | ||
| */ | ||
| import { test } from '@playwright/test'; | ||
| import path from 'path'; | ||
| import fs from 'fs'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| const STORYBOOK_BASE = 'http://localhost:6006/iframe.html?viewMode=story&id='; | ||
|
|
||
| // Output directory — overridable via env var | ||
| const screenshotsDir = path.resolve( | ||
| __dirname, | ||
| '..', | ||
| process.env.SCREENSHOT_DIR ?? 'screenshots/after', | ||
| ); | ||
|
|
||
| /** | ||
| * All 16 styling-issue stories. | ||
| * Story IDs follow Storybook's slug rules: | ||
| * title "Buckaroo/DFViewer/StylingIssues" → "buckaroo-dfviewer-stylingissues" | ||
| * export name e.g. FewCols_ShortHdr_ShortData → "few-cols-short-hdr-short-data" | ||
| * (Storybook runs startCase() on the export name before slugifying) | ||
| */ | ||
| const STORIES = [ | ||
| // Section A – width/contention (#595, #596, #599, #600) | ||
| { id: 'buckaroo-dfviewer-stylingissues--few-cols-short-hdr-short-data', name: 'A1_FewCols_ShortHdr_ShortData', issues: '#599' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--few-cols-short-hdr-long-data', name: 'A2_FewCols_ShortHdr_LongData', issues: '' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--few-cols-long-hdr-short-data', name: 'A3_FewCols_LongHdr_ShortData', issues: '' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--few-cols-long-hdr-long-data', name: 'A4_FewCols_LongHdr_LongData', issues: '' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--many-cols-short-hdr-short-data', name: 'A5_ManyCols_ShortHdr_ShortData', issues: '#595 #599' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--many-cols-short-hdr-long-data', name: 'A6_ManyCols_ShortHdr_LongData', issues: '#596' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--many-cols-long-hdr-short-data', name: 'A7_ManyCols_LongHdr_ShortData', issues: '#596' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--many-cols-long-hdr-long-data', name: 'A8_ManyCols_LongHdr_LongData', issues: '#596 worst-case' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--many-cols-long-hdr-year-data', name: 'A9_ManyCols_LongHdr_YearData', issues: '#595 primary' }, | ||
|
|
||
| // Section B – large numbers / compact_number (#597, #602) | ||
| // Note: compact_number stories may render raw values on pre-#597 commits. | ||
| { id: 'buckaroo-dfviewer-stylingissues--large-numbers-float', name: 'B9_LargeNumbers_Float', issues: '#597 before' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--large-numbers-compact', name: 'B10_LargeNumbers_Compact', issues: '#597 after' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--clustered-billions-float', name: 'B11_ClusteredBillions_Float', issues: '#602 baseline' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--clustered-billions-compact', name: 'B12_ClusteredBillions_Compact', issues: '#602 precision' }, | ||
|
|
||
| // Section C – pinned row / index alignment (#587) | ||
| { id: 'buckaroo-dfviewer-stylingissues--pinned-index-few-cols', name: 'C13_PinnedIndex_FewCols', issues: '#587' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--pinned-index-many-cols', name: 'C14_PinnedIndex_ManyCols', issues: '#587' }, | ||
|
|
||
| // Section D – mixed cross-issue scenarios | ||
| { id: 'buckaroo-dfviewer-stylingissues--mixed-many-narrow-with-pinned', name: 'D15_Mixed_ManyNarrow_WithPinned', issues: '#595 #587 #599' }, | ||
| { id: 'buckaroo-dfviewer-stylingissues--mixed-few-wide-with-pinned', name: 'D16_Mixed_FewWide_WithPinned', issues: '#587 baseline' }, | ||
| ]; | ||
|
|
||
| test.beforeAll(() => { | ||
| fs.mkdirSync(screenshotsDir, { recursive: true }); | ||
| }); | ||
|
|
||
| for (const story of STORIES) { | ||
| test(`screenshot ${story.name}`, async ({ page }) => { | ||
| await page.emulateMedia({ colorScheme: 'light' }); | ||
| await page.goto(`${STORYBOOK_BASE}${story.id}`); | ||
|
|
||
| // Wait for AG-Grid cells or any visible content | ||
| const cell = page.locator('.ag-cell'); | ||
| const cellWrapper = page.locator('.ag-cell-wrapper'); | ||
| const noRows = page.locator('.ag-overlay-no-rows-center'); | ||
| const fullWidth = page.locator('.ag-full-width-row'); | ||
| const sbContent = page.locator('#storybook-root'); | ||
|
|
||
| await cell | ||
| .or(cellWrapper) | ||
| .or(noRows) | ||
| .or(fullWidth) | ||
| .or(sbContent) | ||
| .first() | ||
| .waitFor({ state: 'visible', timeout: 15000 }); | ||
|
|
||
| // Settle time for animations / lazy column-width calculation | ||
| await page.waitForTimeout(800); | ||
|
|
||
| // For pinned-index stories, scroll the grid body right so the | ||
| // index column is out of view — exposes #587 alignment bug. | ||
| // Use keyboard End key to scroll to the rightmost column. | ||
| if (story.name.includes('Pinned')) { | ||
| // Click a cell first to give the grid focus | ||
| const firstCell = page.locator('.ag-cell').first(); | ||
| await firstCell.click(); | ||
| await page.waitForTimeout(200); | ||
| // Press End to scroll to the last column | ||
| await page.keyboard.press('End'); | ||
| await page.waitForTimeout(400); | ||
| } | ||
|
|
||
| await page.screenshot({ | ||
| path: path.join(screenshotsDir, `${story.name}.png`), | ||
| fullPage: true, | ||
| }); | ||
| }); | ||
| } |
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.
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.
The new workflow uploads a single artifact named
styling-screenshots, butscripts/download_styling_screenshots.shtries to downloadstyling-screenshots-beforeandstyling-screenshots-afterfrom the same run. In this configuration, the helper script cannot fetch screenshots produced by this job, so the before/after comparison flow is broken for every run of this workflow.Useful? React with 👍 / 👎.