mirror of
https://github.com/penpot/penpot.git
synced 2025-07-09 21:47:16 +02:00
🔧 Make visual regression tests to hide the UI when taking a screenshot (render-wasm tests only)
This commit is contained in:
parent
4ea4a1e130
commit
9852d24b83
13 changed files with 16 additions and 2 deletions
|
@ -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) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue