Answer the question
In order to leave comments, you need to log in
Why is it throwing an error when running the e2e test?
I wrote a test and it doesn't pass. When run, it throws an error: Execution context was destroyed, most likely because of a navigation.
Here is the test:
import puppeteer from 'puppeteer';
describe('ff', () => {
test('dd', async () => {
const browser = await puppeteer.launch({
headless: false,
slowMo: 100,
});
const page = await browser.newPage();
page.goto('http://localhost:3000/photos/list');
page.click('[data-hook="changeSearchState"]');
page.click('input[data-hook="searchField"]');
page.type('input[data-hook="searchField"]', 'officia');
const cards = await page.evaluate(() =>
Array.from(
document.querySelectorAll('div[data-hook="cardPhoto"]'),
(elem) => elem.textContent
)
);
await browser.close();
}, 10000);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question