Repository navigation
test(examples): add end-to-end test for the passkeys example - #1623
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a Flutter integration test for the passkeys example. The test initializes Supabase from Dart environment variables, creates a unique account, verifies the passkey management screen, signs out, checks incorrect-password handling, and signs back in successfully. A polling helper waits for network-driven UI states. The README documents manual WebAuthn prompt handling and provides a local-stack test command. The Sequence Diagram(s)sequenceDiagram
participant IntegrationTest
participant PasskeysExampleApp
participant LocalSupabase
IntegrationTest->>PasskeysExampleApp: Create account
PasskeysExampleApp->>LocalSupabase: Authenticate account
LocalSupabase-->>PasskeysExampleApp: Return authentication result
IntegrationTest->>PasskeysExampleApp: Verify passkey screen
IntegrationTest->>PasskeysExampleApp: Sign out
PasskeysExampleApp->>LocalSupabase: End session
IntegrationTest->>PasskeysExampleApp: Try incorrect password
PasskeysExampleApp->>LocalSupabase: Attempt authentication
LocalSupabase-->>PasskeysExampleApp: Return authentication error
IntegrationTest->>PasskeysExampleApp: Sign in with correct password
PasskeysExampleApp->>LocalSupabase: Authenticate account
LocalSupabase-->>PasskeysExampleApp: Return authentication result
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## What Adds an end-to-end integration test for the `passkeys` example, matching the ones added for `realtime_room` and `database_crud`. It drives the actual app widgets against the local Supabase stack. ## The test `integration_test/passkeys_test.dart` uses `testWidgets` to: 1. Pump `PasskeyExampleApp`, create an account and land on the passkey management screen (a fresh account shows "No passkeys yet." and the "Register a passkey" button). 2. Sign out and assert the sign-in screen returns. 3. Attempt a wrong password and assert an error surfaces instead of signing in. 4. Sign in with the correct password and assert the signed-in screen returns. ### Scope The WebAuthn ceremony itself (`registerPasskey` / `signInWithPasskey`) drives a platform authenticator prompt (Face ID, Windows Hello, a security key, ...) that cannot be automated headlessly, so it is exercised manually per the README rather than in this test. The test covers everything around the ceremony: account creation, the passkey-list screen, session management and password sign-in error handling. A small `_pumpUntil` helper polls the widget tree (auth calls are async over the network, so the UI can't be `pumpAndSettle`d). Each run uses a unique email so sign up never collides with an existing user. Also adds the `integration_test` dev dependency and an "Integration test" section to the example README. ## Testing - `flutter analyze`: no issues; `dart format`: clean. - Ran end to end against a local stack, twice, both green. Integration tests need a device, so run it with `-d macos`, an emulator or a real device.
What
Adds an end-to-end integration test for the
passkeysexample, matching the ones added forrealtime_roomanddatabase_crud. It drives the actual app widgets against the local Supabase stack.The test
integration_test/passkeys_test.dartusestestWidgetsto:PasskeyExampleApp, create an account and land on the passkey management screen (a fresh account shows "No passkeys yet." and the "Register a passkey" button).Scope
The WebAuthn ceremony itself (
registerPasskey/signInWithPasskey) drives a platform authenticator prompt (Face ID, Windows Hello, a security key, ...) that cannot be automated headlessly, so it is exercised manually per the README rather than in this test. The test covers everything around the ceremony: account creation, the passkey-list screen, session management and password sign-in error handling.A small
_pumpUntilhelper polls the widget tree (auth calls are async over the network, so the UI can't bepumpAndSettled). Each run uses a unique email so sign up never collides with an existing user.Also adds the
integration_testdev dependency and an "Integration test" section to the example README.Testing
flutter analyze: no issues;dart format: clean.-d macos, an emulator or a real device.