Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/base-deploy-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ jobs:
IMAGE_TAG: latest
IMAGE_TAG_SHA: ${{ github.sha }}
CONTAINER_PORT: ${{ env.CONTAINER_PORT }}
BUILD_ENV: ${{ inputs.environment }}
run: |
docker build \
--build-arg="CONTAINER_PORT=$CONTAINER_PORT" \
--build-arg="CLOUDFRONT_DOMAIN_NAME=$CLOUDFRONT_DOMAIN_NAME" \
--build-arg="BUILD_ENV=$BUILD_ENV" \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_SHA .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
Expand Down
5 changes: 4 additions & 1 deletion app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ RUN mkdir -p ./public/pdfjs
RUN wget https://github.com/mozilla/pdf.js/releases/download/v5.4.296/pdfjs-5.4.296-dist.zip -O ./public/pdfjs/pdfjs.zip
RUN unzip -o -d ./public/pdfjs ./public/pdfjs/pdfjs.zip
RUN rm ./public/pdfjs/pdfjs.zip
RUN npm run build

ARG BUILD_ENV=development
ARG BUILD_ENV=$BUILD_ENV
RUN npm run build -- --mode $BUILD_ENV

# Host the App
FROM nginx:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ describe('GP Clinical user role has access to the expected GP_CLINICAL workflow
cy.url().should('eq', baseUrl + lloydGeorgeViewUrl);
});
});
});
});
49 changes: 37 additions & 12 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@testing-library/react": "16.3.0",
"@testing-library/user-event": "14.6.1",
"@vitejs/plugin-react-swc": "^4.2.2",
"@zip.js/zip.js": "^2.8.11",
"aws-rum-web": "^1.25.0",
"axios": "^1.13.2",
"dotenv": "^17.2.3",
Expand Down Expand Up @@ -79,8 +80,8 @@
"@types/uuid": "^11.0.0",
"@types/validator": "^13.15.10",
"@vitest/coverage-v8": "^4.0.13",
"@vitest/ui": "^4.0.13",
"@vitest/spy": "^4.0.13",
"@vitest/ui": "^4.0.13",
"babel-plugin-named-exports-order": "^0.0.2",
"cypress": "^15.7.0",
"cypress-real-events": "^1.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import {
} from '../../../../types/pages/UploadDocumentsPage/types';
import { MemoryRouter } from 'react-router-dom';
import { fileUploadErrorMessages } from '../../../../helpers/utils/fileUploadErrorMessages';
import { buildLgFile } from '../../../../helpers/test/testBuilders';
import { buildDocumentConfig, buildLgFile } from '../../../../helpers/test/testBuilders';
import { Mock } from 'vitest';
import { DOCUMENT_TYPE } from '../../../../helpers/utils/documentType';
import { DOCUMENT_TYPE, DOCUMENT_TYPE_CONFIG } from '../../../../helpers/utils/documentType';

const mockNavigate = vi.fn();
const mockSetDocuments = vi.fn();
const mockSetMergedPdfBlob = vi.fn();
const mockConfirmFiles = vi.fn();

vi.mock('../../../../helpers/hooks/usePatient');
vi.mock('../../../../helpers/hooks/useTitle');
Expand Down Expand Up @@ -44,17 +45,21 @@ vi.mock('../documentUploadLloydGeorgePreview/DocumentUploadLloydGeorgePreview',
}
return (
<div data-testid="lloyd-george-preview">
Lloyd George Preview for {documents.length} documents
<h2>{docConfig.content.previewUploadTitle}</h2>
<p>Previewing: {documents[0]?.file.name}</p>
</div>
);
},
}));

let docConfig: DOCUMENT_TYPE_CONFIG;

