Passkeys
Summary
- In
tests/db-utils.ts, create a new utilitycreatePasskey. It will only be responsible for storing the given passkey correctly in the database (that it belongs to the given user). - Install
test-passkey. We will use it to generate test passkeys faster for tests. - Create a new test at
tests/e2e/authentication-passkeys.test.ts. - Add a test case for successful auth using passkeys. Navigate to
/loginfirst. This is important. - Create a test passkey, create a test user. Use
createPasskeyto store the generated passkey in the database. - Now, we need to tell Playwright how to handle passkeys. In the test, create the
createWebAuthnClientfunction and go step-by-step. - Use the created
createWebAuthnClientfunction to tell the browser how to react to the passkey input prompt (to use our test passkey). - Continue with the login flow. Verify the auth state.
npm run test:e2e.
- Add another test case for the error scenario.
npm run test:e2e.