From 26e890c3440d0df02a5b84881822d496d49bb8a2 Mon Sep 17 00:00:00 2001 From: lumixraku Date: Sat, 12 Oct 2024 15:20:57 +0800 Subject: [PATCH] test: add full page snapshot expect FPS bar --- .../sheets/sheets-visual-comparison.spec.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts b/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts index bdbdd0840b85..4c7d6c9151e4 100644 --- a/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts +++ b/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts @@ -18,18 +18,31 @@ import { chromium, expect, test } from '@playwright/test'; import { generateSnapshotName } from '../const'; const SHEET_MAIN_CANVAS_ID = '#univer-sheet-main-canvas'; +const isCI = !!process.env.CI; +test('diff default sheet toolbar', async ({ page }) => { + await page.goto('http://localhost:3000/sheets/'); + await page.waitForTimeout(2000); + + const filename = generateSnapshotName('default-sheet-fullpage'); + const screenshot = await page.screenshot({ + mask: [ + page.locator('.univer-headerbar'), + ], + fullPage: true, + }); + await expect(screenshot).toMatchSnapshot(filename, { maxDiffPixels: 5 }); +}); test('diff default sheet content', async ({ page }) => { await page.goto('http://localhost:3000/sheets/'); await page.waitForTimeout(2000); await page.evaluate(() => window.E2EControllerAPI.loadDefaultSheet()); - await page.waitForTimeout(5000); + await page.waitForTimeout(2000); const filename = generateSnapshotName('default-sheet'); const screenshot = await page.locator(SHEET_MAIN_CANVAS_ID).screenshot(); await expect(screenshot).toMatchSnapshot(filename, { maxDiffPixels: 5 }); }); -const isCI = !!process.env.CI; test('diff demo sheet content', async ({ page }) => { let errored = false;