From 49ed090bc560516c3cf9410edd3b24ff57c28a4c Mon Sep 17 00:00:00 2001 From: Marat Abdullin Date: Sun, 22 Feb 2026 23:30:27 +0100 Subject: [PATCH] 1 second as default timeout. --- tools/playwright/package-lock.json | 4 ++-- tools/playwright/package.json | 2 +- tools/playwright/src/fixtures.ts | 2 +- tools/playwright/src/page-injector.ts | 6 +++--- .../tests/create-abledom-test.test.spec.ts | 4 ++-- .../tests/page-fixture-options.test.spec.ts | 2 +- tools/playwright/tests/page-injector.test.spec.ts | 14 +++++++------- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/playwright/package-lock.json b/tools/playwright/package-lock.json index 0fb1991..fb8c876 100644 --- a/tools/playwright/package-lock.json +++ b/tools/playwright/package-lock.json @@ -1,12 +1,12 @@ { "name": "abledom-playwright", - "version": "0.0.17", + "version": "0.0.18", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "abledom-playwright", - "version": "0.0.17", + "version": "0.0.18", "license": "MIT", "devDependencies": { "@eslint/js": "^9.39.2", diff --git a/tools/playwright/package.json b/tools/playwright/package.json index 49933ce..2816be8 100644 --- a/tools/playwright/package.json +++ b/tools/playwright/package.json @@ -1,6 +1,6 @@ { "name": "abledom-playwright", - "version": "0.0.17", + "version": "0.0.18", "description": "AbleDOM tools for Playwright", "author": "Marat Abdullin ", "license": "MIT", diff --git a/tools/playwright/src/fixtures.ts b/tools/playwright/src/fixtures.ts index 740332b..e67a6ac 100644 --- a/tools/playwright/src/fixtures.ts +++ b/tools/playwright/src/fixtures.ts @@ -26,7 +26,7 @@ export interface AbleDOMFixtures { * IMPORTANT: This function is async and MUST be awaited before navigating the page. * * @param page - The Playwright Page object to attach AbleDOM to - * @param options - Optional idle options (markAsRead defaults to true, timeout defaults to 2000ms) + * @param options - Optional idle options (markAsRead defaults to true, timeout defaults to 1000ms) * * @example * ```typescript diff --git a/tools/playwright/src/page-injector.ts b/tools/playwright/src/page-injector.ts index f77594c..33a4e68 100644 --- a/tools/playwright/src/page-injector.ts +++ b/tools/playwright/src/page-injector.ts @@ -19,7 +19,7 @@ export interface AbleDOMIdleOptions { /** * Timeout in milliseconds to wait for validation to complete. * If validation doesn't complete within the timeout, returns null. - * @default 2000 + * @default 1000 */ timeout?: number; } @@ -92,7 +92,7 @@ function getCallerLocation( * * @param page - The Playwright Page object to attach methods to * @param testInfo - Optional TestInfo object for reporting issues to the custom reporter - * @param options - Optional idle options (markAsRead defaults to true, timeout defaults to 2000ms) + * @param options - Optional idle options (markAsRead defaults to true, timeout defaults to 1000ms) * * @example * ```typescript @@ -113,7 +113,7 @@ export async function attachAbleDOMMethodsToPage( testInfo?: TestInfo, options: AbleDOMIdleOptions = {}, ): Promise { - const { markAsRead = true, timeout = 2000 } = options; + const { markAsRead = true, timeout = 1000 } = options; const attachAbleDOMMethodsToPageWithCachedLocatorProto: FunctionWithCachedLocatorProto = attachAbleDOMMethodsToPage; diff --git a/tools/playwright/tests/create-abledom-test.test.spec.ts b/tools/playwright/tests/create-abledom-test.test.spec.ts index fcc94b8..63ff8b3 100644 --- a/tools/playwright/tests/create-abledom-test.test.spec.ts +++ b/tools/playwright/tests/create-abledom-test.test.spec.ts @@ -247,7 +247,7 @@ test.describe("attachAbleDOM with custom options", () => { }); expect(opts).toHaveLength(1); - expect(opts[0]).toEqual({ markAsRead: false, timeout: 2000 }); + expect(opts[0]).toEqual({ markAsRead: false, timeout: 1000 }); await context.close(); }); @@ -379,7 +379,7 @@ test.describe("attachAbleDOM with custom options", () => { }); expect(opts).toHaveLength(1); - expect(opts[0]).toEqual({ markAsRead: true, timeout: 2000 }); + expect(opts[0]).toEqual({ markAsRead: true, timeout: 1000 }); await context.close(); }); diff --git a/tools/playwright/tests/page-fixture-options.test.spec.ts b/tools/playwright/tests/page-fixture-options.test.spec.ts index b973b40..9ee08b7 100644 --- a/tools/playwright/tests/page-fixture-options.test.spec.ts +++ b/tools/playwright/tests/page-fixture-options.test.spec.ts @@ -57,7 +57,7 @@ testWithMarkAsReadFalse.describe( }); expect(opts).toHaveLength(1); - expect(opts[0]).toEqual({ markAsRead: false, timeout: 2000 }); + expect(opts[0]).toEqual({ markAsRead: false, timeout: 1000 }); }, ); }, diff --git a/tools/playwright/tests/page-injector.test.spec.ts b/tools/playwright/tests/page-injector.test.spec.ts index 86648f9..81cb197 100644 --- a/tools/playwright/tests/page-injector.test.spec.ts +++ b/tools/playwright/tests/page-injector.test.spec.ts @@ -286,7 +286,7 @@ test.describe("idle options (markAsRead and timeout)", () => { }; }); - // Trigger an action - should use default options (markAsRead=true, timeout=2000) + // Trigger an action - should use default options (markAsRead=true, timeout=1000) await page.locator("button").waitFor(); // Verify the options were passed @@ -295,10 +295,10 @@ test.describe("idle options (markAsRead and timeout)", () => { }); expect(idleArgs.length).toBe(1); - expect(idleArgs[0]).toEqual({ markAsRead: true, timeout: 2000 }); + expect(idleArgs[0]).toEqual({ markAsRead: true, timeout: 1000 }); }); - test("should use default markAsRead=true and timeout=2000", async ({ + test("should use default markAsRead=true and timeout=1000", async ({ page, }) => { await page.goto( @@ -331,7 +331,7 @@ test.describe("idle options (markAsRead and timeout)", () => { }); expect(calls).toHaveLength(1); - expect(calls[0]).toEqual({ markAsRead: true, timeout: 2000 }); + expect(calls[0]).toEqual({ markAsRead: true, timeout: 1000 }); }); test("should handle null return from idle() when timeout expires", async ({ @@ -401,8 +401,8 @@ test.describe("idle options (markAsRead and timeout)", () => { expect(calls).toHaveLength(2); // Both calls should have the same default options - expect(calls[0]).toEqual({ markAsRead: true, timeout: 2000 }); - expect(calls[1]).toEqual({ markAsRead: true, timeout: 2000 }); + expect(calls[0]).toEqual({ markAsRead: true, timeout: 1000 }); + expect(calls[1]).toEqual({ markAsRead: true, timeout: 1000 }); }); }); @@ -660,7 +660,7 @@ baseTest.describe("custom idle options via attachAbleDOMMethodsToPage", () => { }); baseTest.expect(opts).toHaveLength(1); - baseTest.expect(opts[0]).toEqual({ markAsRead: false, timeout: 2000 }); + baseTest.expect(opts[0]).toEqual({ markAsRead: false, timeout: 1000 }); }, );