Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-2284: Fix failing patient registration test #763

Merged
merged 12 commits into from
Aug 7, 2023
4 changes: 2 additions & 2 deletions e2e/commands/patient-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export const generateRandomPatient = async (api: APIRequestContext): Promise<Pat
},
],
attributes: [],
birthdate: '2020-2-1',
birthdateEstimated: true,
birthdate: '2020-02-01',
birthdateEstimated: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. If we use birthdayEstimated as true, it will take the patient as a "patient with an unknown birthdate". So when we go to the edit patient page, it will automatically use the "Birthdate unknown" option.

image

(That change was added with 7dbf922. And the tests were failing after that)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS While it may not matter much, it's less ambiguous (and more likely to work everywhere) if we stick to ISO 8601 for dates, i.e., 2020-02-01.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's right. I changed the date format.

dead: false,
gender: 'M',
names: [
Expand Down
6 changes: 5 additions & 1 deletion e2e/pages/registration-and-edit-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page } from '@playwright/test';
import { Locator, Page, expect } from '@playwright/test';

export type PatientRegistrationSex = 'male' | 'female' | 'other' | 'unknown';

Expand Down Expand Up @@ -40,6 +40,10 @@ export class RegistrationAndEditPage {
await this.page.goto(editPatientUuid ? `patient/${editPatientUuid}/edit` : 'patient-registration');
}

async waitUntilTheFormIsLoaded() {
await expect(this.createPatientButton()).toBeEnabled();
}

async fillPatientRegistrationForm(formValues: PatientRegistrationFormValues) {
const tryFill = (locator: Locator, value?: string) => value && locator.fill(value);
formValues.sex && (await this.sexRadioButton(formValues.sex).check());
Expand Down
1 change: 1 addition & 0 deletions e2e/specs/edit-patient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test('Edit a patient', async ({ page, api }) => {

await test.step("When I visit the registration page to a patient's details", async () => {
await patientEditPage.goto(patient.uuid);
await patientEditPage.waitUntilTheFormIsLoaded();
});

await test.step('And then I click on fill new values into the registration form and then click the `Submit` button', async () => {
Expand Down
1 change: 1 addition & 0 deletions e2e/specs/register-new-patient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test('Register a new patient', async ({ page, api }) => {

await test.step('When I visit the registration page', async () => {
await patientRegistrationPage.goto();
await patientRegistrationPage.waitUntilTheFormIsLoaded();
});

await test.step('And then I click on fill new values into the registration form and then click the `Submit` button', async () => {
Expand Down
Loading