🔧 Make visual regression tests to hide the UI when taking a screenshot (render-wasm tests only)

This commit is contained in:
Belén Albeza 2025-06-19 13:37:52 +02:00
parent 4ea4a1e130
commit 9852d24b83
13 changed files with 16 additions and 2 deletions

View file

@ -21,14 +21,24 @@ export class WasmWorkspacePage extends WorkspacePage {
this.canvas = page.getByTestId("canvas-wasm-shapes");
}
async waitForFirstRender() {
async waitForFirstRender(config = {}) {
const options = { hideUI: true, ...config };
await expect(this.pageName).toHaveText("Page 1");
if (options.hideUI) {
await this.hideUI();
}
await this.canvas.waitFor({ state: "visible" });
await this.page.waitForFunction(() => {
return window.wasmSetObjectsFinished;
});
}
async hideUI() {
await this.page.keyboard.press("\\");
await expect(this.pageName).not.toBeVisible();
}
static async mockGoogleFont(page, fontSlug, assetFilename, options = {}) {
const url = new RegExp(`/internal/gfonts/font/${fontSlug}`);
return await page.route(url, (route) =>