Add wait for debounce to browser extension tests
This commit is contained in:
@@ -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]);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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']");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user