QA sign-in
Let the QA agent sign in to your preview so it can verify pages behind a login.
Overview
QA verifies your acceptance criteria on the deployed preview, in a real browser. In most apps, most pages are behind a login, and QA cannot guess how your login works. You give QA the sign-in steps in ship.yml.
If ship.yml has no sign-in, QA still checks every page that it can open while signed out. QA marks a criterion that needs a signed-in page as unverifiable, and gives the reason: it had no way to sign in. QA never tries a sign-in method of its own.
Configuration
Add a qa.signIn block to the ship.yml at the root of your repository:
version: 1
qa:
signIn:
path: /login
steps: >-
Enter operator@riverbank.studio in the Email field and press
"Send magic link". The demo signs you straight in.| Field | What it is |
|---|---|
path | The sign-in page, relative to the address of the preview. It must start with a single / and contain no backslashes or spaces, so it can only point to your preview. |
steps | What to do on that page, in plain words. QA does the steps with normal browser actions (it types and clicks) in the same recorded session that it keeps as proof. The maximum is 2,000 characters. |
account.seededIn | Optional. The name of a preview datastore that seeds the account from your fixtures. See A seeded test account. |
readyTimeoutSec | Optional. How many seconds QA waits for the sign-in page to load on a new preview. The default is 180, and the range is 10 to 600. |
QA opens the page and follows your steps. Before QA captures proof, it makes sure that it is signed in. QA does not try a different way.
What it's for
Use it for a sign-in that needs no secret, for example:
- a demo login
- a magic-link stub that signs you in immediately
- a seeded test account with a fixture password
Do not put a real password or token in steps. Everything in ship.yml goes into your repository, and the agent sees all of it. SHIP does not support sign-ins that need a secret, SSO or MFA yet.
A seeded test account
Your preview can create its own database for each pull request (see Deployments). When that database is seeded from your fixtures, it can hold a test account with a fixture password. That password opens only the preview database, so it is safe to commit. Name the datastore in account.seededIn, and SHIP refuses the file if no datastore has that name:
version: 1
qa:
signIn:
path: /auth/signin
account:
seededIn: db
steps: |
Fill the email field with qa@preview.example.invalid.
Fill the password field with the fixture password.
Press the Sign in button.Use a fixture password only for an account that exists in the seeded database and nowhere else.
When the sign-in does not work
A new preview can need some time before its pages load. QA first waits for the sign-in page, up to readyTimeoutSec. Then QA uses the last answer that it got:
- If the page loads, QA follows your steps.
- If the preview does not answer, QA tests on a local copy of your change. The
qaSurfaceblock inship.ymlsets how SHIP builds and serves that copy. - If the page returns a server error from your app, QA reports it as a defect in the change. The criteria behind the login fail.
If the page loads but your steps do not sign QA in, QA marks the criteria behind the login as unverifiable. When ship.yml has a qaSurface block, QA then checks those criteria again on a local copy of your change. A pass there counts as a pass. The QA report and the pull request comment say that QA did not sign in to the deployed preview. To keep QA on the preview, set qaSurface.onPreviewSignInBlocked to unverifiable.
When QA cannot check a criterion
Sometimes QA fails only because it could not check some criteria. A code change cannot fix that, so SHIP does not send the change back to the Builder. The mission stops at the QA checkpoint and waits for you. Check the criteria another way, then give one of these answers:
- Accept: QA counts as passed, and the mission continues.
- Reject: the mission ends as failed.
- Re-run QA: QA checks the same commit again, for example after you fix the preview.
You can answer in the console, with ship mission qa-checkpoint, or through the API. The mission waits until you answer.
Where it's read from
SHIP reads qa.signIn from your base branch, not from the pull request that QA tests. Because of this, a pull request cannot change how QA signs in to test it. A change to the block applies to missions after the change merges.
How is this page?