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.

Fix tests

Ondra Urban4349f65d656e
diff --git a/test/cheerio_crawler.js b/test/cheerio_crawler.js
index 0c01e8cd5..63946934a 100644
--- a/test/cheerio_crawler.js
+++ b/test/cheerio_crawler.js
@@ -99,10 +99,11 @@ describe('CheerioCrawler', () => {
processed.sort(comparator);
- processed.forEach((request, id) => {
- expect(request.url).to.be.eql(sources[id].url);
+ for (let i = 0; i < 12; i++) {
+ const request = processed[i];
+ expect(request.url).to.be.eql(sources[i].url);
expect(request.userData.title).to.be.eql('Example Domain');
- });
+ }
await Apify.utils.sleep(10); // Wait for event loop to unwind.
await cheerioCrawler.run();
diff --git a/test/puppeteer_crawler.js b/test/puppeteer_crawler.js
index 8ad5df744..16cbecc87 100644
--- a/test/puppeteer_crawler.js
+++ b/test/puppeteer_crawler.js
@@ -104,10 +104,11 @@ describe('PuppeteerCrawler', () => {
processed.sort(comparator);
- processed.forEach((request, id) => {
- expect(request.url).to.be.eql(sources[id].url);
+ for (let i = 0; i < 12; i++) {
+ const request = processed[i];
+ expect(request.url).to.be.eql(sources[i].url);
expect(request.userData.title).to.be.eql('Example Domain');
- });
+ }
await Apify.utils.sleep(10); // Wait for event loop to unwind.
await puppeteerCrawler.run();