describe('DocumentSelectOrderStage', () => {
let documents: UploadDocument[] = [];

beforeEach(() => {
import.meta.env.VITE_ENVIRONMENT = 'vitest';
docConfig = buildDocumentConfig();
documents = [
{
docType: DOCUMENT_TYPE.LLOYD_GEORGE,
Expand Down Expand Up @@ -128,7 +133,9 @@ describe('DocumentSelectOrderStage', () => {
renderSut(documents);

await waitFor(() => {
expect(screen.getByText('Preview this Lloyd George record')).toBeInTheDocument();
expect(
screen.getByText(docConfig.content.previewUploadTitle as string),
).toBeInTheDocument();
expect(screen.getByTestId('lloyd-george-preview')).toBeInTheDocument();
});
});
Expand Down Expand Up @@ -476,7 +483,46 @@ describe('DocumentSelectOrderStage', () => {

await waitFor(() => {
expect(
screen.getByText('Lloyd George Preview for 2 documents'),
screen.getByText(docConfig.content.previewUploadTitle as string),
).toBeInTheDocument();
});
});

it('loads currently selected document into PDF viewer', async () => {
docConfig = buildDocumentConfig({
stitched: false,
snomedCode: DOCUMENT_TYPE.EHR_ATTACHMENTS,
});

const multipleDocuments = [
{
docType: DOCUMENT_TYPE.EHR_ATTACHMENTS,
id: '1',
file: buildLgFile(1),
attempts: 0,
state: DOCUMENT_UPLOAD_STATE.SELECTED,
numPages: 5,
position: 1,
},
{
docType: DOCUMENT_TYPE.EHR_ATTACHMENTS,
id: '2',
file: buildLgFile(2),
attempts: 0,
state: DOCUMENT_UPLOAD_STATE.SELECTED,
numPages: 3,
position: 2,
},
];

renderSut(multipleDocuments);

await waitFor(() => {
expect(
screen.getByText(docConfig.content.previewUploadTitle as string),
).toBeInTheDocument();
expect(
screen.getByText(`Previewing: ${multipleDocuments[0].file.name}`),
).toBeInTheDocument();
});
});
Expand All @@ -502,10 +548,7 @@ describe('DocumentSelectOrderStage', () => {
await user.click(continueButton!);

await waitFor(() => {
expect(mockNavigate).toHaveBeenCalledWith({
pathname: '/patient/document-upload/in-progress',
search: 'journey=update',
});
expect(mockConfirmFiles).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -544,7 +587,7 @@ describe('DocumentSelectOrderStage', () => {

expect(
screen.getByText(
"When you upload your files, they will be added to the end of the patient's existing Lloyd George record.",
`When you upload your files, they will be added to the end of the patient's existing ${docConfig.displayName}.`,
),
).toBeInTheDocument();
expect(
Expand All @@ -562,7 +605,7 @@ describe('DocumentSelectOrderStage', () => {

expect(
screen.getByText(
"When you upload your files, they will be added to the end of the patient's existing Lloyd George record.",
`When you upload your files, they will be added to the end of the patient's existing ${docConfig.displayName}.`,
),
).toBeInTheDocument();

Expand Down Expand Up @@ -593,7 +636,7 @@ describe('DocumentSelectOrderStage', () => {

renderSutWithExistingDocs(documents, existingDocs);

expect(screen.getByText('Existing Lloyd George record')).toBeInTheDocument();
expect(screen.getByText(`Existing ${docConfig.displayName}`)).toBeInTheDocument();
});

it('existing Lloyd George record has position 1 and cannot be repositioned or removed', () => {
Expand All @@ -613,7 +656,7 @@ describe('DocumentSelectOrderStage', () => {

const rows = screen.getAllByRole('row');
const existingRow = rows.find((row) =>
row.textContent?.includes('Existing Lloyd George record'),
row.textContent?.includes(`Existing ${docConfig.displayName}`),
);

expect(existingRow).toBeInTheDocument();
Expand Down Expand Up @@ -817,6 +860,8 @@ function renderSutWithExistingDocs(
setDocuments={mockSetDocuments}
setMergedPdfBlob={mockSetMergedPdfBlob}
existingDocuments={existingDocuments}
documentConfig={docConfig}
confirmFiles={mockConfirmFiles}
/>
</MemoryRouter>,
);
Expand All @@ -830,6 +875,8 @@ function renderSut(documents: UploadDocument[]): void {
setDocuments={mockSetDocuments}
setMergedPdfBlob={mockSetMergedPdfBlob}
existingDocuments={[]}
documentConfig={docConfig}
confirmFiles={mockConfirmFiles}
/>
</MemoryRouter>,
);
Expand Down
Loading
Loading