|
1 | | -import { test, expect, APIRequestContext } from '@playwright/test'; |
| 1 | +import { test, expect } from '@playwright/test'; |
| 2 | +import { API_KEY, DEV_API_GATEWAY_URL, LETTERS_ENDPOINT} from '../../../constants/api_constants'; |
2 | 3 |
|
3 | 4 | // Constants |
4 | | -const CORRELATION_IDS = '228aac39-542d-4803-b28e-5de9e100b9f8'; |
5 | | -const REQUEST_ID = 'xx'; |
6 | | -const MESSAGES_ENDPOINT = '/letter'; // Update this path to match your constant |
7 | | -const status = "PENDING"; |
| 5 | +const STATUS = 'PENDING'; |
8 | 6 |
|
9 | | -// Parameterized test in Playwright |
10 | | - test("200 when valid request ID", async ({ request }) => { |
11 | | - const headers = { |
12 | | - 'Accept': '*/*', |
13 | | - 'Content-Type': 'application/json', |
14 | | - }; |
| 7 | +test("200 when valid input is passed", async ({ request }) => { |
| 8 | + const headers = { |
| 9 | + headerauth1 : 'headervalue1', |
| 10 | + apikey : API_KEY, |
| 11 | + Authorization: '1234' |
| 12 | + }; |
15 | 13 |
|
16 | | - headers['X-Correlation-Id'] = CORRELATION_IDS; |
| 14 | + const API_URL = process.env.NHSD_APIM_PROXY_URL || DEV_API_GATEWAY_URL; |
| 15 | + const API_GATEWAY_URL = `${API_URL}${LETTERS_ENDPOINT}`; |
17 | 16 |
|
18 | | - const response = await request.get(`${process.env.NHSD_APIM_PROXY_URL}${MESSAGES_ENDPOINT}`, { |
| 17 | + const response = await request.get(API_GATEWAY_URL, { |
19 | 18 | params: { |
20 | | - id: `${REQUEST_ID}` |
| 19 | + status: `${STATUS}` |
21 | 20 | }, |
22 | 21 | headers |
23 | 22 | }); |
24 | 23 |
|
| 24 | + console.log(await response.json()); |
25 | 25 | await expect(response.status()).toBe(200); |
| 26 | + expect(response.ok()).toBeTruthy(); |
26 | 27 | }); |
0 commit comments