@openmrs/esm-dispensing-app 1.7.1-pre.238 → 1.7.1-pre.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/cache/95e79aae67c0c3ca-meta.json +1 -0
- package/.turbo/cache/{8e1c24192904ade7.tar.zst → 95e79aae67c0c3ca.tar.zst} +0 -0
- package/.turbo/turbo-build.log +1 -1
- package/dist/routes.json +1 -1
- package/e2e/commands/drug-order-operations.ts +44 -0
- package/e2e/commands/encounter-operations.ts +64 -0
- package/e2e/commands/index.ts +3 -0
- package/e2e/commands/medication-request-operation.ts +97 -0
- package/e2e/commands/provider-operations.ts +12 -0
- package/e2e/commands/types/index.ts +157 -0
- package/e2e/core/test.ts +1 -5
- package/e2e/specs/dispense-medication.spec.ts +65 -0
- package/package.json +1 -1
- package/.turbo/cache/8e1c24192904ade7-meta.json +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"hash":"95e79aae67c0c3ca","duration":41551}
|
|
Binary file
|
package/.turbo/turbo-build.log
CHANGED
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"patient-diagnoses","component":"patientDiagnoses","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"patient-conditions","component":"patientConditions","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}},{"name":"dispense-action-button","slot":"prescription-action-button-slot","component":"dispenseActionButton"},{"name":"pause-action-button","slot":"prescription-action-button-slot","component":"pauseActionButton"},{"name":"close-action-button","slot":"prescription-action-button-slot","component":"closeActionButton"}],"workspaces":[{"name":"close-dispense-workspace","component":"closeDispenseWorkspace","type":"dispense","title":"Close prescription"},{"name":"pause-dispense-workspace","component":"pauseDispenseWorkspace","type":"dispense","title":"Pause prescription"},{"name":"dispense-workspace","component":"dispenseWorkspace","type":"dispense","title":"Dispense prescription","width":"wider"}],"modals":[{"name":"prescription-print-preview-modal","component":"printPrescriptionPreviewModal"},{"name":"delete-confirm-modal","component":"deleteConfirmModal"}],"version":"1.7.1-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"patient-diagnoses","component":"patientDiagnoses","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"patient-conditions","component":"patientConditions","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}},{"name":"dispense-action-button","slot":"prescription-action-button-slot","component":"dispenseActionButton"},{"name":"pause-action-button","slot":"prescription-action-button-slot","component":"pauseActionButton"},{"name":"close-action-button","slot":"prescription-action-button-slot","component":"closeActionButton"}],"workspaces":[{"name":"close-dispense-workspace","component":"closeDispenseWorkspace","type":"dispense","title":"Close prescription"},{"name":"pause-dispense-workspace","component":"pauseDispenseWorkspace","type":"dispense","title":"Pause prescription"},{"name":"dispense-workspace","component":"dispenseWorkspace","type":"dispense","title":"Dispense prescription","width":"wider"}],"modals":[{"name":"prescription-print-preview-modal","component":"printPrescriptionPreviewModal"},{"name":"delete-confirm-modal","component":"deleteConfirmModal"}],"version":"1.7.1-pre.244"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
2
|
+
import { type APIRequestContext, expect } from '@playwright/test';
|
|
3
|
+
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
4
|
+
import { type Encounter } from './types';
|
|
5
|
+
|
|
6
|
+
export const generateRandomDrugOrder = async (
|
|
7
|
+
api: APIRequestContext,
|
|
8
|
+
patientId: string,
|
|
9
|
+
encounter: Encounter,
|
|
10
|
+
providerUuid: string,
|
|
11
|
+
): Promise<Order> => {
|
|
12
|
+
const order = await api.post('order', {
|
|
13
|
+
data: {
|
|
14
|
+
orderType: '131168f4-15f5-102d-96e4-000c29c2a5d7',
|
|
15
|
+
type: 'drugorder',
|
|
16
|
+
action: 'new',
|
|
17
|
+
drug: '09e58895-e7f0-4649-b7c0-e665c5c08e93',
|
|
18
|
+
urgency: 'ROUTINE',
|
|
19
|
+
dateActivated: encounter.encounterDateTime,
|
|
20
|
+
careSetting: '6f0c9a92-6f24-11e3-af88-005056821db0',
|
|
21
|
+
encounter: encounter,
|
|
22
|
+
patient: patientId,
|
|
23
|
+
concept: '71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
24
|
+
orderer: providerUuid,
|
|
25
|
+
dosingType: 'org.openmrs.SimpleDosingInstructions',
|
|
26
|
+
dose: '1.0',
|
|
27
|
+
doseUnits: '161553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
28
|
+
route: '160240AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
29
|
+
frequency: '160862AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
30
|
+
quantity: 1.0,
|
|
31
|
+
numRefills: 0,
|
|
32
|
+
quantityUnits: '1513AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
33
|
+
durationUnits: { uuid: '1072AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', display: 'Days' },
|
|
34
|
+
orderReason: null,
|
|
35
|
+
orderReasonNonCoded: 'order reason',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
await expect(order.ok()).toBeTruthy();
|
|
39
|
+
return await order.json();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const deleteDrugOrder = async (api: APIRequestContext, uuid: string) => {
|
|
43
|
+
await api.delete(`order/${uuid}`, { data: {} });
|
|
44
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
2
|
+
import { type APIRequestContext, expect } from '@playwright/test';
|
|
3
|
+
import { type Encounter } from './types';
|
|
4
|
+
import { type Visit } from '@openmrs/esm-framework';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
|
|
7
|
+
export interface Observation {
|
|
8
|
+
uuid: string;
|
|
9
|
+
concept: {
|
|
10
|
+
uuid: string;
|
|
11
|
+
display: string;
|
|
12
|
+
conceptClass: {
|
|
13
|
+
uuid: string;
|
|
14
|
+
display: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
display: string;
|
|
18
|
+
groupMembers: null | Array<{
|
|
19
|
+
uuid: string;
|
|
20
|
+
concept: {
|
|
21
|
+
uuid: string;
|
|
22
|
+
display: string;
|
|
23
|
+
};
|
|
24
|
+
value: {
|
|
25
|
+
uuid: string;
|
|
26
|
+
display: string;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
value: any;
|
|
30
|
+
obsDatetime: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const createEncounter = async (
|
|
34
|
+
api: APIRequestContext,
|
|
35
|
+
patientId: string,
|
|
36
|
+
providerId: string,
|
|
37
|
+
visit: Visit,
|
|
38
|
+
): Promise<Encounter> => {
|
|
39
|
+
const encounterAfterVisit = dayjs(visit.startDatetime).add(1, 'minute');
|
|
40
|
+
const now = dayjs().subtract(1, 'second');
|
|
41
|
+
const encounterDatetime = encounterAfterVisit.isBefore(now) ? encounterAfterVisit.format() : now.format();
|
|
42
|
+
const encounterRes = await api.post('encounter', {
|
|
43
|
+
data: {
|
|
44
|
+
encounterDatetime,
|
|
45
|
+
form: 'c75f120a-04ec-11e3-8780-2b40bef9a44b',
|
|
46
|
+
patient: patientId,
|
|
47
|
+
visit: visit,
|
|
48
|
+
encounterProviders: [
|
|
49
|
+
{
|
|
50
|
+
encounterRole: '240b26f9-dd88-4172-823d-4a8bfeb7841f',
|
|
51
|
+
provider: providerId,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
location: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID,
|
|
55
|
+
encounterType: '39da3525-afe4-45ff-8977-c53b7b359158',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
await expect(encounterRes.ok()).toBeTruthy();
|
|
59
|
+
return await encounterRes.json();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const deleteEncounter = async (api: APIRequestContext, uuid: string) => {
|
|
63
|
+
await api.delete(`encounter/${uuid}`, { data: {} });
|
|
64
|
+
};
|
package/e2e/commands/index.ts
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
2
|
+
import { type APIRequestContext, expect } from '@playwright/test';
|
|
3
|
+
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
4
|
+
import { type Patient } from '../commands';
|
|
5
|
+
import { type Encounter } from './types';
|
|
6
|
+
import { type MedicationRequest } from '../../src/types';
|
|
7
|
+
|
|
8
|
+
export const generateRandomMedicationRequest = async (
|
|
9
|
+
fhirApi: APIRequestContext,
|
|
10
|
+
patient: Patient,
|
|
11
|
+
encounter: Encounter,
|
|
12
|
+
providerUuid: string,
|
|
13
|
+
drugOrder: Order,
|
|
14
|
+
): Promise<MedicationRequest> => {
|
|
15
|
+
const dispense = await fhirApi.post('MedicationRequest?_summary=data', {
|
|
16
|
+
data: {
|
|
17
|
+
resourceType: 'MedicationDispense',
|
|
18
|
+
medicationReference: {
|
|
19
|
+
reference: 'Medication/',
|
|
20
|
+
},
|
|
21
|
+
encounter: encounter,
|
|
22
|
+
intent: String,
|
|
23
|
+
priority: String,
|
|
24
|
+
subject: patient,
|
|
25
|
+
requester: [
|
|
26
|
+
{
|
|
27
|
+
actor: {
|
|
28
|
+
reference: providerUuid,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
quantity: {
|
|
33
|
+
value: 1,
|
|
34
|
+
unit: 'Tablet',
|
|
35
|
+
code: '1513AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
36
|
+
},
|
|
37
|
+
asNeededBoolean: false,
|
|
38
|
+
location: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID,
|
|
39
|
+
dosageInstruction: [
|
|
40
|
+
{
|
|
41
|
+
timing: {
|
|
42
|
+
code: {
|
|
43
|
+
coding: [
|
|
44
|
+
{
|
|
45
|
+
code: '160862AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
46
|
+
display: 'Once daily',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
system: 'https://cielterminology.org',
|
|
50
|
+
code: '160862',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
system: 'http://snomed.info/sct/',
|
|
54
|
+
code: '229797004',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
text: 'Once daily',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
asNeededBoolean: false,
|
|
61
|
+
route: {
|
|
62
|
+
coding: [
|
|
63
|
+
{
|
|
64
|
+
code: '160240AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
65
|
+
display: 'Oral',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
system: 'https://cielterminology.org',
|
|
69
|
+
code: '160240',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
system: 'http://snomed.info/sct/',
|
|
73
|
+
code: '26643006',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
text: 'Oral',
|
|
77
|
+
},
|
|
78
|
+
doseAndRate: [
|
|
79
|
+
{
|
|
80
|
+
doseQuantity: {
|
|
81
|
+
value: 1,
|
|
82
|
+
unit: 'Milligram',
|
|
83
|
+
code: '161553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
await expect(dispense.ok()).toBeTruthy();
|
|
92
|
+
return await dispense.json();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const deleteMedicationRequest = async (fhirApi: APIRequestContext, uuid: string) => {
|
|
96
|
+
await fhirApi.delete(`MedicationDispense/${uuid}`, { data: {} });
|
|
97
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
2
|
+
import { type APIRequestContext, expect } from '@playwright/test';
|
|
3
|
+
import { type Provider } from './types';
|
|
4
|
+
|
|
5
|
+
export const getProvider = async (api: APIRequestContext): Promise<Provider> => {
|
|
6
|
+
const providerRes = await api.get('provider?q=admin', {
|
|
7
|
+
data: {},
|
|
8
|
+
});
|
|
9
|
+
await expect(providerRes.ok()).toBeTruthy();
|
|
10
|
+
const { results } = await providerRes.json();
|
|
11
|
+
return await results[0];
|
|
12
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { type OpenmrsResource } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export interface Encounter {
|
|
4
|
+
uuid: string;
|
|
5
|
+
encounterDateTime: string;
|
|
6
|
+
encounterProviders: Array<{
|
|
7
|
+
uuid: string;
|
|
8
|
+
display: string;
|
|
9
|
+
encounterRole: {
|
|
10
|
+
uuid: string;
|
|
11
|
+
display: string;
|
|
12
|
+
};
|
|
13
|
+
provider: {
|
|
14
|
+
uuid: string;
|
|
15
|
+
person: {
|
|
16
|
+
uuid: string;
|
|
17
|
+
display: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
encounterType: {
|
|
22
|
+
uuid: string;
|
|
23
|
+
display: string;
|
|
24
|
+
};
|
|
25
|
+
obs: Array<Observation>;
|
|
26
|
+
orders: Array<Order>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Observation {
|
|
30
|
+
uuid: string;
|
|
31
|
+
concept: {
|
|
32
|
+
uuid: string;
|
|
33
|
+
display: string;
|
|
34
|
+
conceptClass: {
|
|
35
|
+
uuid: string;
|
|
36
|
+
display: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
display: string;
|
|
40
|
+
groupMembers: null | Array<{
|
|
41
|
+
uuid: string;
|
|
42
|
+
concept: {
|
|
43
|
+
uuid: string;
|
|
44
|
+
display: string;
|
|
45
|
+
};
|
|
46
|
+
value: {
|
|
47
|
+
uuid: string;
|
|
48
|
+
display: string;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
value: any;
|
|
52
|
+
obsDatetime: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Order {
|
|
56
|
+
uuid: string;
|
|
57
|
+
dateActivated: string;
|
|
58
|
+
dateStopped?: Date | null;
|
|
59
|
+
dose: number;
|
|
60
|
+
dosingInstructions: string | null;
|
|
61
|
+
dosingType?: 'org.openmrs.FreeTextDosingInstructions' | 'org.openmrs.SimpleDosingInstructions';
|
|
62
|
+
doseUnits: {
|
|
63
|
+
uuid: string;
|
|
64
|
+
display: string;
|
|
65
|
+
};
|
|
66
|
+
drug: {
|
|
67
|
+
uuid: string;
|
|
68
|
+
name: string;
|
|
69
|
+
strength: string;
|
|
70
|
+
display: string;
|
|
71
|
+
};
|
|
72
|
+
duration: number;
|
|
73
|
+
durationUnits: {
|
|
74
|
+
uuid: string;
|
|
75
|
+
display: string;
|
|
76
|
+
};
|
|
77
|
+
frequency: {
|
|
78
|
+
uuid: string;
|
|
79
|
+
display: string;
|
|
80
|
+
};
|
|
81
|
+
numRefills: number;
|
|
82
|
+
orderNumber: string;
|
|
83
|
+
orderReason: string | null;
|
|
84
|
+
orderReasonNonCoded: string | null;
|
|
85
|
+
orderer: {
|
|
86
|
+
uuid: string;
|
|
87
|
+
person: {
|
|
88
|
+
uuid: string;
|
|
89
|
+
display: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
orderType: {
|
|
93
|
+
uuid: string;
|
|
94
|
+
display: string;
|
|
95
|
+
};
|
|
96
|
+
route: {
|
|
97
|
+
uuid: string;
|
|
98
|
+
display: string;
|
|
99
|
+
};
|
|
100
|
+
quantity: number;
|
|
101
|
+
quantityUnits: OpenmrsResource;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface Provider {
|
|
105
|
+
uuid: string;
|
|
106
|
+
display: string;
|
|
107
|
+
comments?: string;
|
|
108
|
+
response?: string;
|
|
109
|
+
person: OpenmrsResource;
|
|
110
|
+
name?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface Patient {
|
|
114
|
+
uuid: string;
|
|
115
|
+
identifiers: Identifier[];
|
|
116
|
+
display: string;
|
|
117
|
+
person: {
|
|
118
|
+
uuid: string;
|
|
119
|
+
display: string;
|
|
120
|
+
gender: string;
|
|
121
|
+
age: number;
|
|
122
|
+
birthdate: string;
|
|
123
|
+
birthdateEstimated: boolean;
|
|
124
|
+
dead: boolean;
|
|
125
|
+
deathDate?: any;
|
|
126
|
+
causeOfDeath?: any;
|
|
127
|
+
preferredAddress: {
|
|
128
|
+
address1: string;
|
|
129
|
+
cityVillage: string;
|
|
130
|
+
country: string;
|
|
131
|
+
postalCode: string;
|
|
132
|
+
stateProvince: string;
|
|
133
|
+
countyDistrict: string;
|
|
134
|
+
};
|
|
135
|
+
attributes: any[];
|
|
136
|
+
voided: boolean;
|
|
137
|
+
birthtime?: any;
|
|
138
|
+
deathdateEstimated: boolean;
|
|
139
|
+
resourceVersion: string;
|
|
140
|
+
};
|
|
141
|
+
attributes: { value: string; attributeType: { uuid: string; display: string } }[];
|
|
142
|
+
voided: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface Address {
|
|
146
|
+
preferred: boolean;
|
|
147
|
+
address1: string;
|
|
148
|
+
cityVillage: string;
|
|
149
|
+
country: string;
|
|
150
|
+
postalCode: string;
|
|
151
|
+
stateProvince: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface Identifier {
|
|
155
|
+
uuid: string;
|
|
156
|
+
display: string;
|
|
157
|
+
}
|
package/e2e/core/test.ts
CHANGED
|
@@ -24,11 +24,7 @@ export const test = base.extend<CustomTestFixtures, CustomWorkerFixtures>({
|
|
|
24
24
|
async ({ api }, use) => {
|
|
25
25
|
const patient = await generateRandomPatient(api);
|
|
26
26
|
await use(patient);
|
|
27
|
-
|
|
28
|
-
if (patient) await deletePatient(api, patient.uuid);
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.warn('Failed to delete patient:', e);
|
|
31
|
-
}
|
|
27
|
+
await deletePatient(api, patient.uuid);
|
|
32
28
|
},
|
|
33
29
|
{ scope: 'test', auto: true },
|
|
34
30
|
],
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { expect } from '@playwright/test';
|
|
2
|
+
import { type Visit } from '@openmrs/esm-framework';
|
|
3
|
+
import {
|
|
4
|
+
generateRandomDrugOrder,
|
|
5
|
+
deleteDrugOrder,
|
|
6
|
+
createEncounter,
|
|
7
|
+
deleteEncounter,
|
|
8
|
+
getProvider,
|
|
9
|
+
startVisit,
|
|
10
|
+
endVisit,
|
|
11
|
+
} from '../commands';
|
|
12
|
+
import { type Encounter, type Provider } from '../commands/types';
|
|
13
|
+
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
14
|
+
import { test } from '../core';
|
|
15
|
+
import { DispensingPage } from '../pages';
|
|
16
|
+
|
|
17
|
+
let visit: Visit;
|
|
18
|
+
let drugOrder: Order;
|
|
19
|
+
let encounter: Encounter;
|
|
20
|
+
let orderer: Provider;
|
|
21
|
+
|
|
22
|
+
test.beforeEach(async ({ api, patient }) => {
|
|
23
|
+
visit = await startVisit(api, patient.uuid);
|
|
24
|
+
orderer = await getProvider(api);
|
|
25
|
+
encounter = await createEncounter(api, patient.uuid, orderer.uuid, visit);
|
|
26
|
+
drugOrder = await generateRandomDrugOrder(api, patient.uuid, encounter, orderer.uuid);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('Dispense prescription', async ({ page, patient }) => {
|
|
30
|
+
const dispensingPage = new DispensingPage(page);
|
|
31
|
+
await test.step('When I navigate to the dispensing app', async () => {
|
|
32
|
+
await dispensingPage.goTo();
|
|
33
|
+
await expect(page).toHaveURL(process.env.E2E_BASE_URL + `/spa/dispensing`);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
await test.step('And I expand a table row in the Prescriptions table corresponding to an active prescription', async () => {
|
|
37
|
+
const rowText = new RegExp(`Expand current row`);
|
|
38
|
+
await page.getByRole('row', { name: rowText }).getByLabel('Expand current row').nth(0).click();
|
|
39
|
+
await expect(page.getByLabel('Prescription details', { exact: true }).getByText('Aspirin 81mg')).toBeVisible();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
await test.step('Then I click the Dispense button to launch the Dispense prescription form', async () => {
|
|
43
|
+
await page.getByRole('button', { name: 'Dispense', exact: true }).click();
|
|
44
|
+
await expect(page.getByLabel('Workspace header').getByText('Dispense prescription')).toBeVisible();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
await test.step('Then I submit the form by clicking the Dispense prescription button', async () => {
|
|
48
|
+
await page.getByRole('button', { name: 'Dispense prescription' }).click();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await test.step('Then I should see a success notification', async () => {
|
|
52
|
+
await expect(page.getByText(/medication successfully dispensed/i)).toBeVisible();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
await test.step('And when I click the `History and comments` tab I should see the updated `Dispensed` status reflected', async () => {
|
|
56
|
+
await page.getByRole('tab', { name: 'History and comments' }).click();
|
|
57
|
+
await expect(page.getByText('Dispensed', { exact: true })).toBeVisible();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test.afterEach(async ({ api }) => {
|
|
62
|
+
await deleteEncounter(api, encounter.uuid);
|
|
63
|
+
await deleteDrugOrder(api, drugOrder.uuid);
|
|
64
|
+
await endVisit(api, visit);
|
|
65
|
+
});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"8e1c24192904ade7","duration":41556}
|