How do I record a checkout when the app needs me logged in first?
Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.
Every recording I make starts on the login page, so the first stretch of the spec is me typing a username and a password. Worse, when I re-record after a change the login part churns too and the diff tells me nothing about the bit I actually changed.
bash
sdods record -p demo-shop -e staging --name checkout
Is there a way to have the recorder open on an already signed-in session?
--user <role>. It takes the first pool user of that role, makes sure there is a fresh storage state for it, and hands that state to codegen, so the browser opens signed in.
bash
sdods record -p demo-shop -e staging --name checkout --user standard
The first time you will watch it log in for you before the window appears:
text
no fresh login state for standard_user; capturing…
recording checkout · project demo-shop · env staging · user standard_user (standard)
After that the state is cached at projects/demo-shop/.auth/staging/standard-0.json and reused until it ages past auth.maxAgeMinutes.
Two things to know. The role has to exist in the user pool dataset, or you get USER_POOL_EXHAUSTED with the roles that are actually present listed in the hint. And if the capture fails, recording does not stop — it warns and carries on logged out:
text
⚠ could not capture login state (strategy returned no storage state); recording without it
which is worth reading, because otherwise you record the login page again and wonder why the spec looks the same as last time.