From e4d502c625f5ba42687c8f6e9a045aaa72abbf6b Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Wed, 21 Jan 2026 12:10:32 +0000
Subject: [PATCH 1/6] WIP - add review item to the review table fix
---
.../review_reassign_happy_workflow.cy.js | 26 +++++++++++++++++++
.../example-review-h81109.json | 17 ++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
create mode 100644 app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
new file mode 100644
index 000000000..5c1426c03
--- /dev/null
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -0,0 +1,26 @@
+import { Roles } from '../../../support/roles';
+import dbItem from '../../../fixtures/dynamo-db-items/example-review-h81109.json';
+
+const workspace = Cypress.env('WORKSPACE');
+const tableName = `${workspace}_DocumentUploadReview`;
+
+describe('GP Workflow: Review and Reassign', () => {
+ context('Review and Reassign', () => {
+ beforeEach(() => {
+ // cy.deleteItemFromDynamoDb(tableName, dbItem.ID.S);
+ cy.addItemToDynamoDb(tableName, dbItem);
+ });
+
+ afterEach(() => {
+ // cy.deleteItemFromDynamoDb(tableName, dbItem.ID.S);
+ });
+
+ it(
+ '[Smoke] GP ADMIN user can download the Lloyd George document of an active patient',
+ { tags: 'smoke', defaultCommandTimeout: 20000 },
+ () => {
+ cy.smokeLogin(Roles.SMOKE_GP_ADMIN);
+ },
+ );
+ });
+});
diff --git a/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
new file mode 100644
index 000000000..7a93995b8
--- /dev/null
+++ b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
@@ -0,0 +1,17 @@
+{
+ "ID": "e3e4f62e-6f95-4d8c-8870-5212b6353ae9",
+ "Version": 1,
+ "Author": "H81109",
+ "Custodian": "H81109",
+ "DocumentSnomedCodeType": "734163000",
+ "Files": [
+ {
+ "FileLocation": "s3://ndrk-document-pending-review-store/e3e4f62e-6f95-4d8c-8870-5212b6353ae9/review_9730155348.txt",
+ "FileName": "review_9730155348.txt"
+ }
+ ],
+ "NhsNumber": "9730155348",
+ "ReviewReason": "Unknown NHS number",
+ "ReviewStatus": "PENDING_REVIEW",
+ "UploadDate": 1768728372
+}
\ No newline at end of file
From 1e7a802d5e459b6de1e03e2e0635013935cd08bb Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Thu, 22 Jan 2026 08:14:04 +0000
Subject: [PATCH 2/6] WIP - click admin console
---
.../review_reassign_happy_workflow.cy.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
index 5c1426c03..a208fc7bf 100644
--- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -20,6 +20,21 @@ describe('GP Workflow: Review and Reassign', () => {
{ tags: 'smoke', defaultCommandTimeout: 20000 },
() => {
cy.smokeLogin(Roles.SMOKE_GP_ADMIN);
+
+ // click admin console
+ cy.navigateToHomePage();
+ cy.getByTestId('admin-console-btn').should('exist').click();
+
+ // click review docs
+
+ // find the example review item by nhs number and view it
+
+ // click "dont accept the record"
+
+ // find the textbox and search for the correct nhs number to reassign to
+ // confirm demographics of the new patient and continue
+
+ // assert reassignment success message
},
);
});
From 40d221f3dcdef2a1b1f875f822e86f38dc17d9db Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Thu, 22 Jan 2026 14:20:28 +0000
Subject: [PATCH 3/6] WIP
---
.../review_reassign_happy_workflow.cy.js | 25 ++++++++++++++++---
.../example-review-h81109.json | 6 ++---
.../ReviewsDetailsStage.tsx | 9 +++++--
.../patientVerifyPage/PatientVerifyPage.tsx | 7 +++++-
4 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
index a208fc7bf..667dac6b8 100644
--- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -3,12 +3,15 @@ import dbItem from '../../../fixtures/dynamo-db-items/example-review-h81109.json
const workspace = Cypress.env('WORKSPACE');
const tableName = `${workspace}_DocumentUploadReview`;
+const path = `9730155348/e3e4f62e-6f95-4d8c-8870-5212b6353ae9/test_patient_record.pdf`;
+const bucketName = `${workspace}-document-pending-review-store`;
describe('GP Workflow: Review and Reassign', () => {
context('Review and Reassign', () => {
beforeEach(() => {
// cy.deleteItemFromDynamoDb(tableName, dbItem.ID.S);
cy.addItemToDynamoDb(tableName, dbItem);
+ cy.addPdfFileToS3(bucketName, path, 'test_patient_record.pdf');
});
afterEach(() => {
@@ -26,13 +29,29 @@ describe('GP Workflow: Review and Reassign', () => {
cy.getByTestId('admin-console-btn').should('exist').click();
// click review docs
+ cy.getByTestId('admin-reviews-btn').should('exist').click();
// find the example review item by nhs number and view it
-
- // click "dont accept the record"
+ cy.getByTestId('view-record-link-e3e4f62e-6f95-4d8c-8870-5212b6353ae9')
+ .should('exist')
+ .click();
+
+ // click "dont accept the record" and continue
+ cy.get('input[type="radio"][value="no"]').should('exist').check();
+ cy.get('input[type="radio"][value="no"]').should('be.checked');
+ cy.get('button[type="submit"]').should('exist').click();
+ // cy.getByTestId('reject-record-option').should('exist').check();
+ // cy.getByTestId('reject-record-option').should('be.checked');
+ // cy.getByTestId('continue-btn').should('exist').click();
// find the textbox and search for the correct nhs number to reassign to
- // confirm demographics of the new patient and continue
+ cy.getByTestId('nhs-number-input').should('exist').click();
+ cy.getByTestId('nhs-number-input').type('9730788197');
+ cy.get('button[type="submit"]').should('exist').click();
+
+ // confirm demographics of the new patient and continue
+ // cy.getByTestId('confirm-patient-details-btn').should('exist').click();
+ cy.get('button[type="submit"]').should('exist').click();
// assert reassignment success message
},
diff --git a/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
index 7a93995b8..9ac856455 100644
--- a/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
+++ b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
@@ -3,11 +3,11 @@
"Version": 1,
"Author": "H81109",
"Custodian": "H81109",
- "DocumentSnomedCodeType": "734163000",
+ "DocumentSnomedCodeType": "16521000000101",
"Files": [
{
- "FileLocation": "s3://ndrk-document-pending-review-store/e3e4f62e-6f95-4d8c-8870-5212b6353ae9/review_9730155348.txt",
- "FileName": "review_9730155348.txt"
+ "FileLocation": "s3://ndrk-document-pending-review-store/9730155348/e3e4f62e-6f95-4d8c-8870-5212b6353ae9/test_patient_record.pdf",
+ "FileName": "test_patient_record.pdf"
}
],
"NhsNumber": "9730155348",
diff --git a/app/src/components/blocks/_admin/reviewsDetailsStage/ReviewsDetailsStage.tsx b/app/src/components/blocks/_admin/reviewsDetailsStage/ReviewsDetailsStage.tsx
index 78001edb1..c2c47e118 100644
--- a/app/src/components/blocks/_admin/reviewsDetailsStage/ReviewsDetailsStage.tsx
+++ b/app/src/components/blocks/_admin/reviewsDetailsStage/ReviewsDetailsStage.tsx
@@ -357,12 +357,17 @@ const ReviewsDetailsStage = ({
Yes, the details match and I want to accept this document
-
+
No, I don't want to accept this document. None of the details match the
demographics shown
-
-
+
Confirm patient details and continue
From 50bc59cefe134fa5e0e7d68d0862d014e6072d1d Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Thu, 22 Jan 2026 15:50:21 +0000
Subject: [PATCH 4/6] review reassign smoke test rc
---
.../review_reassign_happy_workflow.cy.js | 44 +++++++++++++-----
app/cypress/support/aws.commands.ts | 45 +++++++++++--------
2 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
index 667dac6b8..ab445a176 100644
--- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -9,13 +9,14 @@ const bucketName = `${workspace}-document-pending-review-store`;
describe('GP Workflow: Review and Reassign', () => {
context('Review and Reassign', () => {
beforeEach(() => {
- // cy.deleteItemFromDynamoDb(tableName, dbItem.ID.S);
cy.addItemToDynamoDb(tableName, dbItem);
cy.addPdfFileToS3(bucketName, path, 'test_patient_record.pdf');
});
afterEach(() => {
- // cy.deleteItemFromDynamoDb(tableName, dbItem.ID.S);
+ cy.deleteItemFromDynamoDb(tableName, dbItem.ID, 1);
+ cy.deleteItemFromDynamoDb(tableName, dbItem.ID, 2);
+ cy.deleteFileFromS3(bucketName, path);
});
it(
@@ -37,23 +38,42 @@ describe('GP Workflow: Review and Reassign', () => {
.click();
// click "dont accept the record" and continue
- cy.get('input[type="radio"][value="no"]').should('exist').check();
- cy.get('input[type="radio"][value="no"]').should('be.checked');
- cy.get('button[type="submit"]').should('exist').click();
- // cy.getByTestId('reject-record-option').should('exist').check();
- // cy.getByTestId('reject-record-option').should('be.checked');
- // cy.getByTestId('continue-btn').should('exist').click();
+ cy.getByTestId('reject-record-option').should('exist').check();
+ cy.getByTestId('reject-record-option').should('be.checked');
+ cy.getByTestId('continue-btn').should('exist').click();
// find the textbox and search for the correct nhs number to reassign to
cy.getByTestId('nhs-number-input').should('exist').click();
cy.getByTestId('nhs-number-input').type('9730788197');
- cy.get('button[type="submit"]').should('exist').click();
+ cy.getByTestId('continue-button').should('exist').click();
// confirm demographics of the new patient and continue
- // cy.getByTestId('confirm-patient-details-btn').should('exist').click();
- cy.get('button[type="submit"]').should('exist').click();
+ cy.getByTestId('confirm-patient-details-btn').should('exist').click();
- // assert reassignment success message
+ // assert reassignment success message and path
+ cy.contains('This document has been matched to the correct patient').should(
+ 'be.visible',
+ );
+ cy.url().should('contain', '/admin/reviews/:reviewId/complete/patient-matched');
+
+ // assert the review is no longer in our review queue
+ cy.getByTestId('review-another-btn').should('exist').click();
+ cy.getByTestId('view-record-link-e3e4f62e-6f95-4d8c-8870-5212b6353ae9').should(
+ 'not.exist',
+ );
+
+ // logout
+ cy.getByTestId('logout-btn').click();
+
+ // login as new ods code to verify the document is now in their review queue
+ cy.getByTestId('start-btn').should('exist'); // wait for login button to appear after logout
+ cy.smokeLogin(Roles.SMOKE_GP_ADMIN, 'M85143');
+ cy.navigateToHomePage();
+ cy.getByTestId('admin-console-btn').should('exist').click();
+ cy.getByTestId('admin-reviews-btn').should('exist').click();
+ cy.getByTestId('view-record-link-e3e4f62e-6f95-4d8c-8870-5212b6353ae9').should(
+ 'exist',
+ );
},
);
});
diff --git a/app/cypress/support/aws.commands.ts b/app/cypress/support/aws.commands.ts
index 364fcf3d9..05dd472dd 100644
--- a/app/cypress/support/aws.commands.ts
+++ b/app/cypress/support/aws.commands.ts
@@ -91,26 +91,35 @@ Cypress.Commands.add('deleteFileFromS3', (bucketName: string, fileName: string)
);
});
-Cypress.Commands.add('deleteItemFromDynamoDb', (tableName: string, itemId: string) => {
- const params: DeleteItemCommandInput = {
- TableName: tableName,
- Key: {
+Cypress.Commands.add(
+ 'deleteItemFromDynamoDb',
+ (tableName: string, itemId: string, version?: number) => {
+ const key: DeleteItemCommandInput['Key'] = {
ID: { S: itemId },
- },
- };
+ };
- return cy.wrap(
- dynamo
- .send(new DeleteItemCommand(params))
- .then((data) => data)
- .catch((err) => {
- const message = 'Error deleting item from Dynamo: ' + tableName;
- // eslint-disable-next-line no-console
- console.error(message, err);
- throw new Error(message);
- }),
- );
-});
+ if (version !== undefined) {
+ key.Version = { N: version.toString() };
+ }
+
+ const params: DeleteItemCommandInput = {
+ TableName: tableName,
+ Key: key,
+ };
+
+ return cy.wrap(
+ dynamo
+ .send(new DeleteItemCommand(params))
+ .then((data) => data)
+ .catch((err) => {
+ const message = 'Error deleting item from Dynamo: ' + tableName;
+ // eslint-disable-next-line no-console
+ console.error(message, err);
+ throw new Error(message);
+ }),
+ );
+ },
+);
Cypress.Commands.add(
'deleteItemsBySecondaryKeyFromDynamoDb',
From 5e986e42d206ab88a2ca21263040e7f2cd85cc48 Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Thu, 22 Jan 2026 16:14:53 +0000
Subject: [PATCH 5/6] fix test name
---
.../gp_user_workflows/review_reassign_happy_workflow.cy.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
index ab445a176..985d32e53 100644
--- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -20,7 +20,7 @@ describe('GP Workflow: Review and Reassign', () => {
});
it(
- '[Smoke] GP ADMIN user can download the Lloyd George document of an active patient',
+ '[Smoke] GP ADMIN user can review and reassign a document to the correct patient',
{ tags: 'smoke', defaultCommandTimeout: 20000 },
() => {
cy.smokeLogin(Roles.SMOKE_GP_ADMIN);
From 3239575c6f736710c2e788d412619f22091c4659 Mon Sep 17 00:00:00 2001
From: Kamen Bachvarov
Date: Thu, 5 Feb 2026 15:23:41 +0000
Subject: [PATCH 6/6] fix admin hub datatestid and review reason
---
.../gp_user_workflows/review_reassign_happy_workflow.cy.js | 4 ++--
.../fixtures/dynamo-db-items/example-review-h81109.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
index 985d32e53..c142954a3 100644
--- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
+++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/review_reassign_happy_workflow.cy.js
@@ -27,7 +27,7 @@ describe('GP Workflow: Review and Reassign', () => {
// click admin console
cy.navigateToHomePage();
- cy.getByTestId('admin-console-btn').should('exist').click();
+ cy.getByTestId('admin-hub-btn').should('exist').click();
// click review docs
cy.getByTestId('admin-reviews-btn').should('exist').click();
@@ -69,7 +69,7 @@ describe('GP Workflow: Review and Reassign', () => {
cy.getByTestId('start-btn').should('exist'); // wait for login button to appear after logout
cy.smokeLogin(Roles.SMOKE_GP_ADMIN, 'M85143');
cy.navigateToHomePage();
- cy.getByTestId('admin-console-btn').should('exist').click();
+ cy.getByTestId('admin-hub-btn').should('exist').click();
cy.getByTestId('admin-reviews-btn').should('exist').click();
cy.getByTestId('view-record-link-e3e4f62e-6f95-4d8c-8870-5212b6353ae9').should(
'exist',
diff --git a/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
index 9ac856455..1732abe94 100644
--- a/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
+++ b/app/cypress/fixtures/dynamo-db-items/example-review-h81109.json
@@ -11,7 +11,7 @@
}
],
"NhsNumber": "9730155348",
- "ReviewReason": "Unknown NHS number",
+ "ReviewReason": "Unsuccessful upload",
"ReviewStatus": "PENDING_REVIEW",
"UploadDate": 1768728372
}
\ No newline at end of file