Mockeer
Mockeer copied to clipboard
I'm getting Navigation failed because browser has disconnected! when ci=true
I'm not entirely sure what's happening with my tests, but here's an example:
const mockeer = require('mockeer');
const puppeteer = require('puppeteer');
describe('example test', () => {
let browser, page;
beforeEach(async () => {
browser = await puppeteer.launch({
defaultViewport: { width: 1024, height: 768 },
ignoreHTTPSErrors: true,
headless: true,
args: ['--no-sandbox'],
}); // flip headless to false to have visual representation
page = await browser.newPage();
await mockeer(browser);
});
afterEach(async () => {
await page.close();
await browser.close();
});
it('should find go to a page', async () => {
expect(
await page.goto(....);
).toBe(true);
});
This works fine when CI=false, and the fixtures get created, but when running with CI=true, I'm getting the following:
Navigation failed because browser has disconnected!
Some more debugging info, when setting headless to false and playing with the CI param, it looks like the request works fine when CI is set to false, but when set to true, it appears to be not loading anything in the browser and just hanging at the goto line.