@openmrs/esm-dispensing-app 1.9.2-pre.901 → 1.9.2-pre.903

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 CHANGED
@@ -7,13 +7,6 @@
7
7
  "plugin:@typescript-eslint/recommended",
8
8
  "plugin:@typescript-eslint/recommended-requiring-type-checking"
9
9
  ],
10
- "parser": "@typescript-eslint/parser",
11
- "parserOptions": {
12
- "project": true,
13
- "tsconfigRootDir": "__dirname"
14
- },
15
- "plugins": ["@typescript-eslint", "import", "react-hooks", "unused-imports"],
16
- "root": true,
17
10
  "overrides": [
18
11
  {
19
12
  "files": ["e2e/**/*.ts"],
@@ -22,6 +15,13 @@
22
15
  }
23
16
  }
24
17
  ],
18
+ "parser": "@typescript-eslint/parser",
19
+ "parserOptions": {
20
+ "project": true,
21
+ "tsconfigRootDir": "__dirname"
22
+ },
23
+ "plugins": ["@typescript-eslint", "import", "react-hooks", "unused-imports"],
24
+ "root": true,
25
25
  "rules": {
26
26
  "react-hooks/exhaustive-deps": "warn",
27
27
  "react-hooks/rules-of-hooks": "error",
@@ -0,0 +1 @@
1
+ {"hash":"2355faddea0ea7e0","duration":43585}
@@ -40,4 +40,4 @@ Entrypoints:
40
40
  main (568 KiB)
41
41
  main.js
42
42
 
43
- webpack 5.99.9 compiled with 2 warnings in 42270 ms
43
+ webpack 5.99.9 compiled with 2 warnings in 41211 ms
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.901"}
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.903"}
@@ -1,6 +1,6 @@
1
1
  import { type APIRequestContext, expect } from '@playwright/test';
2
- import { type Encounter } from './types';
3
2
  import { type Visit } from '@openmrs/esm-framework';
3
+ import { type Encounter } from './types';
4
4
 
5
5
  export interface Observation {
6
6
  uuid: string;
@@ -51,7 +51,8 @@ export const generateRandomPatient = async (api: APIRequestContext): Promise<Pat
51
51
  data: {},
52
52
  });
53
53
 
54
- expect(identifierRes.ok()).toBeTruthy();
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
- expect(patientRes.ok()).toBeTruthy();
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
 
@@ -1,6 +1,6 @@
1
+ import dayjs from 'dayjs';
1
2
  import { type APIRequestContext, expect } from '@playwright/test';
2
3
  import { type Visit } from '@openmrs/esm-framework';
3
- import dayjs from 'dayjs';
4
4
 
5
5
  export const visitStartDatetime = dayjs().subtract(1, 'D');
6
6
 
@@ -16,16 +16,15 @@ export const startVisit = async (api: APIRequestContext, patientId: string): Pro
16
16
  });
17
17
 
18
18
  expect(visitRes.ok()).toBeTruthy();
19
- const visit = await visitRes.json();
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?.location?.uuid,
27
- startDatetime: visit?.startDatetime,
28
- visitType: visit?.visitType?.uuid,
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, fhirApi } from '../fixtures';
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);
@@ -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
  /**
@@ -1,2 +1 @@
1
1
  export * from './api';
2
- export * from './fhirApi';
@@ -1,3 +1,4 @@
1
+ # syntax=docker/dockerfile:1.3
1
2
  FROM --platform=$BUILDPLATFORM node:22-alpine as dev
2
3
 
3
4
  ARG APP_SHELL_VERSION=next
@@ -9,16 +9,16 @@ trap 'rm -rf "$working_dir"' EXIT
9
9
  # get the app name
10
10
  app_name=$(jq -r '.name' "$script_dir/../../../package.json")
11
11
 
12
- echo "Creating packed archive of the app..."
12
+ echo "Creating packed archive of the app for Docker build..."
13
13
  # @openmrs/esm-whatever -> _openmrs_esm_whatever
14
14
  packed_app_name=$(echo "$app_name" | tr '[:punct:]' '_');
15
15
  # run yarn pack for our app and add it to the working directory
16
16
  yarn pack -o "$working_dir/$packed_app_name.tgz" >/dev/null;
17
- echo "Created packed app archives"
17
+ echo "Successfully created packed app archive: $packed_app_name.tgz"
18
18
 
19
- echo "Creating dynamic spa-assemble-config.json..."
20
- # dynamically assemble our list of frontend modules, prepending the login app and
21
- # primary navigation apps; apps will all be in the /app directory of the Docker
19
+ echo "Creating dynamic spa-assemble-config.json with frontend modules..."
20
+ # dynamically assemble our list of frontend modules, prepending the primary navigation
21
+ # and patient banner apps; apps will all be in the /app directory of the Docker
22
22
  # container
23
23
  jq -n \
24
24
  --arg app_name "$app_name" \
@@ -29,15 +29,14 @@ jq -n \
29
29
  } + {
30
30
  ($app_name): $app_file
31
31
  }' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json"
32
- echo "Created dynamic spa-assemble-config.json"
32
+ echo "Successfully created spa-assemble-config.json with frontend modules"
33
33
 
34
- echo "Copying Docker configuration..."
34
+ echo "Copying Docker configuration files to working directory..."
35
35
  cp "$script_dir/Dockerfile" "$working_dir/Dockerfile"
36
36
  cp "$script_dir/docker-compose.yml" "$working_dir/docker-compose.yml"
37
37
 
38
38
  cd "$working_dir"
39
- echo "Starting Docker containers..."
39
+ echo "Building and starting Docker containers for e2e testing..."
40
40
  # CACHE_BUST to ensure the assemble step is always run
41
41
  docker compose build --build-arg CACHE_BUST=$(date +%s) frontend
42
42
  docker compose up -d
43
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-dispensing-app",
3
- "version": "1.9.2-pre.901",
3
+ "version": "1.9.2-pre.903",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Medication dispensing application",
6
6
  "browser": "dist/openmrs-esm-dispensing-app.js",
@@ -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
- };
@@ -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
- });