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:
Johannes Millan 2026-01-21 17:53:40 +01:00
parent 1421151724
commit 05bfd96e55

View file

@ -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;