Skip to content

Commit a59d702

Browse files
committed
fix(e2e): verify keyless claimed keys link href instead of following redirect
Apply the same fix from #8195 to the "claimed app with missing keys" test and the shared testClaimedAppWithMissingKeys helper. These tests clicked the "get keys" link and followed the redirect chain to the dashboard, which timed out because the dashboard redirect URL pattern changed. Now validates the href attribute directly instead.
1 parent 00715a6 commit a59d702

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

integration/testUtils/keylessHelpers.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ export async function testClaimedAppWithMissingKeys({
8383
expect(await u.po.keylessPopover.isExpanded()).toBe(true);
8484
await expect(u.po.keylessPopover.promptToUseClaimedKeys()).toBeVisible();
8585

86-
const [newPage] = await Promise.all([
87-
context.waitForEvent('page'),
88-
u.po.keylessPopover.promptToUseClaimedKeys().click(),
89-
]);
90-
91-
await newPage.waitForLoadState();
92-
await newPage.waitForURL(url => {
93-
return url.href.startsWith(`${dashboardUrl}sign-in?redirect_url=${encodeURIComponent(dashboardUrl)}apps%2Fapp_`);
94-
});
86+
const href = await u.po.keylessPopover.promptToUseClaimedKeys().getAttribute('href');
87+
expect(href).toBeTruthy();
88+
89+
const keysUrl = new URL(href!);
90+
expect(keysUrl.href).toContain(dashboardUrl);
91+
expect(keysUrl.searchParams.has('redirect_url')).toBe(true);
9592
}
9693

9794
/**

integration/tests/next-quickstart-keyless.test.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,12 @@ test.describe('Keyless mode @quickstart', () => {
7272
expect(await u.po.keylessPopover.isExpanded()).toBe(true);
7373
await expect(u.po.keylessPopover.promptToUseClaimedKeys()).toBeVisible();
7474

75-
const [newPage] = await Promise.all([
76-
context.waitForEvent('page'),
77-
u.po.keylessPopover.promptToUseClaimedKeys().click(),
78-
]);
79-
80-
await newPage.waitForLoadState();
81-
await newPage.waitForURL(url => {
82-
return url.href.startsWith(`${dashboardUrl}sign-in?redirect_url=${encodeURIComponent(dashboardUrl)}apps%2Fapp_`);
83-
});
75+
const href = await u.po.keylessPopover.promptToUseClaimedKeys().getAttribute('href');
76+
expect(href).toBeTruthy();
77+
78+
const keysUrl = new URL(href!);
79+
expect(keysUrl.href).toContain(dashboardUrl);
80+
expect(keysUrl.searchParams.has('redirect_url')).toBe(true);
8481
});
8582

8683
test('Claimed application with keys inside .env, on dismiss, keyless prompt is removed.', async ({

0 commit comments

Comments
 (0)