Skip to content

Commit a4bf5b0

Browse files
committed
test: add content check for session form
1 parent 1632515 commit a4bf5b0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ test.describe('start session', () => {
1313
await startSessionPage.sessionForm.waitFor({ state: 'visible' });
1414
const formType = startSessionPage.sessionForm.getByTestId('subjectIdentificationMethod-select-trigger');
1515
await formType.click();
16-
await formType.getByRole('option', { name: 'Personal Information' }).click();
16+
17+
await startSessionPage.selectIdentificationMethod('PERSONAL_INFO');
1718

1819
// await startSessionPage.selectIdentificationMethod('Personal Information')
1920
await expect(formType).toHaveText('Personal Information');

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ import { AppPage } from './_app.page';
44

55
export class StartSessionPage extends AppPage {
66
readonly pageHeader: Locator;
7+
readonly selectField: Locator;
78
readonly sessionForm: Locator;
89

910
constructor(page: Page) {
1011
super(page);
1112
this.pageHeader = page.getByTestId('page-header');
1213
this.sessionForm = page.getByTestId('start-session-form');
14+
this.selectField = page.locator('[name="subjectIdentificationMethod"]');
1315
}
1416

1517
async fillSessionForm(firstName: string) {
1618
await this.sessionForm.getByLabel('subjectId').fill(firstName);
1719
}
1820

1921
async selectIdentificationMethod(methodName: string) {
20-
const methodTrigger = this.sessionForm.getByRole('combobox', { name: /identification method/i });
21-
await methodTrigger.click();
22-
// The options are usually rendered in a portal at the end of the body
23-
await methodTrigger.getByRole('option', { name: methodName }).click();
22+
await this.selectField.selectOption(methodName);
2423
}
2524
}

0 commit comments

Comments
 (0)