Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add wait for debounce to browser extension tests

Leendert de Borst9396a1b0c33a
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/auth/AuthSettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/auth/AuthSettings.tsx
index c748bbe45..dc40940d6 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/auth/AuthSettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/auth/AuthSettings.tsx
@@ -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]);
/**
diff --git a/apps/browser-extension/tests/fixtures/TestClient.ts b/apps/browser-extension/tests/fixtures/TestClient.ts
index 0347c4c23..0daa6cbf2 100644
--- a/apps/browser-extension/tests/fixtures/TestClient.ts
+++ b/apps/browser-extension/tests/fixtures/TestClient.ts
@@ -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;
diff --git a/apps/browser-extension/tests/fixtures/fixtures.ts b/apps/browser-extension/tests/fixtures/fixtures.ts
index 509edadaf..1f75c5755 100644
--- a/apps/browser-extension/tests/fixtures/fixtures.ts
+++ b/apps/browser-extension/tests/fixtures/fixtures.ts
@@ -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');
diff --git a/apps/browser-extension/tests/fixtures/waits.ts b/apps/browser-extension/tests/fixtures/waits.ts
index 806395c62..1dac9a3b8 100644
--- a/apps/browser-extension/tests/fixtures/waits.ts
+++ b/apps/browser-extension/tests/fixtures/waits.ts
@@ -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;
/**
diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/BrowserExtensionPlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/BrowserExtensionPlaywrightTest.cs
index cfbc10b87..8e2712e9d 100644
--- a/apps/server/Tests/AliasVault.E2ETests/Common/BrowserExtensionPlaywrightTest.cs
+++ b/apps/server/Tests/AliasVault.E2ETests/Common/BrowserExtensionPlaywrightTest.cs
@@ -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']");