On running tests all are running a successfully an...
# pact-js
s
On running tests all are running a successfully and getting pass but contract file generating for only 1 or 2 requests not for all
m
can you please share your test setup? If you use the same description for multiple interactions, subsequent ones will override previous ones
are you running a hook before tests that is clearing out the pact files?
s
Copy code
test('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);
       
          })
similarly I have 4 tests, I checked test description is different in all cases
m
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 file
s
Even I tried with that as well