test: isolate pull quote linework snapshot

This commit is contained in:
Keith Solomon
2026-06-27 20:05:52 -05:00
parent aaa9d28a79
commit 4969e4c9ce
3 changed files with 64 additions and 61 deletions
+61 -61
View File
@@ -1,5 +1,5 @@
// @ts-check // @ts-check
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from "@playwright/test";
/** /**
* Read environment variables from file. * Read environment variables from file.
@@ -13,71 +13,71 @@ import { defineConfig, devices } from '@playwright/test';
* @see https://playwright.dev/docs/test-configuration * @see https://playwright.dev/docs/test-configuration
*/ */
export default defineConfig({ export default defineConfig({
testDir: './tests', testDir: "./tests",
snapshotPathTemplate: '{testDir}/{testFilePath}-snapshots/{arg}{-projectName}{ext}', snapshotPathTemplate:
/* Run tests in files in parallel */ "{testDir}/{testFilePath}-snapshots/{arg}{-projectName}{ext}",
fullyParallel: true, /* Run tests in files in parallel */
/* Fail the build on CI if you accidentally left test.only in the source code. */ fullyParallel: true,
forbidOnly: !!process.env.CI, /* Fail the build on CI if you accidentally left test.only in the source code. */
/* Retry on CI only */ forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0, /* Retry on CI only */
/* Opt out of parallel tests on CI. */ retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined, /* Opt out of parallel tests on CI. */
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ workers: process.env.CI ? 1 : undefined,
reporter: 'html', /* Reporter to use. See https://playwright.dev/docs/test-reporters */
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ reporter: "html",
use: { /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
/* Base URL to use in actions like `await page.goto('/')`. */ use: {
// baseURL: 'http://127.0.0.1:3000', /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: "on-first-retry",
ignoreHTTPSErrors: true, ignoreHTTPSErrors: true,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
}, },
// { /* Configure projects for major browsers */
// name: 'firefox', projects: [
// use: { ...devices['Desktop Firefox'] }, {
// }, name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
// { // {
// name: 'webkit', // name: 'firefox',
// use: { ...devices['Desktop Safari'] }, // use: { ...devices['Desktop Firefox'] },
// }, // },
/* Test against mobile viewports. */ // {
// { // name: 'webkit',
// name: 'Mobile Chrome', // use: { ...devices['Desktop Safari'] },
// use: { ...devices['Pixel 5'] }, // },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */ /* Test against mobile viewports. */
// { // {
// name: 'Microsoft Edge', // name: 'Mobile Chrome',
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, // use: { ...devices['Pixel 5'] },
// }, // },
// { // {
// name: 'Google Chrome', // name: 'Mobile Safari',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // use: { ...devices['iPhone 12'] },
// }, // },
],
/* Run your local dev server before starting the tests */ /* Test against branded browsers. */
// webServer: { // {
// command: 'npm run start', // name: 'Microsoft Edge',
// url: 'http://127.0.0.1:3000', // use: { ...devices['Desktop Edge'], channel: 'msedge' },
// reuseExistingServer: !process.env.CI, // },
// }, // {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
}); });
+3
View File
@@ -226,6 +226,9 @@ test("mobile pull quote matches the supplied visual reference", async ({
test("mobile pull quote linework render remains stable", async ({ page }) => { test("mobile pull quote linework render remains stable", async ({ page }) => {
await page.goto(homepage); await page.goto(homepage);
await page.locator(".pull-quote__content").evaluate((content) => {
content.style.visibility = "hidden";
});
await expect(page.locator(".pull-quote__vector--mobile")).toHaveScreenshot( await expect(page.locator(".pull-quote__vector--mobile")).toHaveScreenshot(
"pullquote-linework-render.png", "pullquote-linework-render.png",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 29 KiB