-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7f8ee0
commit fa0dc8a
Showing
2 changed files
with
54 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { expect, test as setup } from '@playwright/test' | ||
|
||
setup('partial passkey signup', async ({ page }) => { | ||
const client = await page.context().newCDPSession(page) | ||
await client.send('WebAuthn.enable') | ||
const { authenticatorId } = await client.send( | ||
'WebAuthn.addVirtualAuthenticator', | ||
{ | ||
options: { | ||
protocol: 'ctap2', | ||
transport: 'usb', | ||
hasResidentKey: true, | ||
hasUserVerification: true, | ||
isUserVerified: true, | ||
automaticPresenceSimulation: true, | ||
}, | ||
}, | ||
) | ||
|
||
await page.goto('https://webauthn.io/') | ||
await page.getByPlaceholder('example_username').click() | ||
await page.getByPlaceholder('example_username').fill('test_user') | ||
await page.getByRole('button', { name: 'Register' }).click() | ||
|
||
await expect(page.getByText('Success!')).toBeVisible() | ||
|
||
const passkey = await client.send('WebAuthn.getCredentials', { | ||
authenticatorId, | ||
}) | ||
|
||
expect(passkey.credentials).toHaveLength(1) | ||
|
||
let asserted = new Promise<void>((resolve) => { | ||
client.once('WebAuthn.credentialAsserted', () => resolve()) | ||
}) | ||
|
||
await page.getByRole('button', { name: 'Authenticate' }).click() | ||
|
||
await asserted | ||
|
||
await expect(page.getByText("You're logged in!")).toBeVisible() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters