Skip to content

Commit 2523be0

Browse files
authored
test: check records are sent to bs select and is extracted is updated… (#976)
* test: check records are sent to bs select and is extracted is updated to 1 * test: fix flag name IsExtracted
1 parent 7efb163 commit 2523be0

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { APIRequestContext } from '@playwright/test';
2+
import * as apiClient from '../apiClient';
3+
import { config } from '../../config/env';
4+
import { ApiResponse } from '../core/types';
5+
6+
7+
export const getRecordsFromCohortDistributionService = (
8+
request: APIRequestContext
9+
): Promise<ApiResponse> => {
10+
return apiClient.get(request, `${config.endpointCohortDistributionDataService}api/${config.cohortDistributionService}`);
11+
};

tests/playwright-tests/src/tests/e2e/epic3-highpriority-tests/epic3-high-priority-testsuite.spec.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { getRecordsFromExceptionService } from '../../../api/dataService/exceptionService';
2+
import { getRecordsFromBsSelectRetrieveCohort } from '../../../api/distributionService/bsSelectService';
23
import { composeValidators, expectStatus, validateResponseByStatus } from '../../../api/responseValidators';
3-
import { test, testWithAmended } from '../../fixtures/test-fixtures';
4+
import { expect, test, testWithAmended } from '../../fixtures/test-fixtures';
45
import { TestHooks } from '../../hooks/test-hooks';
56
import { processFileViaStorage, validateSqlDatabaseFromAPI } from "../../steps/steps";
7+
import { getRecordsFromCohortDistributionService } from '../../../api/dataService/cohortDistributionService';
68

79

810
test.describe('@regression @e2e @epic3-high-priority Tests', () => {
@@ -65,5 +67,28 @@ test.describe('@regression @e2e @epic3-high-priority Tests', () => {
6567

6668
});
6769
});
70+
71+
test('@DTOSS-5560-01 - BS Select - Records are received where IsExtracted is set to 0', {
72+
annotation: {
73+
type: 'Requirement',
74+
description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-3650',
75+
},
76+
}, async ({ request, testData }) => {
77+
78+
await test.step('Then processed ADD participant should be received using bs select get request where IsExtracted = 0', async () => {
79+
await validateSqlDatabaseFromAPI(request, testData.checkInDatabase);
80+
const ExpectedRowCount = 1;
81+
82+
const response = await getRecordsFromBsSelectRetrieveCohort(request, { rowCount: 10, screeningServiceId: 1 });
83+
expect(response.data.length).toBe(ExpectedRowCount);
84+
85+
});
86+
87+
await test.step('And IsExtracted flag is set to 1', async () => {
88+
const response = await getRecordsFromCohortDistributionService(request);
89+
const firstRecord = response.data.find(() => true);
90+
expect(firstRecord?.IsExtracted).toBe(1);
91+
});
92+
});
6893
});
6994

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

0 commit comments

Comments
 (0)