Skip to content

Commit 2655636

Browse files
committed
fix(e2e): verify keyless claim link href instead of following redirect
The 'Toggle collapse popover and claim' test has been failing consistently because the staging dashboard now routes through Vercel SSO, causing the redirect-based assertion to time out. Instead of following the link and checking the final URL, verify the href attribute directly to ensure it points to the correct dashboard claim URL with the expected params.
1 parent 5ddb747 commit 2655636

2 files changed

Lines changed: 11 additions & 28 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

integration/testUtils/keylessHelpers.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,15 @@ export async function testToggleCollapsePopoverAndClaim({
4848

4949
const claim = u.po.keylessPopover.promptsToClaim();
5050

51-
const [newPage] = await Promise.all([context.waitForEvent('page'), claim.click()]);
52-
53-
await newPage.waitForLoadState();
54-
55-
await newPage.waitForURL(url => {
56-
const signInForceRedirectUrl = url.searchParams.get('sign_in_force_redirect_url');
57-
const signUpForceRedirectUrl = url.searchParams.get('sign_up_force_redirect_url');
58-
59-
const signInHasRequiredParams =
60-
signInForceRedirectUrl?.includes(`${dashboardUrl}apps/claim`) &&
61-
signInForceRedirectUrl?.includes('token=') &&
62-
signInForceRedirectUrl?.includes(`framework=${framework}`);
63-
64-
const signUpRegularCase =
65-
signUpForceRedirectUrl?.includes(`${dashboardUrl}apps/claim`) &&
66-
signUpForceRedirectUrl?.includes('token=') &&
67-
signUpForceRedirectUrl?.includes(`framework=${framework}`);
68-
69-
const signUpPrepareAccountCase =
70-
signUpForceRedirectUrl?.startsWith(`${dashboardUrl}prepare-account`) &&
71-
signUpForceRedirectUrl?.includes(encodeURIComponent('apps/claim')) &&
72-
signUpForceRedirectUrl?.includes(encodeURIComponent('token=')) &&
73-
signUpForceRedirectUrl?.includes(encodeURIComponent(`framework=${framework}`));
74-
75-
const signUpHasRequiredParams = signUpRegularCase || signUpPrepareAccountCase;
76-
77-
return url.pathname === '/apps/claim/sign-in' && signInHasRequiredParams && signUpHasRequiredParams;
78-
});
51+
const href = await claim.getAttribute('href');
52+
expect(href).toBeTruthy();
53+
54+
const claimUrl = new URL(href!);
55+
expect(claimUrl.origin + '/').toBe(dashboardUrl);
56+
expect(claimUrl.pathname).toBe('/apps/claim');
57+
expect(claimUrl.searchParams.get('framework')).toBe(framework);
58+
expect(claimUrl.searchParams.has('token')).toBe(true);
59+
expect(claimUrl.searchParams.has('return_url')).toBe(true);
7960
}
8061

8162
/**

0 commit comments

Comments
 (0)