Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

chore: more debugging of a flaky test

Ondra Urban7e3e35e1afce
diff --git a/test/crawlers/cheerio_crawler.test.js b/test/crawlers/cheerio_crawler.test.js
index b09321ffd..4e92ecc1c 100644
--- a/test/crawlers/cheerio_crawler.test.js
+++ b/test/crawlers/cheerio_crawler.test.js
@@ -684,7 +684,7 @@ describe('CheerioCrawler', () => {
});
test('should markBad sessions after request timeout', async () => {
- log.setLevel(log.LEVELS.OFF);
+ // log.setLevel(log.LEVELS.OFF);
const cheerioCrawler = new Apify.CheerioCrawler({
requestList: await Apify.openRequestList(null, [
`http://${HOST}:${port}/timeout?a=12`,
@@ -694,7 +694,9 @@ describe('CheerioCrawler', () => {
requestTimeoutSecs: 1,
maxConcurrency: 1,
useSessionPool: true,
- handlePageFunction: async () => {},
+ handlePageFunction: async () => {
+ await Apify.utils.sleep(1);
+ },
});
await cheerioCrawler.run();
@@ -711,7 +713,7 @@ describe('CheerioCrawler', () => {
expect(session.errorScore).toEqual(1);
});
- log.setLevel(log.LEVELS.ERROR);
+ // log.setLevel(log.LEVELS.ERROR);
});
test('should retire session on "blocked" status codes', async () => {