Skip to content

Commit 3e016b0

Browse files
authored
test: epic 3 no transformation check if reason is not RDR, RDI or RPR (#970)
* test: chore allow selective epic regression * test: epic 3 no transformation check if reason is not RDR, RDI or RPR * test: check epic 3 tests on ado pl * test: check full regression using ado pl on dev * test: point back to smoke e2e as default test scope
1 parent 145be78 commit 3e016b0

File tree

6 files changed

+179
-4
lines changed

6 files changed

+179
-4
lines changed

tests/playwright-tests/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
"scripts": {
66
"test:data:service": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@data @service\"",
77
"test:smoke:api": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@smoke @api\"",
8-
"test:smoke:e2e": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@smoke @e2e\"",
98
"test:regression:api": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@regression @api\"",
9+
"test:smoke:e2e": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@smoke @e2e\"",
1010
"test:regression:e2e": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@regression @e2e\"",
11+
"test:regression:e2e:epic1": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic1-",
12+
"test:regression:e2e:epic2": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic2-",
13+
"test:regression:e2e:epic3": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic3-",
1114
"test": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@smoke @e2e\"",
1215
"test:ut": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@ut\"",
1316
"lint": "eslint . --ext .ts",
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+
export const getRecordsFromExceptionService = (
7+
request: APIRequestContext
8+
): Promise<ApiResponse> => {
9+
return apiClient.get(request, `${config.endpointExceptionManagementDataService}api/${config.exceptionManagementService}`);
10+
};
11+

tests/playwright-tests/src/api/responseValidators.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ApiResponse, ResponseValidator } from '../api/core/types';
55
export const expectStatus = <T>(expectedStatus: number): ResponseValidator<ApiResponse<T>> =>
66
async (response: ApiResponse<T>): Promise<void> => {
77
expect(response.status).toBe(expectedStatus);
8+
console.info(`✅\t Verified Status code to be : ${response.status}`);
89
};
910

1011
export const validateResponseByStatus = <T>(): ResponseValidator<ApiResponse<T>> =>

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

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { test } from '../../fixtures/test-fixtures';
1+
import { getRecordsFromExceptionService } from '../../../api/dataService/exceptionService';
2+
import { composeValidators, expectStatus, validateResponseByStatus } from '../../../api/responseValidators';
3+
import { test, testWithAmended } from '../../fixtures/test-fixtures';
24
import { TestHooks } from '../../hooks/test-hooks';
3-
import { validateSqlDatabaseFromAPI } from "../../steps/steps";
5+
import { processFileViaStorage, validateSqlDatabaseFromAPI } from "../../steps/steps";
46

57

68
test.describe('@regression @e2e @epic3-high-priority Tests', () => {
79

8-
TestHooks.setupAddTestHooks();
10+
TestHooks.setupAllTestHooks();
911

1012
test('@DTOSS-6326-01 - Transformation - Invalid Flag triggers Reason for Removal logic - should apply correct transformations when invalidFlag is true', {
1113
annotation: {
@@ -25,5 +27,43 @@ test.describe('@regression @e2e @epic3-high-priority Tests', () => {
2527
await validateSqlDatabaseFromAPI(request, checkInDatabaseRunTime);
2628
});
2729
});
30+
31+
testWithAmended('@DTOSS-5596-01 - Transformation - does not trigger removal logic when Reason for Removal is NOT - RDR, RDI, RPR', {
32+
annotation: {
33+
type: 'Requirement',
34+
description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-4771',
35+
},
36+
}, async ({ request, testData }) => {
37+
38+
await test.step('And ADD participants are processed successfully', async () => {
39+
await validateSqlDatabaseFromAPI(request, testData.checkInDatabaseAdd);
40+
});
41+
42+
await test.step('And there should be transformation exceptions rule trigger for ADD participant', async () => {
43+
const records = await getRecordsFromExceptionService(request);
44+
45+
const genericValidations = composeValidators(
46+
expectStatus(204),
47+
validateResponseByStatus()
48+
);
49+
await genericValidations(records);
50+
51+
});
52+
await test.step('Then removal logic should not be triggered, and Reason for Removal should be null', async () => {
53+
await processFileViaStorage(testData.runTimeParquetFileAmend);
54+
await validateSqlDatabaseFromAPI(request, testData.checkInDatabaseAmend);
55+
});
56+
57+
await test.step('And there should be transformation exceptions rule trigger for AMENDED participant', async () => {
58+
const records = await getRecordsFromExceptionService(request);
59+
60+
const genericValidations = composeValidators(
61+
expectStatus(204),
62+
validateResponseByStatus()
63+
);
64+
await genericValidations(records);
65+
66+
});
67+
});
2868
});
2969

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": 9992728167,
7+
"ReasonForRemoval": null
8+
}
9+
}
10+
],
11+
"inputParticipantRecord": [
12+
{
13+
"record_type": "ADD",
14+
"change_time_stamp": null,
15+
"serial_change_number": 98,
16+
"nhs_number": 9992728167,
17+
"superseded_by_nhs_number": null,
18+
"primary_care_provider": "A81623",
19+
"primary_care_effective_from_date": "20030318",
20+
"current_posting": "LA",
21+
"current_posting_effective_from_date": "20130319",
22+
"name_prefix": "BRO",
23+
"given_name": "Name",
24+
"other_given_name": "OtherGivenName 98",
25+
"family_name": "FamiliyName 98",
26+
"previous_family_name": "PreviousFamilyName 98",
27+
"date_of_birth": "19700101",
28+
"gender": 2,
29+
"address_line_1": "98 Spaight Road",
30+
"address_line_2": "Eastbourne",
31+
"address_line_3": "TestAddress",
32+
"address_line_4": "Chelmsford",
33+
"address_line_5": "United Kingdom",
34+
"postcode": "AL1 8FJ",
35+
"paf_key": "Z3S4Q5X9",
36+
"address_effective_from_date": "20130319",
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": "20200818",
43+
"mobile_telephone_number": "07888888888",
44+
"mobile_telephone_effective_from_date": "20200818",
45+
"email_address": "[email protected]",
46+
"email_address_effective_from_date": "20200818",
47+
"preferred_language": "en",
48+
"is_interpreter_required": false,
49+
"invalid_flag": false,
50+
"eligibility": true
51+
}
52+
],
53+
"nhsNumbers": [
54+
"9992728167"
55+
]
56+
}
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+
"GivenName": "UpdatedName",
7+
"NHSNumber": 9992728167,
8+
"ReasonForRemoval": null
9+
}
10+
},
11+
{
12+
"validations": {
13+
"apiEndpoint": "api/ParticipantManagementDataService",
14+
"RecordType": "AMENDED",
15+
"NHSNumber": 9992728167
16+
}
17+
}
18+
],
19+
"inputParticipantRecord": [
20+
{
21+
"record_type": "AMENDED",
22+
"change_time_stamp": null,
23+
"serial_change_number": 98,
24+
"nhs_number": 9992728167,
25+
"superseded_by_nhs_number": null,
26+
"primary_care_provider": "A81623",
27+
"primary_care_effective_from_date": "20030318",
28+
"current_posting": "LA",
29+
"current_posting_effective_from_date": "20130319",
30+
"name_prefix": "BRO",
31+
"given_name": "UpdatedName",
32+
"other_given_name": "OtherGivenName 98",
33+
"family_name": "FamiliyName 98",
34+
"previous_family_name": "PreviousFamilyName 98",
35+
"date_of_birth": "19700101",
36+
"gender": 2,
37+
"address_line_1": "98 Spaight Road",
38+
"address_line_2": "Eastbourne",
39+
"address_line_3": "TestAddress",
40+
"address_line_4": "Chelmsford",
41+
"address_line_5": "United Kingdom",
42+
"postcode": "AL1 8FJ",
43+
"paf_key": "Z3S4Q5X9",
44+
"address_effective_from_date": "20130319",
45+
"reason_for_removal": null,
46+
"reason_for_removal_effective_from_date": null,
47+
"date_of_death": null,
48+
"death_status": null,
49+
"home_telephone_number": "01619999999",
50+
"home_telephone_effective_from_date": "20200818",
51+
"mobile_telephone_number": "07888888888",
52+
"mobile_telephone_effective_from_date": "20200818",
53+
"email_address": "[email protected]",
54+
"email_address_effective_from_date": "20200818",
55+
"preferred_language": "en",
56+
"is_interpreter_required": false,
57+
"invalid_flag": false,
58+
"eligibility": true
59+
}
60+
],
61+
"nhsNumbers": [
62+
"9992728167"
63+
]
64+
}

0 commit comments

Comments
 (0)