Skip to content

Commit 20af907

Browse files
Review Changes
1 parent f29c91d commit 20af907

File tree

8 files changed

+34
-43
lines changed

8 files changed

+34
-43
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ config:: _install-dependencies version # Configure development environment (main
9898
npm install
9999
(cd docs && make install && cd ..)
100100

101-
#test-component: To Be discussed with Infra on AWS credentials @Pipeline
102-
# (cd tests && npm install && npm run test:component)
101+
test-component:
102+
(cd tests && npm install && npm run test:component)
103103

104104
version:
105105
rm -f .version

tests/component-tests/apiGateway-tests/getLetters.spec.ts

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,9 @@ test.describe('API Gateway Tests To Get List Of Pending ', () =>
2525

2626
expect(response.status()).toBe(200);
2727
const responseBody = await response.json();
28-
29-
/* const validationResult = validateApiResponse("get", "/letters", response.status(), responseBody);
30-
if (validationResult) {
31-
console.error("API response validation failed:", validationResult);
32-
}
33-
34-
expect(validationResult).toBeUndefined();
35-
TBD */
3628
});
3729

38-
test('GET /letters with invalid apikey should return 403', async ({ request }) => {
30+
test('GET /letters with invalid authentication should return 403', async ({ request }) => {
3931
const header = await createInvalidRequestHeaders();
4032
const response = await request.get(`${baseUrl}/${SUPPLIER_LETTERS}` ,{
4133
headers: header,
@@ -59,14 +51,6 @@ test.describe('API Gateway Tests To Get List Of Pending ', () =>
5951
);
6052
expect(response.status()).toBe(500);
6153
const responseBody = await response.json();
62-
63-
/* const validationResult = validateApiResponse("get", "/letters", response.status(), responseBody);
64-
if (validationResult) {
65-
console.error("API response validation failed:", validationResult);
66-
}
67-
68-
expect(validationResult).toBeUndefined();
69-
TBD */
7054
});
7155

7256
test('GET /letters with invalid query param return 400', async ({ request }) => {
@@ -79,15 +63,6 @@ test.describe('API Gateway Tests To Get List Of Pending ', () =>
7963
});
8064
expect(response.status()).toBe(400);
8165
const responseBody = await response.json();
82-
83-
/*
84-
const validationResult = validateApiResponse("get", "/letters", response.status(), responseBody);
85-
if (validationResult) {
86-
console.error("API response validation failed:", validationResult);
87-
}
88-
89-
expect(validationResult).toBeUndefined();
90-
*/
9166
});
9267

9368
});

tests/component-tests/apiGateway-tests/testCases/UpdateLetterStatus.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,31 @@ export type PatchMessageRequestBody = {
77
type: string;
88
id: string;
99
attributes: {
10-
reasonCode?: number;
10+
reasonCode?: string | number;
1111
reasonText?: string;
1212
status: string;
1313
};
1414
};
1515
};
1616

