Test: TS-07 returning user with existing display_name skips set-name

Inverse coverage for the auth path: TS-01..TS-06 all wipe the customer
row (drop_customer=true) so every OTP path lands on the new-user
set-name branch. TS-07 instead seeds an existing identified customer
(phone + display_name + is_anonymous=false) and verifies the OTP
sign-in returns the existing row unchanged via
resolveCustomerForIdentity branch 1, so /auth/set-name is never shown.

Adds:
* /internal/_test/seed-customer endpoint — upserts a customer with
  phone + display_name + is_anonymous=false.
* client_app/.maestro/scripts/seed_customer.js helper.
* client_app/.maestro/flows/ts-07_returning_existing_name_skips_setname.yaml.
* TS-07 scenario doc + coverage-map row in
  requirement/phase4-customer-flow.md.

The flow asserts the "halo, <name>" greeting on the returning-user home
variant (identified users always land on _SHomeReturningView regardless
of chat history) plus an explicit notVisible on "Siapa namamu" as a
belt-and-braces check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-17 20:50:40 +08:00
parent e09f76ceb6
commit 93fa5f113a
4 changed files with 198 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
// Upsert a customer row with TEST_PHONE + DISPLAY_NAME via the dev-only
// /internal/_test/seed-customer endpoint. Used by TS-07 to set up the
// "returning user already has a name" precondition, so the OTP sign-in
// path can verify the set-name screen is skipped for existing identified
// customers.
const phone = TEST_PHONE
const displayName = DISPLAY_NAME
const url = BACKEND_INTERNAL_URL || 'http://localhost:3001'
if (!phone) throw new Error('TEST_PHONE env not set')
if (!displayName) throw new Error('DISPLAY_NAME env not set')
const resp = http.post(`${url}/internal/_test/seed-customer`, {
body: JSON.stringify({ phone, display_name: displayName }),
headers: { 'Content-Type': 'application/json' },
})
if (resp.status !== 200) {
throw new Error(`seed-customer failed (${resp.status}): ${resp.body}`)
}
const data = json(resp.body)
output.CUSTOMER_ID = data.id
output.CUSTOMER_DISPLAY_NAME = data.display_name