I came across one big issue combining puppeteer with jest. Whenever I hit "npm run test" this test fails displaying: "Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.". This warning also appears even if I pass timeout as a third argument to test function or calling jest.setTimeout(timeout) from inside of beforeEach method callback. What the problem is there, could you guys help me with this. P.S. I'm using jest and puppeteer packages separately
const pup = require('puppeteer')
let browser, page
beforeEach(async _ => {
browser = await pup.launch({
headless: false
})
page = await browser.newPage()
await page.goto('localhost:3000')
})
afterEach(async _ => await browser.close())
test('Login function', async _ => {
await page.click('link')
const url = await page.url()
expect(url).toMatch(/accounts\.google\.com/)
})