Skip to content

Commit 8459db2

Browse files
Merge branch 'main' into feat/DTOSS-10556-Exception-Reports
2 parents 0634738 + 8b8e65d commit 8459db2

7 files changed

Lines changed: 341 additions & 4 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"validations": [
3+
{
4+
"validations": {
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9990000026
7+
}
8+
}
9+
],
10+
"inputParticipantRecord": [
11+
{
12+
"record_type": null,
13+
"change_time_stamp": null,
14+
"serial_change_number": null,
15+
"nhs_number": null,
16+
"superseded_by_nhs_number": null,
17+
"primary_care_provider": "F83043",
18+
"primary_care_effective_from_date": "20130319",
19+
"current_posting": "CH",
20+
"current_posting_effective_from_date": "20130319",
21+
"name_prefix": "A.ML",
22+
"given_name": "NewTest1Updated",
23+
"other_given_name": "Test",
24+
"family_name": "Adani1",
25+
"previous_family_name": "Test2",
26+
"date_of_birth": "19700101",
27+
"gender": 1,
28+
"address_line_1": "247 SpaightSpaightSpTeeeeeeest Road",
29+
"address_line_2": "Eastbourne",
30+
"address_line_3": "Test",
31+
"address_line_4": "Chelmsford",
32+
"address_line_5": "United Kingdom",
33+
"postcode": "AB43 8FJ",
34+
"paf_key": "Z3S4Q5X9",
35+
"address_effective_from_date": null,
36+
"reason_for_removal": null,
37+
"reason_for_removal_effective_from_date": null,
38+
"date_of_death": null,
39+
"death_status": null,
40+
"home_telephone_number": "01619999999",
41+
"home_telephone_effective_from_date": "20240501",
42+
"mobile_telephone_number": "07888888888",
43+
"mobile_telephone_effective_from_date": "20240501",
44+
"email_address": "bturneux0@soup.io",
45+
"email_address_effective_from_date": null,
46+
"preferred_language": "en",
47+
"is_interpreter_required": false,
48+
"invalid_flag": false,
49+
"eligibility": true
50+
}
51+
],
52+
"nhsNumbers": [
53+
"9990000026"
54+
]
55+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"validations": [
3+
{
4+
"validations": {
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9998380197
7+
}
8+
},
9+
{
10+
"validations": {
11+
"apiEndpoint": "api/CohortDistributionDataService",
12+
"expectedCount": 4
13+
}
14+
}
15+
],
16+
"inputParticipantRecord": [
17+
{
18+
"record_type": "ADD",
19+
"change_time_stamp": null,
20+
"serial_change_number": 1,
21+
"nhs_number": null,
22+
"superseded_by_nhs_number": null,
23+
"primary_care_provider": "A81623",
24+
"primary_care_effective_from_date": "20240101",
25+
"current_posting": "LA",
26+
"current_posting_effective_from_date": "20240101",
27+
"name_prefix": "BRO",
28+
"given_name": "smith",
29+
"other_given_name": "OtherGivenName 1",
30+
"family_name": "smith",
31+
"previous_family_name": "PreviousFamilyName 1",
32+
"date_of_birth": "20101022",
33+
"gender": 2,
34+
"address_line_1": "1 Test Street",
35+
"address_line_2": "Test Area",
36+
"address_line_3": "TestAddress",
37+
"address_line_4": "Chelmsford",
38+
"address_line_5": "United Kingdom",
39+
"postcode": "LS1 1AA",
40+
"paf_key": "Z3S4Q5X9",
41+
"address_effective_from_date": "20240101",
42+
"reason_for_removal": null,
43+
"reason_for_removal_effective_from_date": null,
44+
"date_of_death": null,
45+
"death_status": null,
46+
"home_telephone_number": "01619999999",
47+
"home_telephone_effective_from_date": "20240101",
48+
"mobile_telephone_number": "07888888888",
49+
"mobile_telephone_effective_from_date": "20240101",
50+
"email_address": "blockedadd@example.com",
51+
"email_address_effective_from_date": "20240101",
52+
"preferred_language": "en",
53+
"is_interpreter_required": false,
54+
"invalid_flag": false,
55+
"eligibility": true
56+
}
57+
],
58+
"nhsNumbers": [
59+
"9998380197",
60+
"9995518112",
61+
"9995639327",
62+
"9995767732"
63+
]
64+
}

tests/playwright-tests/src/tests/e2e/epic4b-block-participant-tests/epic4b-7667-block-paricipant-tessuite.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ test.describe('@regression @e2e @epic4b-block-tests @smoke Tests', async () => {
103103
for(let i =0; i<10; i++)
104104
{
105105
const responseFromExceptions = await getRecordsFromExceptionService(request);
106-
if(responseFromExceptions.data !== null)
106+
if(responseFromExceptions.data.length >= 3)
107107
{
108108
validationExceptions = responseFromExceptions.data
109109
break;
@@ -124,8 +124,9 @@ test.describe('@regression @e2e @epic4b-block-tests @smoke Tests', async () => {
124124

125125
expect(response.status).toBe(200)
126126
expect(jsonResponse.length).toBe(1);
127-
expect(validationExceptions.length).toBe(1);
128-
expect(validationExceptions[0].RuleDescription).toBe("Participant is blocked");
127+
let objectToVerify = validationExceptions.find((o: { RuleDescription: string; }) => o.RuleDescription === 'Participant is blocked');
128+
expect(objectToVerify !== null || objectToVerify !== undefined).toBeTruthy()
129+
129130
});
130131
});
131132
});

