Skip to content

Commit d201c70

Browse files
authored
Merge branch 'main' into fix/new-rules
2 parents 5c17502 + 86a40e2 commit d201c70

9 files changed

Lines changed: 114 additions & 13 deletions

File tree

.azuredevops/pipelines/post-deployment-tests-dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ trigger: none
44
pr: none
55

66
schedules:
7-
- cron: "15 7 * * 1-5" # Every weekday (Mon-Fri) at 07:15 UTC i.e 8:15 BST
7+
- cron: "00 5 * * 1-5" # Every weekday (Mon-Fri) at 05:00 UTC i.e 06:00 BST
88
displayName: Weekdays run
99
branches:
1010
include:
@@ -16,7 +16,7 @@ resources:
1616
- repository: dtos-devops-templates
1717
type: github
1818
name: NHSDigital/dtos-devops-templates
19-
ref: d6d6e3e99459d9d71a83fa5affa900a6c339a3b5
19+
ref: 143bb43a2f95dd23e3c579a3bf87b29a63ee4003
2020
endpoint: NHSDigital
2121

2222
variables:

.azuredevops/pipelines/task_azure_sql_scaling_dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pool:
88
name: private-pool-dev-uks
99

1010
schedules:
11-
- cron: "0 7 * * *" # Run at 7:00 AM UTC
11+
- cron: "45 4 * * *" # Run at 04:45 AM UTC
1212
displayName: 'Scale_Peak'
1313
branches:
1414
include:
@@ -27,7 +27,7 @@ resources:
2727
- repository: dtos-devops-templates
2828
type: github
2929
name: NHSDigital/dtos-devops-templates
30-
ref: d6d6e3e99459d9d71a83fa5affa900a6c339a3b5
30+
ref: 143bb43a2f95dd23e3c579a3bf87b29a63ee4003
3131
endpoint: NHSDigital
3232

3333
parameters:

.azuredevops/pipelines/task_azure_sql_scaling_int.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resources:
2727
- repository: dtos-devops-templates
2828
type: github
2929
name: NHSDigital/dtos-devops-templates
30-
ref: d6d6e3e99459d9d71a83fa5affa900a6c339a3b5
30+
ref: 143bb43a2f95dd23e3c579a3bf87b29a63ee4003
3131
endpoint: NHSDigital
3232

3333
parameters:

.azuredevops/pipelines/task_azure_sql_scaling_nft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resources:
2727
- repository: dtos-devops-templates
2828
type: github
2929
name: NHSDigital/dtos-devops-templates
30-
ref: d6d6e3e99459d9d71a83fa5affa900a6c339a3b5
30+
ref: 143bb43a2f95dd23e3c579a3bf87b29a63ee4003
3131
endpoint: NHSDigital
3232

3333
parameters:

.azuredevops/pipelines/task_azure_sql_scaling_preprod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resources:
2727
- repository: dtos-devops-templates
2828
type: github
2929
name: NHSDigital/dtos-devops-templates
30-
ref: d6d6e3e99459d9d71a83fa5affa900a6c339a3b5
30+
ref: 143bb43a2f95dd23e3c579a3bf87b29a63ee4003
3131
endpoint: NHSDigital
3232

3333
parameters:

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
contents: read
157157
uses: ./.github/workflows/stage-4-deploy.yaml
158158
with:
159-
environments: "[\"sandbox\"]"
159+
environments: "[\"development\"]"
160160
commit_sha: ${{ github.sha }}
161161
secrets: inherit
162162
validate-title-stage:

