Skip to content

Commit

Permalink
chore: snapshot only on canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Oct 11, 2024
1 parent 5e7efe6 commit 640b2dc
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ test('diff default sheet content', async ({ page }) => {

// await expect(page).toHaveScreenshot(generateSnapshotName('default-sheet'), { maxDiffPixels: 5 });
const filename = generateSnapshotName('default-sheet');
// ignore DOM part when comparison
const screenshot = await page.screenshot({
clip: {
x: 0,
y: 92,
width: 1280,
height: 592, // 720 - 92(header) - 36(bottom)
},
});
const screenshot = await page.locator('#univer-sheet-main-canvas').screenshot();
await expect(screenshot).toMatchSnapshot(filename, { maxDiffPixels: 5 });
});
const isCI = !!process.env.CI;
Expand All @@ -56,15 +48,7 @@ test('diff demo sheet content', async ({ page }) => {
// await expect(page).toHaveScreenshot(generateSnapshotName('demo-sheet'), { maxDiffPixels: 5 });

const filename = generateSnapshotName('demo-sheet');
// ignore DOM part when comparison
const screenshot = await page.screenshot({
clip: {
x: 0,
y: 92,
width: 1280,
height: 592, // 720 - 92(header) - 36(bottom)
},
});
const screenshot = await page.locator('#univer-sheet-main-canvas').screenshot();
await expect(screenshot).toMatchSnapshot(filename, { maxDiffPixels: 5 });
await page.waitForTimeout(2000);
expect(errored).toBeFalsy();
Expand Down Expand Up @@ -155,14 +139,7 @@ test('diff merged cells rendering after scrolling', async () => {

// await expect(page).toHaveScreenshot(generateSnapshotName('mergedCellsRenderingScrolling'), { maxDiffPixels: 5 });
const filename = generateSnapshotName('mergedCellsRenderingScrolling');
const screenshot = await page.screenshot({
clip: {
x: 0,
y: 92,
width: 1280,
height: 1152,
},
});
const screenshot = await page.locator('#univer-sheet-main-canvas').screenshot();
await expect(screenshot).toMatchSnapshot(filename, { maxDiffPixels: 5 });

await page.waitForTimeout(2000);
Expand Down

0 comments on commit 640b2dc

Please sign in to comment.