Description
Current situation
The ClerkSignInPanel and ClerkSignUpPanel tests live under packages/clerk_flutter/test/integration/, but they run with flutter_test against mocked services rather than on a device, so they are widget tests by Flutter's definition. With Patrol now covering true end-to-end flows (#410, #412), the folder name no longer reflects what they do.
They also assert less than they appear to: both panels build an empty widget when no Environment is available, and the test mocks only supply a Client. As a result the tests can only verify that the panel widgets themselves are present in the tree — no form fields or buttons render beneath them — so rendering regressions in either panel would go unnoticed.
Smaller related points:
- Several tests cover the same password-factor scenario (e.g.
'complete sign in flow with email and password', 'sign in flow with password factor' and 'Email and password').
- Test names describe multi-step flows (enter text, tap continue) that the tests don't perform, and group naming is inconsistent with the unit tests under
test/unit/widgets/.
Proposal
- Add a
createTestEnvironment() helper to test_support so tests can supply a mocked Environment (ClerkSignUpPanel renders based on env.user.attributes; ClerkSignInPanel requires a non-empty env.config.identificationStrategies), and let createTestAuthState() accept it.
- Move the tests to
test/widgets/, one file per widget under test.
- Have each test assert on the UI it renders (form fields, strategy buttons) rather than only the panel's presence.
- Consolidate duplicate scenarios and align naming with the existing unit tests (groups named for the widget, behaviour-statement test names like
renders X when Y).
Description
Current situation
The
ClerkSignInPanelandClerkSignUpPaneltests live underpackages/clerk_flutter/test/integration/, but they run withflutter_testagainst mocked services rather than on a device, so they are widget tests by Flutter's definition. With Patrol now covering true end-to-end flows (#410, #412), the folder name no longer reflects what they do.They also assert less than they appear to: both panels build an empty widget when no
Environmentis available, and the test mocks only supply aClient. As a result the tests can only verify that the panel widgets themselves are present in the tree — no form fields or buttons render beneath them — so rendering regressions in either panel would go unnoticed.Smaller related points:
'complete sign in flow with email and password','sign in flow with password factor'and'Email and password').test/unit/widgets/.Proposal
createTestEnvironment()helper totest_supportso tests can supply a mockedEnvironment(ClerkSignUpPanelrenders based onenv.user.attributes;ClerkSignInPanelrequires a non-emptyenv.config.identificationStrategies), and letcreateTestAuthState()accept it.test/widgets/, one file per widget under test.renders X when Y).