.github/workflows/stage-4-deploy.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ jobs:
6666
6767
# Define which tests to run based on the environment
6868
declare -A test_types=(
69-
["dev"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3"
70-
["nft"]="smoke_e2e,regression_api,regression_e2e_epic1,regression_e2e_epic2,regression_e2e_epic3"
71-
["int"]=""
69+
["development"]="smoke_e2e"
70+
["nft"]=""
71+
["integration"]=""
7272
["sandbox"]="smoke_e2e,regression_api"
73-
["pre"]=""
74-
["prod"]=""
73+
["preprod"]=""
74+
["production"]=""
7575
)
7676
7777
git_short_sha=$(git rev-parse --short ${{inputs.commit_sha}})

tests/playwright-tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"test:regression_e2e_epic3Med": "cross-env TEST_TYPE=RegressionEpic3Med npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic3-med",
1414
"test:regression_e2e_epic4c": "cross-env TEST_TYPE=RegressionEpic4c npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic4c-",
1515
"test:regression_e2e_epic4d": "cross-env TEST_TYPE=RegressionEpic4d npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic4d-",
16+
"test:regression_e2e_epic4b": "cross-env TEST_TYPE=RegressionEpic4d npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=@epic4b-",
1617
"test": "cross-env TEST_TYPE=SMOKE npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@smoke @e2e\"",
1718
"test:validation-exceptions": "cross-env TEST_TYPE=VALIDATION npx playwright test tests/api/bsselect/validationExceptions/ --project=dev --config=src/config/playwright.config.ts",
1819
"test:service_now": "npx playwright test --project=dev --config=src/config/playwright.config.ts --grep=\"@service_now\"",
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
11+
annotation: [{
12+
type: 'Requirement',
13+
description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-7667'
14+
}]
15+
16+
test.describe('@regression @e2e @epic4b-block-tests @smoke Tests', async () => {
17+
TestHooks.setupAllTestHooks();
18+
19+
test('@DTOSS-7667-01 - AC1 - Verify participant does not have a subscription in our database when they are blocked', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => {
20+
// Arrange: Get test data
21+
const [addValidations, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title, 'ADD_BLOCKED');
22+
const nhsNumber = nhsNumbers[0];
23+
await cleanupDatabaseFromAPI(request, [nhsNumber]);
24+
25+
26+
const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath);
27+
28+
await test.step(`When I ADD participant is processed via storage ready to be blocked by the block function`, async () => {
29+
await processFileViaStorage(parquetFile);
30+
});
31+
32+
let nhsNumberFromPds = 0;
33+
let familyName = "";
34+
let dateOfBirth = "";
35+
36+
await test.step(`Then participant should be in the participant management table`, async () => {
37+
38+
await validateSqlDatabaseFromAPI(request, addValidations);
39+
});
40+
41+
42+
// Call the block participant function
43+
await test.step(`Go to PDS and get the participant data for the blocking of a participant that already exists in the database`, async () => {
44+
// Call the block participant function
45+
let url = `${config.createPDSDemographic}${config.createPDSDemographicPath}?nhsNumber=${nhsNumbers[0]}`;
46+
47+
let response = await sendHttpGet(url)
48+
expect(response.status).toBe(200)
49+
50+
let json = await response.json();
51+
nhsNumberFromPds = json["NhsNumber"];
52+
familyName = json["FamilyName"]
53+
dateOfBirth = json["DateOfBirth"];
54+
55+
expect(nhsNumberFromPds).toBeDefined()
56+
});
57+
58+
const blockPayload = {
59+
NhsNumber: Number(nhsNumberFromPds),
60+
FamilyName: familyName,
61+
DateOfBirth: dateOfBirth
62+
};
63+
64+
await test.step(`running step to make sure that item can be subscribed to in nems`, async () => {
65+
let subscribeToNemsResponse = await sendHttpPOSTCall(`${config.SubToNems}${config.SubToNemsPath}?nhsNumber=${nhsNumbers[0]}`, "");
66+
67+
expect(subscribeToNemsResponse.status).toBe(200);
68+
});
69+
70+
await test.step(`Send block to existing participant and make sure they are blocked`, async () => {
71+
72+
let url = `${config.endpointBsSelectUpdateBlockFlag}${config.routeBsSelectBlockParticipant}`;
73+
let body = JSON.stringify(blockPayload);
74+
let response = await sendHttpPOSTCall(url, body);
75+
expect(response.status).toBe(200);
76+
});
77+
78+
79+
await test.step(`the participant has been blocked`, async () => {
80+
let blocked = false;
81+
for(let i =0; i<10; i++) {
82+
const resp = await getRecordsFromParticipantManagementService(request);
83+
if (resp?.data?.[0]?.BlockedFlag === 1) {
84+
blocked = true;
85+
break;
86+
}
87+
console.log(`Waiting for participant to be blocked...(${i}/10)`);
88+
await new Promise(res => setTimeout(res, 2000));
89+
}
90+
expect(blocked).toBe(true);
91+
});
92+
93+
await test.step(`When the participant is in the blocked list they are not subscribed to nems for PDS updates`, async () => {
94+
var checkNemsSubscriptionStatusURL = `${config.SubToNems}${config.CheckNemsSubPath}?nhsNumber=${nhsNumbers[0]}` ;
95+
let nemsResponse = await sendHttpGet(checkNemsSubscriptionStatusURL);
96+
97+
expect(nemsResponse.status).toBe(404);
98+
});
99+
});
100+
});

0 commit comments

Comments
 (0)