You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document explains how the WebAuthn device deletion test works in the journey suites, where it integrates with the journey app, and how this pattern can be used by other apps
4
+
5
+
## What The Test Does
6
+
7
+
1. A virtual authenticator can register a WebAuthn credential during a journey.
8
+
2. The registered credential can be used to authenticate in a later journey.
9
+
3. The credential id captured from the browser can be passed into the journey app.
10
+
4. The journey app can use that credential id to delete the matching registered device.
11
+
12
+
## Virtual Authenticator Setup In The Test
13
+
14
+
1. Chromium is required for CDP WebAuthn support.
15
+
2. The virtual authenticator is configured as a platform authenticator.
16
+
3. Resident key and user verification are enabled.
17
+
4. Presence and verification are automatically simulated for repeatable automation.
18
+
19
+
## Journey Prereqs
20
+
21
+
The journeys used here are `TEST_WebAuthn-Registration` and `TEST_WebAuthnAuthentication`. To use the registration journey, a user must already exist. The user logs in, and then regsiteres a platform authenticator. Autthentication journey logs the user in based on their biometrics and does not require a username or password.
22
+
23
+
## Test Flow
24
+
25
+
The test is organized with `test.step(...)` so each phase shows what artifact it produces for the next phase.
26
+
27
+
### 1. Register a WebAuthn device and capture the device credential id
28
+
29
+
The test starts with an empty virtual authenticator and then drives the registration journey:
30
+
31
+
1. Navigate to `TEST_WebAuthn-Registration`.
32
+
2. Fill username and password.
33
+
3. Submit the form.
34
+
4. Wait for a successful post-login state.
35
+
5. Read credentials from the virtual authenticator through CDP.
36
+
37
+
The important artifact from this step is the registered credential id. The test converts it to base64url because that is the form used when passing the id through the URL.
38
+
39
+
### 2. Pass the registered credential id into the journey-app integration
40
+
41
+
The next step updates the current URL with the `webauthnCredentialId` query parameter and switches the journey to `TEST_WebAuthnAuthentication`.
42
+
43
+
This is the integration between the test and the journey app:
44
+
45
+
1. The browser creates the credential.
46
+
2. The test captures the credential id.
47
+
3. The journey app later reads that credential id from the query param when deleting a device.
48
+
49
+
### 3. Authenticate with the registered WebAuthn device
50
+
51
+
The test logs out, navigates to the authentication journey, and signs in again to prove that the newly registered WebAuthn credential is valid.
52
+
53
+
Authentication depends on the registered WebAuthn credential being present in the browser's virtual authenticator. It does not depend on the `webauthnCredentialId` query parameter.
54
+
55
+
### 4. Delete the registered device through the journey-app integration
56
+
57
+
After authentication succeeds, the test clicks the delete button rendered by the journey app and waits for the status message.
58
+
59
+
The assertion checks that the status message for deleted device contains the same credential id captured from the virtual authenticator. That confirms the deletion flow acted on the same device that the browser originally registered.
60
+
61
+
## App Integration Points
62
+
63
+
1. The app accepts the credential id.
64
+
2. The app resolves the signed-in user.
65
+
3. The app finds and deletes the matching device using device-client API.
66
+
4. What success UI the app renders after deletion.
67
+
68
+
## Testing Pattern
69
+
70
+
1. The underlying pattern here is credential id based webauthn validation. Virtual authenticator can generate unique credendial ids for each registration, and this helps to easily track the device during deletion.
71
+
2. Credential ids are passed around with query params, which makes it easy to replicate tests without any dependency on external storage.
72
+
3. The test provides freedom to choose how to resolve the uuid depending on the app, so the app can decide whether to retrieve the uuid through OIDC, session, or another way.
73
+
4. The test lets the app decide how to handle app-specific UI, so this pattern is framework agnostic and can be used by any app that supports Playwright, whether it's React, Vue, or Svelte.
0 commit comments