mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix(e2e): add polling for window.ng to prevent intermittent test failures
The plugin-feature-check test was failing intermittently because window.ng might not be available immediately after Angular bootstrap. Added polling logic (5s timeout, 100ms intervals) to wait for window.ng to become available.
This commit is contained in:
parent
1421151724
commit
05bfd96e55
1 changed files with 17 additions and 3 deletions
|
|
@ -5,9 +5,23 @@ test.describe.serial('Plugin Feature Check', () => {
|
|||
// Wait for work view to be ready
|
||||
await workViewPage.waitForTaskList();
|
||||
|
||||
const result = await page.evaluate(() => {
|
||||
// Check if Angular is loaded
|
||||
const hasAngular = !!(window as any).ng;
|
||||
const result = await page.evaluate(async () => {
|
||||
// Poll for window.ng to become available (handles timing issues)
|
||||
const pollForNg = async (): Promise<boolean> => {
|
||||
const maxAttempts = 50; // 5 seconds with 100ms intervals
|
||||
const interval = 100;
|
||||
|
||||
for (let i = 0; i < maxAttempts; i++) {
|
||||
if ((window as any).ng) {
|
||||
return true;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, interval));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Check if Angular is loaded (with polling to handle race conditions)
|
||||
const hasAngular = await pollForNg();
|
||||
|
||||
// Check if PluginService is accessible through Angular's injector
|
||||
let hasPluginService = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue