mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
Merge pull request #8881 from penpot/azazeln28-fix-text-editor-v2-tests
🐛 Fix text-editor v2 waitForIdle not having a timeout
This commit is contained in:
commit
0f389fe3ad
@ -40,6 +40,13 @@ export class WasmWorkspacePage extends WorkspacePage {
|
||||
this.canvas = page.getByTestId("canvas-wasm-shapes");
|
||||
}
|
||||
|
||||
async waitForIdle(options) {
|
||||
return this.page.evaluate(
|
||||
(options) => new Promise((resolve) => globalThis.requestIdleCallback(resolve, options)),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
async waitForFirstRender() {
|
||||
await this.pageName.waitFor();
|
||||
await this.canvas.waitFor();
|
||||
|
||||
@ -53,19 +53,18 @@ export class WorkspacePage extends BaseWebSocketPage {
|
||||
for (let i = 0; i < amount; i++) {
|
||||
await this.page.keyboard.press("ArrowLeft");
|
||||
}
|
||||
await this.waitForIdle();
|
||||
await this.waitForIdle({ timeout: 100 });
|
||||
}
|
||||
|
||||
async moveToRight(amount = 0) {
|
||||
for (let i = 0; i < amount; i++) {
|
||||
await this.page.keyboard.press("ArrowRight");
|
||||
}
|
||||
await this.waitForIdle();
|
||||
await this.waitForIdle({ timeout: 100 });
|
||||
}
|
||||
|
||||
async moveFromStart(offset = 0) {
|
||||
await this.page.keyboard.press("Home");
|
||||
await this.waitForIdle();
|
||||
await this.moveToRight(offset);
|
||||
}
|
||||
|
||||
@ -107,8 +106,10 @@ export class WorkspacePage extends BaseWebSocketPage {
|
||||
return this.changeNumericInput(this.letterSpacing, newValue);
|
||||
}
|
||||
|
||||
async waitForIdle() {
|
||||
await this.page.evaluate(() => new Promise((resolve) => globalThis.requestIdleCallback(resolve)));
|
||||
async waitForIdle(options) {
|
||||
await this.page.evaluate(
|
||||
(options) => new Promise(
|
||||
(resolve) => globalThis.requestIdleCallback(resolve, options)), options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -96,7 +96,6 @@ test("Update an already created text shape by prepending text", async ({
|
||||
await workspace.clickLeafLayer("Lorem ipsum");
|
||||
await workspace.textEditor.startEditing();
|
||||
await workspace.textEditor.moveFromStart(0);
|
||||
await page.evaluate(() => new Promise((resolve) => globalThis.requestIdleCallback(resolve)));
|
||||
await page.keyboard.type("Dolor sit amet ");
|
||||
await workspace.textEditor.stopEditing();
|
||||
await workspace.waitForSelectedShapeName("Dolor sit amet Lorem ipsum");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user