Add wait for debounce to browser extension tests

This commit is contained in:
Leendert de Borst
2026-01-28 20:17:25 +01:00
parent d99aa41a0c
commit 9396a1b0c3
5 changed files with 18 additions and 2 deletions
@@ -154,7 +154,7 @@ const AuthSettings: React.FC = () => {
await storage.setItem('local:clientUrl', AppInfo.DEFAULT_CLIENT_URL);
}
}
}, 300);
}, 150);
}, [urlSchema]);
/**
@@ -179,7 +179,7 @@ const AuthSettings: React.FC = () => {
setErrors(prev => ({ ...prev, clientUrl: error.message }));
}
}
}, 300);
}, 150);
}, [urlSchema]);
/**
+2
View File
@@ -98,6 +98,8 @@ export class TestClient {
await settingsButton.click();
await this.popup.selectOption('select', ['custom']);
await this.popup.fill('input#custom-api-url', apiUrl);
// Wait for debounce to complete before navigating away (settings use 300ms debounce for storage writes)
await this.popup.waitForTimeout(Timeouts.DEBOUNCE);
await this.popup.click('button#back');
await waitForLoginForm(this.popup);
return this;
+9
View File
@@ -176,6 +176,12 @@ export async function waitForLoggedIn(popup: Page, timeout: number = 30000): Pro
await popup.getByRole('button', { name: 'Vault' }).waitFor({ state: 'visible', timeout });
}
/**
* Debounce wait time for settings that use debounced storage writes (e.g., API URL).
* The extension uses 150ms debounce, we add a small buffer.
*/
const DEBOUNCE_WAIT = 200;
/**
* Helper to configure the extension to use a custom API URL.
*
@@ -193,6 +199,9 @@ export async function configureApiUrl(popup: Page, apiUrl: string): Promise<void
// Fill in the custom URL input
await popup.fill('input#custom-api-url', apiUrl);
// Wait for debounce to complete before navigating away (settings use 300ms debounce for storage writes)
await popup.waitForTimeout(DEBOUNCE_WAIT);
// Go back to main page
await popup.click('button#back');
+2
View File
@@ -16,6 +16,8 @@ export const Timeouts = {
SHORT: 5000,
MEDIUM: 10000,
LONG: 30000,
/** Debounce wait time for settings that use debounced storage writes (e.g., API URL). The extension uses 150ms debounce. */
DEBOUNCE: 200,
} as const;
/**
@@ -97,6 +97,9 @@ public class BrowserExtensionPlaywrightTest : ClientPlaywrightTest
// Fill in the custom URL input that appears
await extensionPopup.FillAsync("input[id='custom-api-url']", ApiBaseUrl);
// Wait for debounce to complete before navigating away (settings use 150ms debounce for storage writes)
await Task.Delay(200);
// Go back to main page
await extensionPopup.ClickAsync("button[id='back']");