Skip to content

Commit 5f53f6c

Browse files
test: regression-test-failures-fix (#1623)
* updated-test-to-handle-retry * regression-test-failures-fix
1 parent 7528dc9 commit 5f53f6c

3 files changed

Lines changed: 37 additions & 27 deletions

File tree

tests/playwright-tests/src/tests/e2e/epic4c-add-participant-tests/epic4c-10011-10012-testsuite.spec.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test.describe.serial('@DTOSS-3881-01 @e2e @epic4c- Cohort Manger subscribed the
3636
break;
3737
}
3838
console.log(`Waiting for succesful data receival from serviceNow... (${i + 1}/10)`);
39-
await new Promise(res => setTimeout(res, 2000));
39+
await new Promise(res => setTimeout(res, 5000));
4040
}
4141
if (!success) {
4242
throw new Error('Cohort Manager receive data was unsuccessful after 10 retries (20 seconds).');
@@ -54,7 +54,7 @@ test.describe.serial('@DTOSS-3881-01 @e2e @epic4c- Cohort Manger subscribed the
5454
break;
5555
}
5656
console.log(`Waiting for participant response data to be available... (${i + 1}/10)`);
57-
await new Promise(res => setTimeout(res, 2000));
57+
await new Promise(res => setTimeout(res, 5000));
5858
}
5959
if (!success) {
6060
throw new Error('Participant response data was not available after 10 retries (20 seconds).');
@@ -67,22 +67,32 @@ test.describe.serial('@DTOSS-3881-01 @e2e @epic4c- Cohort Manger subscribed the
6767
await test.step('And NHSNumber, ScreeningId, ReferralFlag is written to Participant Management table', async () => {
6868
let response;
6969
let success = false;
70+
let found = false;
71+
72+
const isMatchingRow = (row: { NHSNumber: number; ScreeningId: number; ReferralFlag: number }): boolean =>
73+
row.NHSNumber === 9997160908 && row.ScreeningId === 1 && row.ReferralFlag === 1;
7074

7175
for (let i = 0; i < 10; i++) {
7276
response = await getRecordsFromParticipantManagementDataService(request);
77+
7378
if (response.status === 200) {
7479
success = true;
75-
break;
80+
found = response.data.some(isMatchingRow);
81+
if (found) {
82+
const match = response.data.find(isMatchingRow);
83+
console.log(`Found matching Number: ${match.NHSNumber}`);
84+
break;
85+
}
7686
}
7787
console.log(`Waiting for participant response data to be available... (${i + 1}/10)`);
78-
await new Promise(res => setTimeout(res, 2000));
88+
await new Promise(res => setTimeout(res, 5000));
7989
}
8090
if (!success) {
81-
throw new Error('Participant response data was not available after 10 retries (20 seconds).');
91+
throw new Error('Participant response data was not available after 10 retries (50 seconds).');
92+
}
93+
if (!found) {
94+
throw new Error('Matching participant record was not found after 10 retries (50 seconds).');
8295
}
83-
expect(response?.data?.[0]?.NHSNumber).toBe(9997160908);
84-
expect(response?.data?.[0]?.ScreeningId).toBe(1);
85-
expect(response?.data?.[0]?.ReferralFlag).toBe(1);
8696
});
8797

8898
await test.step('DTOSS-10012 DTOSS-10012 verify NemsSubscription_Id in NEMS_SUBSCRIPTION table', async () => {
@@ -96,7 +106,7 @@ test.describe.serial('@DTOSS-3881-01 @e2e @epic4c- Cohort Manger subscribed the
96106
break;
97107
}
98108
console.log(`Waiting for NemsSubscription_Id data to be available... (${i + 1}/10)`);
99-
await new Promise(res => setTimeout(res, 2000));
109+
await new Promise(res => setTimeout(res, 5000));
100110
}
101111
if (!success || !response) {
102112
throw new Error('NemsSubscription_Id response data was not available after 10 retries (20 seconds).');

tests/playwright-tests/src/tests/e2e/testFiles/@DTOSS-5111-01/ADD1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,28 @@
22
"validations": [
33
{
44
"validations": {
5-
"apiEndpoint": "api/ExceptionManagementDataService",
6-
"NhsNumber": "9990185433",
7-
"RuleId": 94,
8-
"RuleDescription": "Invalid eligibility flag."
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9990185433,
7+
"GivenName": "Darrel",
8+
"FamilyName": "Regans"
99
},
1010
"meta": {
1111
"testJiraId": "@DTOSS-5111-01",
1212
"requirementJiraId": "DTOSS-4909",
13-
"additionalTags": "@regression @e2e @epic2-med-priority Tests Verify that an exception raised when adding participant with eligibility is false"
13+
"additionalTags": "@regression @e2e @epic2-med-priority Tests Verify that No exception is raised when adding participant with eligibility is false"
14+
}
15+
},
16+
{
17+
"validations": {
18+
"apiEndpoint": "api/ParticipantManagementDataService",
19+
"NHSNumber": 9990185433,
20+
"RecordType": "ADD",
21+
"EligibilityFlag": 0
22+
},
23+
"meta": {
24+
"testJiraId": "@DTOSS-5111-01",
25+
"requirementJiraId": "DTOSS-4909",
26+
"additionalTags": "@regression @e2e @epic2-med-priority Tests Verify eligibility is 0"
1427
}
1528
}
1629
],

tests/playwright-tests/src/tests/e2e/testFiles/@DTOSS-5399-01/ADD1_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111
"requirementJiraId": "DTOSS-2757",
1212
"additionalTags": "@regression @e2e @epic2-med-priority Validate eligibility flag is always set to null for ADD participant records"
1313
}
14-
},
15-
{
16-
"validations": {
17-
"apiEndpoint": "api/ExceptionManagementDataService",
18-
"NhsNumber": "9996216462",
19-
"RuleId": 94,
20-
"RuleDescription": "Invalid eligibility flag."
21-
},
22-
"meta": {
23-
"testJiraId": "@DTOSS-5399-01",
24-
"requirementJiraId": "DTOSS-2757",
25-
"additionalTags": "@regression @e2e @epic2-med-priority Validate eligibility flag is always set to null exception for ADD participant records"
26-
}
2714
}
2815
],
2916
"inputParticipantRecord": [

0 commit comments

Comments
 (0)