Skip to content

Commit

Permalink
Merge branch 'main' into fix/align-time-duration-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
harshthakkr authored Dec 14, 2024
2 parents 60a0d4c + f16bd73 commit 1d0b40a
Show file tree
Hide file tree
Showing 349 changed files with 7,556 additions and 8,437 deletions.
59 changes: 19 additions & 40 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
"env": {
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest-dom/recommended"],
"overrides": [
{
"files": ["**/*.test.tsx"],
"extends": ["plugin:testing-library/react"]
},
{
"files": ["e2e/**/*.spec.ts"],
"extends": ["plugin:playwright/recommended"],
"rules": {
"testing-library/prefer-screen-queries": "off"
}
}
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
"rules": {
"import/no-duplicates": "error",
"react-hooks/rules-of-hooks": "error",
// Disabling these rules for now just to keep the diff small. We'll enable them one by one as we go.
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
Expand All @@ -32,7 +38,7 @@
"fixStyle": "inline-type-imports"
}
],
"prefer-const": "off",
"import/no-duplicates": "error",
"no-console": [
"error",
{
Expand Down Expand Up @@ -69,36 +75,9 @@
}
]
}
]
},
"overrides": [
{
"files": ["**/e2e/**"],
"rules": {
"testing-library/await-async-events": "off",
"testing-library/await-async-query": "off",
"testing-library/await-async-utils": "off",
"testing-library/no-await-sync-events": "off",
"testing-library/no-await-sync-queries": "off",
"testing-library/no-container": "off",
"testing-library/no-debugging-utils": "off",
"testing-library/no-dom-import": "off",
"testing-library/no-global-regexp-flag-in-query": "off",
"testing-library/no-manual-cleanup": "off",
"testing-library/no-node-access": "off",
"testing-library/no-promise-in-fire-event": "off",
"testing-library/no-render-in-lifecycle": "off",
"testing-library/no-unnecessary-act": "off",
"testing-library/no-wait-for-multiple-assertions": "off",
"testing-library/no-wait-for-side-effects": "off",
"testing-library/no-wait-for-snapshot": "off",
"testing-library/prefer-find-by": "off",
"testing-library/prefer-implicit-assert": "off",
"testing-library/prefer-presence-queries": "off",
"testing-library/prefer-query-by-disappearance": "off",
"testing-library/prefer-screen-queries": "off",
"testing-library/render-result-naming-convention": "off"
}
}
]
],
"prefer-const": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: OpenMRS CI

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
Expand Down
2 changes: 2 additions & 0 deletions __mocks__/appointments.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ export const mockProviders = {
{
uuid: 'f9badd80-ab76-11e2-9e96-0800200c9a66',
person: { uuid: '24252571-dd5a-11e6-9d9c-0242ac150002', display: 'Dr James Cook' },
display: 'doctor - James Cook',
},
{
uuid: '3191eddf-5cc5-4fa4-94ef-dfc25e8d33e4',
person: { uuid: '89af8ba6-2ec5-4d77-b3ed-7e9e02448e96', display: 'Dr Amstrong Neil' },
display: 'doctor - Amstrong Neil',
},
],
};
Expand Down
2 changes: 1 addition & 1 deletion __mocks__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export * from './identifiers.mock';
export * from './locations.mock';
export * from './metrics.mock';
export * from './patient.mock';
export * from './patient-visits.mock';
export * from './patient-appointments.mock';
export * from './patient-registration.mock';
export * from './queue-entry.mock';
export * from './queue-rooms.mock';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const mockPatientsVisits = {
recentVisits: [
export const mockPatientAppointments = {
recentAppointments: [
{
uuid: '6baa7963-68ea-497e-b258-6fb82382bd07',
appointmentNumber: '0000',
Expand Down Expand Up @@ -59,7 +59,7 @@ export const mockPatientsVisits = {
recurring: false,
},
],
futureVisits: [
futureAppointments: [
{
uuid: '6baa7963-68ea-497e-b258-6fb82382bd07',
appointmentNumber: '0000',
Expand Down
2 changes: 1 addition & 1 deletion __mocks__/queue-entry.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const mockQueueEntryAlice: QueueEntry = {
endedAt: null,
locationWaitingFor: null,
patient: mockPatientAlice,
priority: mockPriorityNonUrgent,
priority: mockPriorityUrgent,
priorityComment: null,
providerWaitingFor: null,
queue: mockQueueSurgery,
Expand Down
113 changes: 113 additions & 0 deletions __mocks__/search.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,116 @@ export const mockSearchResults = {
],
},
};

export const mockAdvancedSearchResults = [
{
patientId: 14,
uuid: 'e46dfea6-f32d-4b61-bc7d-e79fd35332a4',
identifiers: [
{
identifier: '100008E',
identifierType: {
uuid: '05a29f94-c0ed-11e2-94be-8c13b969e334',
display: 'OpenMRS ID',
},
},
],
display: '100008E - Joshua Johnson',
patientIdentifier: {
uuid: '1e6c2da6-f63f-4ea5-a595-ded69df9f882',
identifier: '100008E',
},
person: {
gender: 'M',
age: 5,
birthdate: '2019-09-25T00:00:00.000+0000',
birthdateEstimated: false,
personName: {
display: 'Joshua Johnson',
givenName: 'Joshua',
familyName: 'Johnson',
},
addresses: [
{
address1: 'Address16442',
cityVillage: 'City6442',
stateProvince: 'State6442',
country: 'Country6442',
postalCode: '20839',
preferred: true,
},
],
dead: false,
deathDate: null,
},
attributes: [
{
value: '0785434125',
attributeType: {
uuid: '14d4f066-15f5-102d-96e4-000c29c2a5d7',
display: 'Telephone Number',
},
},
],
},
{
patientId: 42,
uuid: 'a83747aa-3041-489a-a112-1c024582c83d',
identifiers: [
{
identifier: '100016H',
identifierType: {
uuid: '05a29f94-c0ed-11e2-94be-8c13b969e334',
display: 'OpenMRS ID',
},
},
],
display: '100016H - Joseph Davis',
patientIdentifier: {
uuid: '0ac0a9a0-b040-4c0a-9c35-c4e0bb52a570',
identifier: '100016H',
},
person: {
gender: 'M',
age: 30,
birthdate: '1994-10-13T00:00:00.000+0000',
birthdateEstimated: false,
personName: {
display: 'Joseph Davis',
givenName: 'Joseph',
familyName: 'Davis',
},
addresses: [
{
address1: 'Address19050',
cityVillage: 'City9050',
stateProvince: 'State9050',
country: 'Country9050',
postalCode: '46548',
preferred: true,
},
],
dead: false,
deathDate: null,
},
attributes: [
{
value: {
uuid: '1ce1b7d4-c865-4178-82b0-5932e51503d6',
display: 'Community Outreach',
links: [
{
rel: 'self',
uri: 'http://dev3.openmrs.org/openmrs/ws/rest/v1/location/1ce1b7d4-c865-4178-82b0-5932e51503d6',
resourceAlias: 'location',
},
],
},
attributeType: {
uuid: '8d87236c-c2cc-11de-8d13-0010c6dffd0f',
display: 'Health Center',
},
},
],
},
];
40 changes: 1 addition & 39 deletions e2e/commands/cohort-operations.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
import { type APIRequestContext, expect } from '@playwright/test';
import { type Patient } from './patient-operations';

export interface CohortType {
uuid: string;
name: string;
description: string;
display: string;
links: { rel: string; uri: string; resourceAlias: string }[];
resourceVersion: string;
}

export interface Cohort {
uuid: string;
name: string;
description: string;
attributes: any[];
links: any[];
location: any;
groupCohort: boolean | null;
startDate: Date;
endDate: Date;
voidReason: string | null;
voided: boolean;
isStarred?: boolean;
type?: string;
size: number;
cohortType?: CohortType;
resourceVersion: string;
}

export interface CohortMember {
attributes: Array<any>;
description: string;
endDate: string;
startDate: string;
name: string;
uuid: string;
patient: Patient;
}
import { type Cohort, type CohortMember } from '../types';

export const generateRandomCohort = async (api: APIRequestContext): Promise<Cohort> => {
const cohortRes = await api.post('cohortm/cohort', {
Expand Down
4 changes: 2 additions & 2 deletions e2e/commands/encounter-operations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Encounter } from './../../packages/esm-active-visits-app/src/visits-summary/visit.resource';
import { APIRequestContext, expect } from '@playwright/test';
import { type APIRequestContext, expect } from '@playwright/test';
import dayjs from 'dayjs';
import { type Encounter } from '../types';

export const createEncounter = async (
api: APIRequestContext,
Expand Down
47 changes: 1 addition & 46 deletions e2e/commands/patient-operations.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
import { type APIRequestContext, expect } from '@playwright/test';

export interface Patient {
uuid: string;
identifiers: Identifier[];
display: string;
person: {
uuid: string;
display: string;
gender: string;
age: number;
birthdate: string;
birthdateEstimated: boolean;
dead: boolean;
deathDate?: any;
causeOfDeath?: any;
preferredAddress: {
address1: string;
cityVillage: string;
country: string;
postalCode: string;
stateProvince: string;
countyDistrict: string;
};
attributes: any[];
voided: boolean;
birthtime?: any;
deathdateEstimated: boolean;
resourceVersion: string;
};
attributes: { value: string; attributeType: { uuid: string; display: string } }[];
voided: boolean;
}

export interface Address {
preferred: boolean;
address1: string;
cityVillage: string;
country: string;
postalCode: string;
stateProvince: string;
}

export interface Identifier {
uuid: string;
display: string;
}
import { type Patient } from '../types';

export const generateRandomPatient = async (api: APIRequestContext): Promise<Patient> => {
const identifierRes = await api.post('idgen/identifiersource/8549f706-7e85-4c1d-9424-217d50a2988b/identifier', {
Expand Down
4 changes: 2 additions & 2 deletions e2e/commands/provider-operations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provider } from '../../packages/esm-appointments-app/src/types/index';
import { APIRequestContext, expect } from '@playwright/test';
import { type APIRequestContext, expect } from '@playwright/test';
import { type Provider } from '../types';

export const getProvider = async (api: APIRequestContext): Promise<Provider> => {
const providerRes = await api.get('provider?q=admin', {
Expand Down
4 changes: 2 additions & 2 deletions e2e/commands/visit-operations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIRequestContext, expect } from '@playwright/test';
import { Visit } from '@openmrs/esm-framework';
import { type APIRequestContext, expect } from '@playwright/test';
import dayjs from 'dayjs';
import { type Visit } from '@openmrs/esm-framework';

export const startVisit = async (api: APIRequestContext, patientId: string): Promise<Visit> => {
const visitRes = await api.post('visit', {
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/home-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test';
import { type Page } from '@playwright/test';

export class HomePage {
constructor(readonly page: Page) {}
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/patient-lists-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test';
import { type Page } from '@playwright/test';

export class PatientListsPage {
constructor(readonly page: Page) {}
Expand Down
Loading

0 comments on commit 1d0b40a

Please sign in to comment.