Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,25 @@ const PAGES: {
// and column headers stay under test.
mask: ['[data-testid="services-container"] tbody'],
},
{ name: 'data-quality', route: '/data-quality' },
{
name: 'data-quality',
route: '/data-quality',
// The Data Health cards count whatever assets the environment happens to
// hold — 322 tables in CI, 486 on a dev box — so the donut and its legend
// counts cannot be baselined. Mask those two and nothing else: the cards,
// their icons and headings, and the legend's dots and labels stay under
// test, as do the page chrome, tabs, filter row and Data Dimensions.
//
// A mask is sized to the element it covers, and these counts are inline, so
// the baseline does still encode their digit *width* — 322 and 486 both
// being three digits is why this holds across environments. If the seeded
// totals ever cross a digit boundary the text after them shifts and this
// goes red; mask the legend container then, at the cost of its labels.
mask: [
'[data-testid$="-pie-chart-widget"] [id$="-pie-chart"]',
'[data-testid$="-pie-chart-widget"] [data-testid^="legend-count-"]',
],
},
{
name: 'incident-manager',
route: '/incident-manager',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Page } from '@playwright/test';
import { expect, Page } from '@playwright/test';
import { waitForPageLoaded } from './polling';

/**
* Wait out skeleton placeholders.
*
* `waitForPageLoaded` clears loader *spinners*, which is a different thing: a
* widget that renders `<Skeleton />` while its query is in flight shows no
* spinner, so the page reads as settled while half of it is still grey blocks.
* A screenshot taken then records the skeletons, and the baseline only matches
* while the next run is equally slow — which is how `data-quality.png` came to
* hold a half-loaded page.
*
* Matched on the class rather than a testid because core-components' `Skeleton`
* exposes none; `tw:animate-pulse` is what it always renders, and the substring
* match sidesteps escaping the `tw:` prefix in a CSS selector.
*/
const waitForSkeletonsToResolve = async (page: Page) => {
await expect
.poll(() => page.locator('[class*="animate-pulse"]').count(), {
timeout: 30_000,
message:
'Skeleton placeholders never resolved, so the screenshot would have recorded a half-loaded page',
})
.toBe(0);
};

export const FIXED_DATE = new Date('2026-01-15T10:00:00.000Z');

/** Shared options for every toHaveScreenshot assertion in the visual suite. */
Expand Down Expand Up @@ -45,6 +69,7 @@ export const gotoForScreenshot = async (page: Page, path: string) => {
await page.clock.setFixedTime(FIXED_DATE);
await page.goto(path);
await waitForPageLoaded(page);
await waitForSkeletonsToResolve(page);
await page.addStyleTag({ content: FREEZE_CSS });
await page.evaluate(() => {
window.scrollTo(0, 0);
Expand Down
Loading