Skip to content

Commit 9d009c9

Browse files
committed
Add max passkeys e2e test.
1 parent 3d6d121 commit 9d009c9

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

src/frontend/tests/e2e-playwright/dashboard/addPasskeys.spec.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ test("User can log into the dashboard and add a new passkey from the same device
3838
await page.getByRole("link", { name: "Access methods" }).click();
3939

4040
// Verify we have one passkey and rename it
41-
await expect(page.getByText("Chrome")).toHaveCount(1);
41+
await expect(
42+
page.getByRole("listitem").filter({ hasText: "Passkey" }),
43+
).toHaveCount(1);
4244
await renamePasskey(page, "Chrome", "Old passkey");
4345

4446
// Start the "add passkey" flow
@@ -212,7 +214,9 @@ test("User can add a new passkey and use it with cached identity without clearin
212214
await page.getByRole("link", { name: "Access methods" }).click();
213215

214216
// Verify we have one passkey and rename it
215-
await expect(page.getByText("Chrome")).toHaveCount(1);
217+
await expect(
218+
page.getByRole("listitem").filter({ hasText: "Passkey" }),
219+
).toHaveCount(1);
216220
await renamePasskey(page, "Chrome", "Old passkey");
217221

218222
// Start the "add passkey" flow
@@ -262,3 +266,48 @@ test("User can add a new passkey and use it with cached identity without clearin
262266

263267
await newPage.close();
264268
});
269+
270+
test("User can log into the dashboard and up to 7 additional passkeys", async ({
271+
page,
272+
context,
273+
}) => {
274+
const auth = dummyAuth();
275+
await page.goto(II_URL);
276+
await page.getByRole("link", { name: "Manage Identity" }).click();
277+
await createNewIdentityInII(page, TEST_USER_NAME, auth);
278+
await page.waitForURL(II_URL + "/manage");
279+
await clearStorage(page);
280+
await page.goto(II_URL);
281+
await page.getByRole("link", { name: "Manage Identity" }).click();
282+
await page.getByRole("button", { name: "Continue with passkey" }).click();
283+
auth(page);
284+
await page.getByRole("button", { name: "Use existing identity" }).click();
285+
286+
// Verify we're at the dashboard
287+
await page.waitForURL(II_URL + "/manage");
288+
289+
// Navigate to access methods
290+
const menuButton = page.getByRole("button", { name: "Open menu" });
291+
if (await menuButton.isVisible()) {
292+
await menuButton.click();
293+
}
294+
await page.getByRole("link", { name: "Access methods" }).click();
295+
296+
// Verify we have one passkey
297+
await expect(
298+
page.getByRole("listitem").filter({ hasText: "Passkey" }),
299+
).toHaveCount(1);
300+
301+
// Add 7 more passkeys
302+
for (let i = 0; i < 7; i++) {
303+
await addPasskeyCurrentDevice(page, dummyAuth);
304+
}
305+
306+
// Verify we have 8 passkeys
307+
await expect(
308+
page.getByRole("listitem").filter({ hasText: "Passkey" }),
309+
).toHaveCount(8);
310+
311+
// Verify we cannot add more passkeys
312+
await expect(page.getByRole("button", { name: "Add new" })).toBeDisabled();
313+
});

0 commit comments

Comments
 (0)