Skip to content

Commit

Permalink
test: update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Oct 10, 2024
1 parent e36529a commit 9330249
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: pnpm build:e2e

- name: Run Playwright Tests
run: pnpm exec playwright test
run: pnpm exec playwright test --output=playwright-assets

- name: 🚀 Deploy to Vercel
uses: amondnet/vercel-action@v25
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ storybook-static
# playwright
/test-results/
/playwright-report/
/playwright-assets/
/blob-report/
/playwright/.cache/
playwright-report.json
Expand Down
17 changes: 10 additions & 7 deletions e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test('diff default sheet content', async ({ page }) => {

await expect(page).toHaveScreenshot(generateSnapshotName('default-sheet'), { maxDiffPixels: 5 });
});
const isCI = !!process.env.CI;

test('diff demo sheet content', async ({ page }) => {
let errored = false;
Expand All @@ -42,6 +43,7 @@ test('diff demo sheet content', async ({ page }) => {
await page.waitForTimeout(2000);

await expect(page).toHaveScreenshot(generateSnapshotName('demo-sheet'), { maxDiffPixels: 5 });
await page.waitForTimeout(2000);
expect(errored).toBeFalsy();
});

Expand All @@ -50,11 +52,11 @@ test('diff demo sheet content', async ({ page }) => {
*/
test('diff merged cells rendering', async () => {
const browser = await chromium.launch({
headless: true, //!!CI, // Set to false to see the browser window
headless: !!isCI, // Set to false to see the browser window
});
const context = await browser.newContext({
viewport: { width: 1280, height: 1280 },
deviceScaleFactor: 1, // Set your desired DPR
deviceScaleFactor: 2, // Set your desired DPR
});
const page = await context.newPage();
await page.goto('http://localhost:3000/sheets/');
Expand All @@ -65,16 +67,16 @@ test('diff merged cells rendering', async () => {

await expect(page).toHaveScreenshot(generateSnapshotName('mergedCellsRendering'), { maxDiffPixels: 5 });

await page.waitForTimeout(2000);
await browser.close();
});
const isCI = !!process.env.CI;
test('diff merged cells rendering after scrolling', async ({}) => {
test('diff merged cells rendering after scrolling', async () => {
const browser = await chromium.launch({
headless: true, //!!isCI, // Set to false to see the browser window in local
headless: !!isCI, // Set to false to see the browser window in local
});
const context = await browser.newContext({
viewport: { width: 1280, height: 1280 },
deviceScaleFactor: 1, // Set your desired DPR
deviceScaleFactor: 2, // Set your desired DPR
});
const page = await context.newPage();
await page.goto('http://localhost:3000/sheets/');
Expand Down Expand Up @@ -123,9 +125,10 @@ test('diff merged cells rendering after scrolling', async ({}) => {
await dispatchWheelEvent(0, 100, element);
await dispatchWheelEvent(0, -100, element);
});
await page.waitForTimeout(4000);
await page.waitForTimeout(2000);

await expect(page).toHaveScreenshot(generateSnapshotName('mergedCellsRenderingScrolling'), { maxDiffPixels: 5 });

await page.waitForTimeout(2000);
await browser.close();
});
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.
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.
5 changes: 2 additions & 3 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['json', { outputFile: 'playwright-report.json' }],
['html'],
['html', { attachments: true }],
],
outputDir: './playwright-report',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand All @@ -38,9 +38,8 @@ export default defineConfig({
baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: 'retain-on-failure',
},

/* Configure projects for major browsers */
projects: [
{
Expand Down

0 comments on commit 9330249

Please sign in to comment.