Skip to content

Commit 3967fa1

Browse files
committed
test: fill new profile fields in cli-journey e2e
The register step now exposes givenName, familyName, and dateOfBirth. The journey test only filled email/password, so the new fields stayed unexercised. Fill them so the test actually demonstrates the expanded flow.
1 parent 54ebe32 commit 3967fa1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

apps/cli-journey-e2e/src/user-journey.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ async function registerWithPassword(
7979
await advanceUnknownUserToRegistration(page);
8080
await expectRegistrationChoice(page);
8181
await fillEmailIfVisible(page, email);
82+
await fillProfileFieldsIfVisible(page);
8283
await choosePasswordRegistration(page);
8384
await fillPassword(page, password);
8485
await clickSubmit(page);
@@ -104,6 +105,7 @@ async function registerWithPasskey(page: Page, email: string): Promise<void> {
104105
await advanceUnknownUserToRegistration(page);
105106
await expectRegistrationChoice(page);
106107
await fillEmailIfVisible(page, email);
108+
await fillProfileFieldsIfVisible(page);
107109
await clickAction(page, /register.*passkey|passkey.*register|passkey_register/i, [
108110
"passkey_register",
109111
]);
@@ -204,6 +206,23 @@ async function fillEmailIfVisible(page: Page, email: string): Promise<void> {
204206
}
205207
}
206208

209+
async function fillProfileFieldsIfVisible(page: Page): Promise<void> {
210+
await fillFieldIfVisible(page, /given.?name/i, "Ada");
211+
await fillFieldIfVisible(page, /family.?name/i, "Lovelace");
212+
await fillFieldIfVisible(page, /date.?of.?birth/i, "1990-01-15");
213+
}
214+
215+
async function fillFieldIfVisible(
216+
page: Page,
217+
label: RegExp,
218+
value: string,
219+
): Promise<void> {
220+
const field = page.getByLabel(label).first();
221+
if (await field.isVisible().catch(() => false)) {
222+
await field.fill(value);
223+
}
224+
}
225+
207226
async function fillPassword(page: Page, password: string): Promise<void> {
208227
await page.getByLabel(/password/i).first().fill(password);
209228
}

0 commit comments

Comments
 (0)