Skip to content

Commit ed9047b

Browse files
committed
test: Requested changes
1 parent ec89730 commit ed9047b

12 files changed

+327
-113
lines changed

e2e/commands/patient-operations.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,12 @@
11
import { type APIRequestContext, expect } from '@playwright/test';
2-
3-
export interface Patient {
4-
uuid: string;
5-
identifiers: Identifier[];
6-
display: string;
7-
person: {
8-
uuid: string;
9-
display: string;
10-
gender: string;
11-
age: number;
12-
birthdate: string;
13-
birthdateEstimated: boolean;
14-
dead: boolean;
15-
deathDate?: string;
16-
causeOfDeath?: string;
17-
preferredAddress: {
18-
address1: string;
19-
cityVillage: string;
20-
country: string;
21-
postalCode: string;
22-
stateProvince: string;
23-
countyDistrict: string;
24-
};
25-
attributes: Array<Record<string, unknown>>;
26-
voided: boolean;
27-
birthtime?: string;
28-
deathdateEstimated: boolean;
29-
resourceVersion: string;
30-
};
31-
attributes: { value: string; attributeType: { uuid: string; display: string } }[];
32-
voided: boolean;
33-
}
34-
35-
export interface Identifier {
36-
uuid: string;
37-
display: string;
38-
}
2+
import type { Patient } from '../types';
393

404
export const generateRandomPatient = async (api: APIRequestContext): Promise<Patient> => {
415
const identifierRes = await api.post('idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier', {
426
data: {},
437
});
448
await expect(identifierRes.ok()).toBeTruthy();
45-
9+
4610
const { identifier } = await identifierRes.json();
4711

4812
const patientRes = await api.post('patient', {

e2e/pages/home-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { type Page } from '@playwright/test';
22

33
export class HomePage {
44
constructor(readonly page: Page) {}
5+
readonly helpButton = () => this.page.locator('button[aria-controls="help-menu-popup"]');
56
readonly nextButton = () => this.page.getByRole('button', { name: 'Next', exact: true });
67
readonly finishButton = () => this.page.getByRole('button', { name: 'Last' });
78

e2e/specs/basic-overview.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ test('Basic overview tutorial', async ({ page }) => {
1010
});
1111

1212
await test.step('And I click the `Help` button', async () => {
13-
await page
14-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
15-
.getByRole('button')
16-
.click();
13+
await homePage.helpButton().click();
1714
});
1815

1916
await test.step('And I click the `Tutorials` button', async () => {
@@ -44,7 +41,7 @@ test('Basic overview tutorial', async ({ page }) => {
4441
});
4542

4643
await test.step('And I click the `Next` button', async () => {
47-
await homePage.nextButton().click({ force: true });
44+
await homePage.nextButton().click();
4845
});
4946

5047
await test.step('Then I should see the second tooltip', async () => {

e2e/specs/demo-tutorial.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ test('Demo tutorial', async ({ page }) => {
1010
});
1111

1212
await test.step('And I click the `Help` button', async () => {
13-
await page
14-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
15-
.getByRole('button')
16-
.click();
13+
await homePage.helpButton().click();
1714
});
1815

1916
await test.step('And I click the `Tutorials` button', async () => {

e2e/specs/find-patient.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ test('Finding a patient tutorial', async ({ page }) => {
1818
});
1919

2020
await test.step('And I click the `Help` button', async () => {
21-
await page
22-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
23-
.getByRole('button')
24-
.click();
21+
await homePage.helpButton().click();
2522
});
2623

2724
await test.step('And I click the `Tutorials` button', async () => {

e2e/specs/patient-chart.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ test('Patient chart tutorial', async ({ page }) => {
1818
});
1919

2020
await test.step('And I click the `Help` button', async () => {
21-
await page
22-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
23-
.getByRole('button')
24-
.click();
21+
await homePage.helpButton().click();
2522
});
2623

2724
await test.step('And I click the `Tutorials` button', async () => {

e2e/specs/record-vitals.spec.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect } from '@playwright/test';
22
import { type Visit } from '@openmrs/esm-framework';
3-
import { generateRandomPatient, deletePatient, type Patient, startVisit, endVisit } from '../commands';
3+
import { generateRandomPatient, deletePatient, startVisit, endVisit } from '../commands';
4+
import { type Patient } from '../types';
45
import { HomePage } from '../pages';
56
import { test } from '../core';
67

@@ -20,10 +21,7 @@ test('Recording vitals tutorial', async ({ page }) => {
2021
});
2122

2223
await test.step('And I click the `Help` button', async () => {
23-
await page
24-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
25-
.getByRole('button')
26-
.click();
24+
await homePage.helpButton().click();
2725
});
2826

2927
await test.step('And I click the `Tutorials` button', async () => {
@@ -97,31 +95,13 @@ test('Recording vitals tutorial', async ({ page }) => {
9795
await expect(page.getByRole('heading', { name: /vitals form/i, level: 4 })).toBeVisible();
9896
});
9997

100-
await test.step('When I fill `37` as the temperature', async () => {
98+
await test.step('And I fill in the Vitals form', async () => {
10199
await page.getByRole('spinbutton', { name: /temperature/i }).fill('37');
102-
});
103-
104-
await test.step('And I fill `120` as the systolic', async () => {
105100
await page.getByRole('spinbutton', { name: /systolic/i }).fill('120');
106-
});
107-
108-
await test.step('And I fill `100` as the diastolic', async () => {
109101
await page.getByRole('spinbutton', { name: /diastolic/i }).fill('100');
110-
});
111-
112-
await test.step('And I fill `65` as the pulse', async () => {
113102
await page.getByRole('spinbutton', { name: /pulse/i }).fill('65');
114-
});
115-
116-
await test.step('And I fill `16` as the respiration rate', async () => {
117103
await page.getByRole('spinbutton', { name: /respiration rate/i }).fill('16');
118-
});
119-
120-
await test.step('And I fill `98` as the oxygen saturation', async () => {
121104
await page.getByRole('spinbutton', { name: /oxygen saturation/i }).fill('98');
122-
});
123-
124-
await test.step('And I add additional notes', async () => {
125105
await page.getByPlaceholder(/type any additional notes here/i).fill('Test notes');
126106
});
127107

e2e/specs/register-patient.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ test('Registering a patient tutorial', async ({ page }) => {
1010
});
1111

1212
await test.step('And I click the `Help` button', async () => {
13-
await page
14-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
15-
.getByRole('button')
16-
.click();
13+
await homePage.helpButton().click();
1714
});
1815

1916
await test.step('And I click the `Tutorials` button', async () => {

e2e/specs/start-patient-visit.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ test('Starting a patient visit tutorial', async ({ page }) => {
1818
});
1919

2020
await test.step('And I click the `Help` button', async () => {
21-
await page
22-
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
23-
.getByRole('button')
24-
.click();
21+
await homePage.helpButton().click();
2522
});
2623

2724
await test.step('And I click the `Tutorials` button', async () => {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
"rxjs": "6.x"
5454
},
5555
"devDependencies": {
56-
"@openmrs/esm-framework": "^6.2.1-pre.2752",
56+
"@openmrs/esm-framework": "next",
5757
"@openmrs/esm-styleguide": "next",
58-
"@playwright/test": "1.44.0",
58+
"@playwright/test": "^1.50.1",
5959
"@swc/cli": "^0.3.12",
6060
"@swc/core": "^1.3.68",
6161
"@swc/jest": "^0.2.36",

0 commit comments

Comments
 (0)