Skip to content

Commit 301f790

Browse files
committed
add test to fill in lastname and dob to session form
1 parent 5c2b5d6 commit 301f790

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

testing/e2e/src/2.3-start-session.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,18 @@ test.describe('start session', () => {
1616

1717
// Verify the selection was made
1818
await expect(startSessionPage.selectField).toHaveValue('PERSONAL_INFO');
19+
20+
// Fill the subject first name field
21+
await startSessionPage.fillSessionForm('firstNameTest', 'lastNameTest');
22+
23+
// Verify the field was filled
24+
const firstNameField = startSessionPage.sessionForm.locator('[name="subjectFirstName"]');
25+
await expect(firstNameField).toHaveValue('firstNameTest');
26+
27+
const lastNameField = startSessionPage.sessionForm.locator('[name="subjectLastName"]');
28+
await expect(lastNameField).toHaveValue('lastNameTest');
29+
30+
const dobField = startSessionPage.sessionForm.locator('[name="subjectDateOfBirth"]');
31+
await expect(dobField).toHaveValue('01-01-1990');
1932
});
2033
});

testing/e2e/src/pages/start-session.page.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ export class StartSessionPage extends AppPage {
1414
this.selectField = page.locator('[name="subjectIdentificationMethod"]');
1515
}
1616

17-
async fillSessionForm(firstName: string) {
18-
await this.sessionForm.getByLabel('subjectId').fill(firstName);
17+
async fillSessionForm(firstName: string, lastName: string) {
18+
// Wait for the subjectFirstName field to appear after selecting PERSONAL_INFO
19+
const firstNameField = this.sessionForm.locator('[name="subjectFirstName"]');
20+
const lastNameField = this.sessionForm.locator('[name="subjectLastName"]');
21+
const dateOfBirthField = this.sessionForm.locator('[name="subjectDateOfBirth"]');
22+
await firstNameField.waitFor({ state: 'visible' });
23+
await firstNameField.fill(firstName);
24+
25+
await lastNameField.waitFor({ state: 'visible' });
26+
await lastNameField.fill(lastName);
27+
28+
await dateOfBirthField.waitFor({ state: 'visible' });
29+
await dateOfBirthField.fill('01-01-1990');
1930
}
2031

2132
async selectIdentificationMethod(methodName: string) {

0 commit comments

Comments
 (0)