sasank kumar
02/01/2023, 4:54 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
sasank kumar
02/01/2023, 12:58 PMtest('Details', async ({ page, request }) => {
const productApiPath = process.env.API_BASE_URL
? process.env.API_BASE_URL
: '<http://localhost:8082>'
await page.route(productApiPath + '/api/65948121/details', async (route) => {
route.fulfill({
status: 200,
body: JSON.stringify(details),
headers: {
'Content-Type': 'application/json'
}
})
const pacticipant = 'ContractAPI'
const provider = process.env.PACT_PROVIDER || 'ContractAPI'
transformPlaywrightMatchToPact(route, { pacticipant, provider })
return
})
await page.waitForTimeout(5000)
await page.goto('<http://localhost:8082/api/equip/65948121/details>')
const response = await request.get('<http://localhost:8082/api/equip/65948121/details>')
await page.waitForTimeout(5000)
expect(response.ok()).toBeTruthy();
expect(response.status()).toBe(200);
})sasank kumar
02/01/2023, 12:59 PMMatt (pactflow.io / pact-js / pact-go)
transformPlaywrightMatchToPact is an async function, you need to await that. I’m not sure if that’s the issue, but is plausible if that’s the function that writes the pact filesasank kumar
02/02/2023, 2:29 AM