M
M
Maxim2019-08-29 12:39:07
Node.js
Maxim, 2019-08-29 12:39:07

Errors when re-running puppeteer + mocha tests?

The issue is that when you run the tests again, the error “Error: No node found for selector:” is thrown.
Although before the tests passed without errors.
The code in the tests and the application did not change.
An example of writing code:

it("Отображение Техника не найдена", async () => {

  await page.waitFor(2500);

  await page.click("#header > div.tm-basicnav.uk-sticky > div > div > div.one.uk-first-column > a")

  await page.waitFor(2500);

  await page.type("#find-home-index-input", "wsedfrtgyhujik")

  await page.waitFor(2500);
  await page.click("#catalog-items-extra .uk-width-auto button")

  await page.waitFor(2500);

   const element = await page.$(".uk-h3");
    const text = await page.evaluate(element => element.textContent, element);
  expect(text).to.include('Техника не найдена')
});

Run - mocha --timeout 3000000 bootstrap.js --recursive test/ Incrementing
sometimes helps: await page.waitFor(2500);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question