jeudi 30 avril 2020

Time out error when executing Jest test with puppeteer

have a small suite of tests based on Puppeteer with Jest, and I can't get rid of the following problem

× test page header logo (5019ms)

  ● test page header logo

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      at node_modules/jest-jasmine2/build/queue_runner.js:72:21   
      at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:633:19)

the test code

test("test page header logo", async () => {

  const browser = await puppeteer.launch({ headless: false });

  const page = await browser.newPage();

  await page.goto("localhost:3000"); // our react app;

  const text = await page.$eval("a.brand-logo", (el) => el.innerHTML);

  expect(text).toEqual("Logo");
});


Aucun commentaire:

Enregistrer un commentaire