tests/playwright-tests/src/tests/e2e/epic4b-block-participant-tests/epic4b-7675-block-paricipant-testsuite.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ annotation: [{
1616
test.describe('@regression @e2e @epic4b-block-tests @smoke Tests', async () => {
1717
TestHooks.setupAllTestHooks();
1818

19-
test('@DTOSS-7667-01 - AC1 - Verify participant is deleted from CohortDistributionDataService', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => {
19+
test('@DTOSS-7675-01 - AC1 - Verify participant is deleted from CohortDistributionDataService', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => {
2020
// Arrange: Get test data
2121
const [addValidations, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title, 'ADD_BLOCKED');
2222
const nhsNumber = nhsNumbers[0];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import { expect, test } from '../../fixtures/test-fixtures';
2+
import { createParquetFromJson } from '../../../parquet/parquet-multiplier';
3+
import { getApiTestData, processFileViaStorage, validateSqlDatabaseFromAPI, cleanupDatabaseFromAPI } from '../../steps/steps';
4+
import { getRecordsFromParticipantManagementService} from '../../../api/distributionService/bsSelectService';
5+
import { TestHooks } from '../../hooks/test-hooks';
6+
import { APIRequestContext, TestInfo } from '@playwright/test';
7+
import { config } from '../../../config/env';
8+
import { getRecordsFromExceptionService } from '../../../api/dataService/exceptionService';
9+
import { sendHttpGet, sendHttpPOSTCall } from '../../../api/core/sendHTTPRequest';
10+
import { json } from 'stream/consumers';
11+
12+
annotation: [{
13+
type: 'Requirement',
14+
description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-7667'
15+
}]
16+
17+
test.describe('@regression @e2e @epic4b-block-tests @smoke Tests', async () => {
18+
TestHooks.setupAllTestHooks();
19+
20+
test('@DTOSS-7728-01 - AC1 - Verify participant is deleted from CohortDistributionDataService', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => {
21+
// Arrange: Get test data
22+
const [addValidations, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title, 'ADD_BLOCKED');
23+
const nhsNumber = nhsNumbers[0];
24+
await cleanupDatabaseFromAPI(request, [nhsNumber]);
25+
26+
27+
const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath);
28+
29+
await test.step(`When I ADD participant is processed via storage ready to be blocked by the block function`, async () => {
30+
await processFileViaStorage(parquetFile);
31+
});
32+
33+
let nhsNumberFromPds = 0;
34+
let familyName = "";
35+
let dateOfBirth = "";
36+
37+
await test.step(`Verify that the participant can be able to add record to the participant management service.`, async () => {
38+
39+
await validateSqlDatabaseFromAPI(request, addValidations);
40+
});
41+
42+
43+
// Call the block participant function
44+
await test.step(`Go to PDS and get the participant data for the blocking of a participant that already exists in the database`, async () => {
45+
// Call the block participant function
46+
let url = `${config.createPDSDemographic}${config.createPDSDemographicPath}?nhsNumber=${nhsNumbers[0]}`;
47+
48+
let response = await sendHttpGet(url)
49+
expect(response.status).toBe(200)
50+
51+
let json = await response.json();
52+
nhsNumberFromPds = json["NhsNumber"];
53+
familyName = json["FamilyName"]
54+
dateOfBirth = json["DateOfBirth"];
55+
56+
expect(nhsNumberFromPds).toBeDefined()
57+
});
58+
59+
const blockPayload = {
60+
NhsNumber: Number(nhsNumberFromPds),
61+
FamilyName: familyName,
62+
DateOfBirth: dateOfBirth
63+
};
64+
65+
await test.step(`running step to make sure that item can be subscribed to in nems`, async () => {
66+
let subscribeToNemsResponse = await sendHttpPOSTCall(`${config.SubToNems}${config.SubToNemsPath}?nhsNumber=${nhsNumbers[0]}`, "");
67+
68+
expect(subscribeToNemsResponse.status).toBe(200);
69+
});
70+
71+
await test.step(`Send block to existing participant and make sure they are blocked`, async () => {
72+
73+
let url = `${config.endpointBsSelectUpdateBlockFlag}${config.routeBsSelectBlockParticipant}`;
74+
let body = JSON.stringify(blockPayload);
75+
let response = await sendHttpPOSTCall(url, body);
76+
expect(response.status).toBe(200);
77+
});
78+
79+
80+
await test.step(`verify that the person blocked was the correct NHS id and no other Ids`, async () => {
81+
let getUrl = `${config.endpointParticipantManagementDataService}api/${config.participantManagementService}`;
82+
var response = await sendHttpGet(getUrl);
83+
84+
const responseFromExceptions = await getRecordsFromExceptionService(request);
85+
86+
87+
let responseBodyJson = await response.json();
88+
89+
for(let i=0; i < json.length; i++ ) {
90+
let currentBlockedFlag = responseBodyJson[i].BlockedFlag;
91+
let currentNhsNumber = responseBodyJson[i].NHSNumber.toString();
92+
93+
if(currentNhsNumber === nhsNumber) {
94+
expect(currentBlockedFlag).toBe(1);
95+
console.info(`record with NHS number: ${nhsNumber} was blocked flag ${currentBlockedFlag}`);
96+
}
97+
else {
98+
console.info(`record with NHS number: ${nhsNumber} was blocked flag ${currentBlockedFlag}`);
99+
expect(currentBlockedFlag).toBe(0);
100+
}
101+
102+
}
103+
expect(responseFromExceptions.data).toBe(null)
104+
});
105+
106+
});
107+
});
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"validations": [
3+
{
4+
"validations": {
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9998380197
7+
}
8+
}
9+
],
10+
"inputParticipantRecord": [
11+
{
12+
"record_type": "ADD",
13+
"change_time_stamp": null,
14+
"serial_change_number": 1,
15+
"nhs_number": 9998380197,
16+
"superseded_by_nhs_number": null,
17+
"primary_care_provider": "A81623",
18+
"primary_care_effective_from_date": "20240101",
19+
"current_posting": "LA",
20+
"current_posting_effective_from_date": "20240101",
21+
"name_prefix": "BRO",
22+
"given_name": "smith",
23+
"other_given_name": "OtherGivenName 1",
24+
"family_name": "smith",
25+
"previous_family_name": "PreviousFamilyName 1",
26+
"date_of_birth": "20101022",
27+
"gender": 2,
28+
"address_line_1": "1 Test Street",
29+
"address_line_2": "Test Area",
30+
"address_line_3": "TestAddress",
31+
"address_line_4": "Chelmsford",
32+
"address_line_5": "United Kingdom",
33+
"postcode": "LS1 1AA",
34+
"paf_key": "Z3S4Q5X9",
35+
"address_effective_from_date": "20240101",
36+
"reason_for_removal": null,
37+
"reason_for_removal_effective_from_date": null,
38+
"date_of_death": null,
39+
"death_status": null,
40+
"home_telephone_number": "01619999999",
41+
"home_telephone_effective_from_date": "20240101",
42+
"mobile_telephone_number": "07888888888",
43+
"mobile_telephone_effective_from_date": "20240101",
44+
"email_address": "blockedadd@example.com",
45+
"email_address_effective_from_date": "20240101",
46+
"preferred_language": "en",
47+
"is_interpreter_required": false,
48+
"invalid_flag": false,
49+
"eligibility": true
50+
}
51+
],
52+
"nhsNumbers": [
53+
"9998380197"
54+
]
55+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"validations": [
3+
{
4+
"validations": {
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9998380197
7+
}
8+
}
9+
],
10+
"inputParticipantRecord": [
11+
{
12+
"record_type": "ADD",
13+
"change_time_stamp": null,
14+
"serial_change_number": 1,
15+
"nhs_number": 9998380197,
16+
"superseded_by_nhs_number": null,
17+
"primary_care_provider": "A81623",
18+
"primary_care_effective_from_date": "20240101",
19+
"current_posting": "LA",
20+
"current_posting_effective_from_date": "20240101",
21+
"name_prefix": "BRO",
22+
"given_name": "smith",
23+
"other_given_name": "OtherGivenName 1",
24+
"family_name": "smith",
25+
"previous_family_name": "PreviousFamilyName 1",
26+
"date_of_birth": "20101022",
27+
"gender": 2,
28+
"address_line_1": "1 Test Street",
29+
"address_line_2": "Test Area",
30+
"address_line_3": "TestAddress",
31+
"address_line_4": "Chelmsford",
32+
"address_line_5": "United Kingdom",
33+
"postcode": "LS1 1AA",
34+
"paf_key": "Z3S4Q5X9",
35+
"address_effective_from_date": "20240101",
36+
"reason_for_removal": null,
37+
"reason_for_removal_effective_from_date": null,
38+
"date_of_death": null,
39+
"death_status": null,
40+
"home_telephone_number": "01619999999",
41+
"home_telephone_effective_from_date": "20240101",
42+
"mobile_telephone_number": "07888888888",
43+
"mobile_telephone_effective_from_date": "20240101",
44+
"email_address": "blockedadd@example.com",
45+
"email_address_effective_from_date": "20240101",
46+
"preferred_language": "en",
47+
"is_interpreter_required": false,
48+
"invalid_flag": false,
49+
"eligibility": true
50+
}
51+
],
52+
"nhsNumbers": [
53+
"9998380197"
54+
]
55+
}

0 commit comments

Comments
 (0)