fix: improve link click handling to wait for networkidle
Pull Request / unit-tests (pull_request) Failing after 1m15s
Pull Request / e2e-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped

This ensures proper navigation waits for links that trigger client-side routing
This commit is contained in:
2026-05-01 16:47:34 -07:00
parent 88203869d5
commit e6b41f65a5
+5 -15
View File
@@ -180,28 +180,18 @@ When('I click the {string} link', async function (linkText: string) {
const selector = `a:has-text("${linkText}")`;
console.log(`🌍 Clicking link: ${linkText}`);
// Get current URL
const currentUrl = world.page.url();
// Click the link
await world.page.click(selector);
// Wait a bit for navigation to start
await world.page.waitForTimeout(500);
// Check if URL changed
const newUrl = world.page.url();
if (newUrl === currentUrl) {
console.log(`🌍 URL did not change immediately after link click`);
// Wait for any navigation to complete
// Wait for navigation to complete
try {
await world.page.waitForLoadState('domcontentloaded', { timeout: 5000 });
await world.page.waitForLoadState('networkidle', { timeout: 10000 });
} catch {
console.log(`🌍 DOMContentLoaded not reached, continuing`);
console.log(`🌍 Networkidle not reached, continuing`);
}
} else {
const newUrl = world.page.url();
console.log(`🌍 Page navigated to: ${newUrl}`);
}
});
When('I click the {string} wordmark', async function (wordmarkText: string) {