17+
export type ErrorLink = {
18+
about: string;
19+
};
20+
21+
type PatchErrorResponse = {
22+
id: string;
23+
code: string;
24+
links: ErrorLink;
25+
status: string;
26+
title: string;
27+
detail: string;
28+
};
29+
30+
export type PatchErrorMessageBody = {
31+
errors: PatchErrorResponse[];
32+
};
33+
34+
1735
export type PatchMessageResponseBody = {
1836
data: {
1937
type: string;
@@ -34,6 +52,7 @@ export async function patchRequestHeaders(): Promise<RequestHeaders> {
3452
headerauth1: process.env.HEADERAUTH || '',
3553
'NHSD-Supplier-ID': supplierId,
3654
'NHSD-Correlation-ID': '12344',
55+
'X-Request-ID': 'requestId1'
3756
};
3857
return requestHeaders;
3958
};
@@ -60,11 +79,10 @@ export async function patchFailureRequestBody (id: string, status: string) : Pro
6079

6180
requestBody = {
6281
data: {
63-
 attributes: {
64-
  status: status,
65-
reasonCode: 123,
66-
reasonText: 'Test Reason'
67-
82+
attributes: {
83+
status: status,
84+
reasonCode: 123,
85+
reasonText: 'Test Reason'
6886
},
6987
type: 'Letter',
7088
id: id

tests/component-tests/apiGateway-tests/updateLetterStatus.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ test.describe('API Gateway Tests to Verify Patch Status Endpoint', () => {
3737
data:{
3838
attributes: {
3939
status: 'ACCEPTED',
40-
specificationId: 'TestSpecificationID',
41-
groupId: 'TestGroupID',
40+
specificationId: letter.specificationId,
41+
groupId: letter.groupId,
4242
},
4343
id: letter.id,
4444
type: 'Letter'
@@ -112,7 +112,6 @@ test.describe('API Gateway Tests to Verify Patch Status Endpoint', () => {
112112
});
113113

114114
const res = await response.json();
115-
console.log(res);
116115
expect(response.status()).toBe(403);
117116
});
118117
});

tests/config/sandbox.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const localConfig: PlaywrightTestConfig = {
77
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
88
reporter: getReporters('api-test'),
99
...baseConfig,
10-
//globalSetup: require.resolve('./setup/globalSetup'),
11-
//globalTeardown: require.resolve('./setup/globalTeardown'),
1210
projects: [
1311
{
1412
name: 'sandbox',

tests/constants/request_headers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export async function createInvalidRequestHeaders(): Promise<RequestHeaders> {
2727
headerauth1: '',
2828
'NHSD-Supplier-ID': supplierId,
2929
'NHSD-Correlation-ID': '1234',
30+
'X-Request-ID': 'requestId1'
3031
};
3132
return requestHeaders;
3233
}
@@ -37,6 +38,7 @@ export async function createHeaderWithNoCorrelationId(): Promise<RequestHeaders>
3738
headerauth1: process.env.HEADERAUTH || '',
3839
'NHSD-Supplier-ID': supplierId,
3940
'NHSD-Correlation-ID': '',
41+
'X-Request-ID': 'requestId1'
4042
};
4143
return requestHeaders;
4244
}
@@ -47,6 +49,7 @@ export async function createValidRequestHeaders(): Promise<RequestHeaders> {
4749
headerauth1: process.env.HEADERAUTH || '',
4850
'NHSD-Supplier-ID': supplierId,
4951
'NHSD-Correlation-ID': '12345',
52+
'X-Request-ID': 'requestId1'
5053
};
5154
return requestHeaders;
5255
}

tests/sandbox/testCases/updateMultipleStatys_testCases.ts renamed to tests/sandbox/testCases/updateMultipleStatus_testCases.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { PatchMessageRequestBody } from "../../component-tests/apiGateway-tests/testCases/UpdateLetterStatus";
21
import { RequestSandBoxHeaders, sandBoxHeader } from "../../constants/request_headers";
32

43
export type ApiSandboxUpdateLetterStatusTestData = {
@@ -16,7 +15,7 @@ type postRequest = {
1615
type: string;
1716
id: string;
1817
attributes: {
19-
reasonCode?: number;
18+
reasonCode?: string | number;
2019
reasonText?: string;
2120
status: string;
2221
}

tests/sandbox/updateMultipleLetterStatus.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { test, expect, request } from '@playwright/test';
22
import { SUPPLIER_API_URL_SANDBOX, SUPPLIER_LETTERS} from '../constants/api_constants';
3-
import { apiSandboxUpdateLetterStatusTestData } from './testCases/updateLetterStatus_testCases';
4-
import { apiSandboxMultipleLetterStatusTestData } from './testCases/updateMultipleStatys_testCases';
3+
import { apiSandboxMultipleLetterStatusTestData } from './testCases/updateMultipleStatus_testCases';
54

65

76
test.describe('Sandbox Tests To Update Multiple Letter Status', () =>

0 commit comments

Comments
 (0)