Skip to content

Commit

Permalink
test: add full page snapshot expect FPS bar
Browse files Browse the repository at this point in the history
  • Loading branch information
lumixraku committed Oct 12, 2024
1 parent eb9b0cf commit 6d877f4
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,41 @@ 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 () => {
const browser = await chromium.launch({
headless: true, // Set to false to see the browser window
});
const context = await browser.newContext({
viewport: { width: 1280, height: 720 },
deviceScaleFactor: 2, // Set your desired DPR
});
const page = await context.newPage();
await page.goto('http://localhost:3000/sheets/');
await page.waitForTimeout(2000);
await page.evaluate(() => window.E2EControllerAPI.loadDefaultSheet());
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;
Expand Down

0 comments on commit 6d877f4

Please sign in to comment.