Sign in with an SMS code
An existing user enters their phone number, asks for a one-time SMS code instead of their password, and signs in with the code.
Sub-features
completereaches the SMS code screen for a test user who has a phone and a password, through the password screen andUse another method, stays on it, types424242, and lands signed in on the home.
How to get to it (user POV)
- Tap
Sign inon the home, tapUse phone number, type the number, tap Continue. A user with a password sees "Enter password" first. TapUse another method, thenSend SMS code to <number>.
Driving it with verify
Preconditions:
The spec seeds a
+clerk_testuser withhost.seedUser({ phone: true, password: true })on the standard instance and launches on the home. It never types the password.Request code. Run
e2e-tests/bin/control-clerk-android run sign-in-phone-code/complete. It expectsSigned outon the home, tapse2e.auth.signIn, and expectsclerk.auth.start.identifierandclerk.auth.start.continue. It tapsclerk.auth.start.identifierSwitcher, fillsclerk.auth.start.phoneNumberwith the ten digits of the user's phone, tapsclerk.auth.start.continue, and expectsclerk.auth.signIn.password. It tapsclerk.auth.signIn.useAnotherMethod, expects and tapsclerk.auth.signIn.alternativeMethod.phone_code, and expectsclerk.auth.signIn.code, still on screen 3 seconds later, with "Check your phone" and the user's phone number on the code screen. Screenshotsauth-start,password-screen,methods, andphone-code-screen.Complete. After the code screen it fills
CLERK_TEST_CODEand waits for the home to showSigned in asthe seeded user's email with that user's ID. The AuthView is the one the home's button opens, and the home closes it only inonAuthComplete, inonDismiss, or on back. The spec neither closes it nor presses back, so reaching the home proves thatonAuthCompleteran. Screenshotsigned-in-with-phone-code.Proof. The spec passes, and screenshot
signed-in-with-phone-codeshows the home with the seeded user's email and ID.
Gotchas
clerk.auth.start.phoneNumberformats as you type and shows+1 201-555-01xx. Fill it with ten digits,nationalDigits(user.phone!)fromspecs/phone.ts.host.fillcompares only the letters and digits, and accepts a field that shows the typed digits inside more, such as the1of+1. The code screen shows the number, and the spec checks it there.- The code screen shows the number unformatted, as
+120155501xx, so the spec matchesuser.phoneas it is. - "Check your phone" has no test tag, so that check uses text.