@openmrs/esm-dispensing-app 1.9.2-pre.901 → 1.9.2-pre.902
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/.eslintrc +0 -8
- package/.turbo/cache/c12da28d78393da6-meta.json +1 -0
- package/.turbo/cache/{bf5fb3ad4647f8e0.tar.zst → c12da28d78393da6.tar.zst} +0 -0
- package/.turbo/turbo-build.log +1 -1
- package/dist/routes.json +1 -1
- package/e2e/commands/drug-order-operations.ts +3 -2
- package/e2e/commands/encounter-operations.ts +3 -2
- package/e2e/commands/index.ts +3 -3
- package/e2e/commands/medication-request-operation.ts +97 -0
- package/e2e/commands/patient-operations.ts +5 -3
- package/e2e/commands/provider-operations.ts +5 -2
- package/e2e/commands/visit-operations.ts +4 -5
- package/e2e/core/test.ts +1 -3
- package/e2e/fixtures/api.ts +2 -1
- package/e2e/fixtures/index.ts +0 -1
- package/e2e/support/github/Dockerfile +2 -1
- package/e2e/support/github/run-e2e-docker-env.sh +28 -23
- package/package.json +1 -1
- package/.turbo/cache/bf5fb3ad4647f8e0-meta.json +0 -1
- package/e2e/commands/medication-dispense-operations.ts +0 -93
- package/e2e/fixtures/fhirApi.ts +0 -27
- package/e2e/specs/delete-medication-dispense.spec.ts +0 -80
package/.eslintrc
CHANGED
|
@@ -14,14 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"plugins": ["@typescript-eslint", "import", "react-hooks", "unused-imports"],
|
|
16
16
|
"root": true,
|
|
17
|
-
"overrides": [
|
|
18
|
-
{
|
|
19
|
-
"files": ["e2e/**/*.ts"],
|
|
20
|
-
"rules": {
|
|
21
|
-
"react-hooks/rules-of-hooks": "off"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
17
|
"rules": {
|
|
26
18
|
"react-hooks/exhaustive-deps": "warn",
|
|
27
19
|
"react-hooks/rules-of-hooks": "error",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"hash":"c12da28d78393da6","duration":44199}
|
|
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.9.2-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.9.2-pre.902"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
1
2
|
import { type APIRequestContext, expect } from '@playwright/test';
|
|
2
3
|
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
3
4
|
import { type Encounter } from './types';
|
|
@@ -34,10 +35,10 @@ export const generateRandomDrugOrder = async (
|
|
|
34
35
|
orderReasonNonCoded: 'order reason',
|
|
35
36
|
},
|
|
36
37
|
});
|
|
37
|
-
expect(order.ok()).toBeTruthy();
|
|
38
|
+
await expect(order.ok()).toBeTruthy();
|
|
38
39
|
return await order.json();
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
export const deleteDrugOrder = async (api: APIRequestContext, uuid: string) => {
|
|
42
|
-
await api.delete(`order/${uuid}
|
|
43
|
+
await api.delete(`order/${uuid}`, { data: {} });
|
|
43
44
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
1
2
|
import { type APIRequestContext, expect } from '@playwright/test';
|
|
2
3
|
import { type Encounter } from './types';
|
|
3
4
|
import { type Visit } from '@openmrs/esm-framework';
|
|
@@ -51,10 +52,10 @@ export const createEncounter = async (
|
|
|
51
52
|
encounterType: '39da3525-afe4-45ff-8977-c53b7b359158',
|
|
52
53
|
},
|
|
53
54
|
});
|
|
54
|
-
expect(encounterRes.ok()).toBeTruthy();
|
|
55
|
+
await expect(encounterRes.ok()).toBeTruthy();
|
|
55
56
|
return await encounterRes.json();
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
export const deleteEncounter = async (api: APIRequestContext, uuid: string) => {
|
|
59
|
-
await api.delete(`encounter/${uuid}
|
|
60
|
+
await api.delete(`encounter/${uuid}`, { data: {} });
|
|
60
61
|
};
|
package/e2e/commands/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './drug-order-operations';
|
|
2
|
-
export * from './encounter-operations';
|
|
3
1
|
export * from './patient-operations';
|
|
4
|
-
export * from './provider-operations';
|
|
5
2
|
export * from './visit-operations';
|
|
3
|
+
export * from './encounter-operations';
|
|
4
|
+
export * from './drug-order-operations';
|
|
5
|
+
export * from './provider-operations';
|
|
@@ -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
|
+
};
|
|
@@ -51,7 +51,8 @@ export const generateRandomPatient = async (api: APIRequestContext): Promise<Pat
|
|
|
51
51
|
data: {},
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
55
|
+
await expect(identifierRes.ok()).toBeTruthy();
|
|
55
56
|
const { identifier } = await identifierRes.json();
|
|
56
57
|
|
|
57
58
|
const patientRes = await api.post('patient', {
|
|
@@ -93,7 +94,8 @@ export const generateRandomPatient = async (api: APIRequestContext): Promise<Pat
|
|
|
93
94
|
},
|
|
94
95
|
});
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
98
|
+
await expect(patientRes.ok()).toBeTruthy();
|
|
97
99
|
return await patientRes.json();
|
|
98
100
|
};
|
|
99
101
|
|
|
@@ -103,5 +105,5 @@ export const getPatient = async (api: APIRequestContext, uuid: string): Promise<
|
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export const deletePatient = async (api: APIRequestContext, uuid: string) => {
|
|
106
|
-
await api.delete(`patient/${uuid}
|
|
108
|
+
await api.delete(`patient/${uuid}`, { data: {} });
|
|
107
109
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/await-thenable */
|
|
1
2
|
import { type APIRequestContext, expect } from '@playwright/test';
|
|
2
3
|
import { type Provider } from './types';
|
|
3
4
|
|
|
4
5
|
export const getProvider = async (api: APIRequestContext): Promise<Provider> => {
|
|
5
|
-
const providerRes = await api.get('provider?q=admin'
|
|
6
|
-
|
|
6
|
+
const providerRes = await api.get('provider?q=admin', {
|
|
7
|
+
data: {},
|
|
8
|
+
});
|
|
9
|
+
await expect(providerRes.ok()).toBeTruthy();
|
|
7
10
|
const { results } = await providerRes.json();
|
|
8
11
|
return await results[0];
|
|
9
12
|
};
|
|
@@ -16,16 +16,15 @@ export const startVisit = async (api: APIRequestContext, patientId: string): Pro
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
expect(visitRes.ok()).toBeTruthy();
|
|
19
|
-
|
|
20
|
-
return await getVisit(api, visit.uuid);
|
|
19
|
+
return await visitRes.json();
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
export const endVisit = async (api: APIRequestContext, visit: Visit) => {
|
|
24
23
|
const visitRes = await api.post(`visit/${visit.uuid}`, {
|
|
25
24
|
data: {
|
|
26
|
-
location: visit
|
|
27
|
-
startDatetime: visit
|
|
28
|
-
visitType: visit
|
|
25
|
+
location: visit.location.uuid,
|
|
26
|
+
startDatetime: visit.startDatetime,
|
|
27
|
+
visitType: visit.visitType.uuid,
|
|
29
28
|
stopDatetime: dayjs().format('YYYY-MM-DDTHH:mm:ss.SSSZZ'),
|
|
30
29
|
},
|
|
31
30
|
});
|
package/e2e/core/test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type APIRequestContext, type Page, test as base } from '@playwright/test';
|
|
2
|
-
import { api
|
|
2
|
+
import { api } from '../fixtures';
|
|
3
3
|
import { type Patient } from '../types';
|
|
4
4
|
import { generateRandomPatient, deletePatient } from '../commands';
|
|
5
5
|
|
|
@@ -16,12 +16,10 @@ export interface CustomTestFixtures {
|
|
|
16
16
|
|
|
17
17
|
export interface CustomWorkerFixtures {
|
|
18
18
|
api: APIRequestContext;
|
|
19
|
-
fhirApi: APIRequestContext;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export const test = base.extend<CustomTestFixtures, CustomWorkerFixtures>({
|
|
23
22
|
api: [api, { scope: 'worker' }],
|
|
24
|
-
fhirApi: [fhirApi, { scope: 'worker' }],
|
|
25
23
|
patient: [
|
|
26
24
|
async ({ api }, use) => {
|
|
27
25
|
const patient = await generateRandomPatient(api);
|
package/e2e/fixtures/api.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
1
2
|
import { type APIRequestContext, type PlaywrightWorkerArgs, type WorkerFixture } from '@playwright/test';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -22,5 +23,5 @@ export const api: WorkerFixture<APIRequestContext, PlaywrightWorkerArgs> = async
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
use(ctx);
|
|
26
|
+
await use(ctx);
|
|
26
27
|
};
|
package/e2e/fixtures/index.ts
CHANGED
|
@@ -4,40 +4,45 @@
|
|
|
4
4
|
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
5
5
|
# create a temporary working directory
|
|
6
6
|
working_dir=$(mktemp -d "${TMPDIR:-/tmp/}openmrs-e2e-frontends.XXXXXXXXXX")
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
|
|
7
|
+
# get a list of all the apps in this workspace
|
|
8
|
+
apps=$(yarn workspaces list --json | jq -r 'select(.name | test("-app")) | .name')
|
|
9
|
+
# this array will hold all of the packed app names
|
|
10
|
+
app_names=()
|
|
11
11
|
|
|
12
|
-
echo "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# run yarn pack for our app and add it to the working directory
|
|
16
|
-
yarn pack -o "$working_dir/$packed_app_name.tgz" >/dev/null;
|
|
17
|
-
echo "Created packed app archives"
|
|
12
|
+
echo "Packing local dispensing app..."
|
|
13
|
+
yarn workspace "@openmrs/esm-dispensing-app" pack -o "$working_dir/_openmrs_esm_dispensing_app.tgz" >/dev/null
|
|
14
|
+
app_names+=("_openmrs_esm_dispensing_app.tgz")
|
|
18
15
|
|
|
19
|
-
echo "
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
echo "Packing other apps..."
|
|
17
|
+
for app in $apps; do
|
|
18
|
+
if [ "$app" != "@openmrs/esm-dispensing-app" ]; then
|
|
19
|
+
app_name=$(echo "$app" | tr '[:punct:]' '_')
|
|
20
|
+
app_names+=("$app_name.tgz")
|
|
21
|
+
yarn workspace "$app" pack -o "$working_dir/$app_name.tgz" >/dev/null
|
|
22
|
+
fi
|
|
23
|
+
done
|
|
24
|
+
|
|
25
|
+
echo "Generating spa-assemble-config.json..."
|
|
23
26
|
jq -n \
|
|
24
|
-
--arg
|
|
25
|
-
--arg
|
|
27
|
+
--arg apps "$apps" \
|
|
28
|
+
--arg app_names "$(echo ${app_names[@]})" \
|
|
26
29
|
'{
|
|
27
30
|
"@openmrs/esm-primary-navigation-app": "next",
|
|
28
31
|
"@openmrs/esm-patient-banner-app": "next"
|
|
29
|
-
} +
|
|
30
|
-
($
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
} + (
|
|
33
|
+
($apps | split("\n")) as $apps |
|
|
34
|
+
($app_names | split(" ") | map("/app/" + .)) as $app_files
|
|
35
|
+
| [$apps, $app_files]
|
|
36
|
+
| transpose
|
|
37
|
+
| map({"key": .[0], "value": .[1]})
|
|
38
|
+
| from_entries
|
|
39
|
+
)' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json"
|
|
33
40
|
|
|
34
|
-
echo "
|
|
41
|
+
echo "Setting up Docker..."
|
|
35
42
|
cp "$script_dir/Dockerfile" "$working_dir/Dockerfile"
|
|
36
43
|
cp "$script_dir/docker-compose.yml" "$working_dir/docker-compose.yml"
|
|
37
44
|
|
|
38
45
|
cd "$working_dir"
|
|
39
|
-
echo "Starting Docker containers..."
|
|
40
|
-
# CACHE_BUST to ensure the assemble step is always run
|
|
41
46
|
docker compose build --build-arg CACHE_BUST=$(date +%s) frontend
|
|
42
47
|
docker compose up -d
|
|
43
48
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"bf5fb3ad4647f8e0","duration":44397}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import { type APIRequestContext, expect } from '@playwright/test';
|
|
3
|
-
import { type Patient } from '.';
|
|
4
|
-
import { type Provider } from './types';
|
|
5
|
-
import { MedicationDispenseStatus, type MedicationDispense } from '../../src/types';
|
|
6
|
-
|
|
7
|
-
export const generateMedicationDispense = async (
|
|
8
|
-
fhirApi: APIRequestContext,
|
|
9
|
-
patient: Patient,
|
|
10
|
-
provider: Provider,
|
|
11
|
-
medicationRequestUuid: string,
|
|
12
|
-
): Promise<MedicationDispense> => {
|
|
13
|
-
const dispense = await fhirApi.post('MedicationDispense', {
|
|
14
|
-
data: {
|
|
15
|
-
resourceType: 'MedicationDispense',
|
|
16
|
-
status: MedicationDispenseStatus.completed,
|
|
17
|
-
authorizingPrescription: [
|
|
18
|
-
{
|
|
19
|
-
reference: `MedicationRequest/${medicationRequestUuid}`,
|
|
20
|
-
type: 'MedicationRequest',
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
medicationReference: {
|
|
24
|
-
reference: 'Medication/09e58895-e7f0-4649-b7c0-e665c5c08e93',
|
|
25
|
-
type: 'Medication',
|
|
26
|
-
display: 'Aspirin 81mg',
|
|
27
|
-
},
|
|
28
|
-
subject: {
|
|
29
|
-
reference: `Patient/${patient.uuid}`,
|
|
30
|
-
},
|
|
31
|
-
performer: [
|
|
32
|
-
{
|
|
33
|
-
actor: {
|
|
34
|
-
reference: `Practitioner/${provider.uuid}`,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
location: {
|
|
39
|
-
reference: `Location/${process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID}`,
|
|
40
|
-
},
|
|
41
|
-
whenHandedOver: dayjs().format(),
|
|
42
|
-
quantity: {
|
|
43
|
-
value: 5,
|
|
44
|
-
code: '1513AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
45
|
-
unit: 'Tablet',
|
|
46
|
-
},
|
|
47
|
-
dosageInstruction: [
|
|
48
|
-
{
|
|
49
|
-
timing: {
|
|
50
|
-
repeat: {
|
|
51
|
-
durationUnit: 'd',
|
|
52
|
-
},
|
|
53
|
-
code: {
|
|
54
|
-
coding: [
|
|
55
|
-
{
|
|
56
|
-
code: '160862AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
57
|
-
display: 'Once daily',
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
text: 'Once daily',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
asNeededBoolean: false,
|
|
64
|
-
route: {
|
|
65
|
-
coding: [
|
|
66
|
-
{
|
|
67
|
-
code: '160240AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
68
|
-
display: 'Oral',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
text: 'Oral',
|
|
72
|
-
},
|
|
73
|
-
doseAndRate: [
|
|
74
|
-
{
|
|
75
|
-
doseQuantity: {
|
|
76
|
-
value: 1,
|
|
77
|
-
unit: 'Milligram',
|
|
78
|
-
code: '161553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
expect(dispense.ok()).toBeTruthy();
|
|
88
|
-
return await dispense.json();
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const deleteMedicationDispense = async (fhirApi: APIRequestContext, id: string) => {
|
|
92
|
-
await fhirApi.delete(`MedicationDispense/${id}`);
|
|
93
|
-
};
|
package/e2e/fixtures/fhirApi.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type APIRequestContext, type PlaywrightWorkerArgs, type WorkerFixture } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A fixture which initializes an [`APIRequestContext`](https://playwright.dev/docs/api/class-apirequestcontext)
|
|
5
|
-
* that is bound to the configured OpenMRS API server. The context is automatically authenticated
|
|
6
|
-
* using the configured admin account.
|
|
7
|
-
*
|
|
8
|
-
* Use the request context like this:
|
|
9
|
-
* ```ts
|
|
10
|
-
* test('your test', async ({ api }) => {
|
|
11
|
-
* const res = await api.get('patient/1234');
|
|
12
|
-
* await expect(res.ok()).toBeTruthy();
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export const fhirApi: WorkerFixture<APIRequestContext, PlaywrightWorkerArgs> = async ({ playwright }, use) => {
|
|
18
|
-
const fhirctx = await playwright.request.newContext({
|
|
19
|
-
baseURL: `${process.env.E2E_BASE_URL}/ws/fhir2/R4/`,
|
|
20
|
-
httpCredentials: {
|
|
21
|
-
username: process.env.E2E_USER_ADMIN_USERNAME,
|
|
22
|
-
password: process.env.E2E_USER_ADMIN_PASSWORD,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
use(fhirctx);
|
|
27
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { expect } from '@playwright/test';
|
|
2
|
-
import { type Visit } from '@openmrs/esm-framework';
|
|
3
|
-
import { type Order } from '@openmrs/esm-patient-common-lib';
|
|
4
|
-
import {
|
|
5
|
-
createEncounter,
|
|
6
|
-
deleteDrugOrder,
|
|
7
|
-
deleteEncounter,
|
|
8
|
-
endVisit,
|
|
9
|
-
generateRandomDrugOrder,
|
|
10
|
-
getProvider,
|
|
11
|
-
startVisit,
|
|
12
|
-
} from '../commands';
|
|
13
|
-
import { deleteMedicationDispense, generateMedicationDispense } from '../commands/medication-dispense-operations';
|
|
14
|
-
import { DispensingPage } from '../pages';
|
|
15
|
-
import { test } from '../core';
|
|
16
|
-
import { type Encounter, type Provider } from '../commands/types';
|
|
17
|
-
import { type MedicationDispense } from '../../src/types';
|
|
18
|
-
|
|
19
|
-
let drugOrder: Order;
|
|
20
|
-
let encounter: Encounter;
|
|
21
|
-
let medicationDispense: MedicationDispense;
|
|
22
|
-
let orderer: Provider;
|
|
23
|
-
let visit: Visit;
|
|
24
|
-
|
|
25
|
-
test.beforeEach(async ({ fhirApi, api, patient }) => {
|
|
26
|
-
visit = await startVisit(api, patient.uuid);
|
|
27
|
-
orderer = await getProvider(api);
|
|
28
|
-
encounter = await createEncounter(api, patient.uuid, orderer.uuid, visit);
|
|
29
|
-
drugOrder = await generateRandomDrugOrder(api, patient.uuid, encounter, orderer.uuid);
|
|
30
|
-
medicationDispense = await generateMedicationDispense(fhirApi, patient, orderer, drugOrder.uuid);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('Delete medication dispense', async ({ fhirApi, page, patient }) => {
|
|
34
|
-
const dispensingPage = new DispensingPage(page);
|
|
35
|
-
|
|
36
|
-
await test.step('When I navigate to the dispensing app', async () => {
|
|
37
|
-
await dispensingPage.goTo();
|
|
38
|
-
await expect(page).toHaveURL(`/openmrs/spa/dispensing`);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
await test.step('And I click on the "Active prescriptions" tab', async () => {
|
|
42
|
-
await page.getByRole('tab', { name: 'Active prescriptions' }).click();
|
|
43
|
-
await expect(page.getByRole('tab', { name: 'Active prescriptions' })).toHaveAttribute('aria-selected', 'true');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
await test.step('Then I should see the prescription in the table', async () => {
|
|
47
|
-
await expect(page.getByRole('row', { name: 'Expand current row' }).first()).toBeVisible();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
await test.step('And I expand the prescription row', async () => {
|
|
51
|
-
await page.getByRole('row', { name: 'Expand current row' }).getByLabel('Expand current row').first().click();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await test.step('And I navigate to the History and comments tab', async () => {
|
|
55
|
-
await page.getByRole('tab', { name: 'History and comments' }).click();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
await test.step('And I click on the "Options" menu', async () => {
|
|
59
|
-
await page.getByRole('button', { name: 'Options' }).first().click();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
await test.step('And I select the "Delete" option', async () => {
|
|
63
|
-
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
await test.step('And I select the "Delete" button in the modal', async () => {
|
|
67
|
-
await page.getByRole('button', { name: 'danger Delete' }).click();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
await test.step('Then I should see a success notification confirming the deletion', async () => {
|
|
71
|
-
await expect(page.getByText(/medication dispense was deleted successfully/i)).toBeVisible();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test.afterEach(async ({ api, fhirApi }) => {
|
|
76
|
-
await deleteMedicationDispense(fhirApi, medicationDispense.id);
|
|
77
|
-
await deleteEncounter(api, encounter.uuid);
|
|
78
|
-
await deleteDrugOrder(api, drugOrder.uuid);
|
|
79
|
-
await endVisit(api, visit);
|
|
80
|
-
});
|