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.

test: fix e2e tests for error snapshotter

Martin Adámek99e1a942e12c
diff --git a/test/e2e/cheerio-error-snapshot/actor/main.js b/test/e2e/cheerio-error-snapshot/actor/main.js
index de4077087..ec2bd74ed 100644
--- a/test/e2e/cheerio-error-snapshot/actor/main.js
+++ b/test/e2e/cheerio-error-snapshot/actor/main.js
@@ -19,6 +19,9 @@ await Actor.main(async () => {
const crawler = new CheerioCrawler({
requestHandlerTimeoutSecs: 2,
maxRequestRetries: 0,
+ statisticsOptions: {
+ saveErrorSnapshots: true,
+ },
async requestHandler({ $, request, log }) {
const { userData: { label } } = request;
diff --git a/test/e2e/cheerio-error-snapshot/test.mjs b/test/e2e/cheerio-error-snapshot/test.mjs
index 912f6a7bf..c36006291 100644
--- a/test/e2e/cheerio-error-snapshot/test.mjs
+++ b/test/e2e/cheerio-error-snapshot/test.mjs
@@ -10,7 +10,7 @@ await expect(stats.requestsFailed === 4, 'All requests failed');
let totalErrorHtmlFiles = 0;
for (const error of Object.values(stats.errors)) {
- if (hasNestedKey(error, 'firstErrorHtmlUrl')) {
+ if (hasNestedKey(error, 'firstErrorHtml')) {
totalErrorHtmlFiles++;
}
}
diff --git a/test/e2e/puppeteer-error-snapshot/actor/main.js b/test/e2e/puppeteer-error-snapshot/actor/main.js
index 70ca82f8f..940cff660 100644
--- a/test/e2e/puppeteer-error-snapshot/actor/main.js
+++ b/test/e2e/puppeteer-error-snapshot/actor/main.js
@@ -19,6 +19,9 @@ await Actor.main(async () => {
const crawler = new PuppeteerCrawler({
requestHandlerTimeoutSecs: 15,
maxRequestRetries: 0,
+ statisticsOptions: {
+ saveErrorSnapshots: true,
+ },
async requestHandler({ request, log, page }) {
const { userData: { label } } = request;
diff --git a/test/e2e/puppeteer-error-snapshot/test.mjs b/test/e2e/puppeteer-error-snapshot/test.mjs
index 404d64e91..5a7a0121c 100644
--- a/test/e2e/puppeteer-error-snapshot/test.mjs
+++ b/test/e2e/puppeteer-error-snapshot/test.mjs
@@ -11,13 +11,13 @@ await expect(stats.requestsFailed === 4, 'All requests failed');
let totalErrorHtmlFiles = 0;
let totalErrorScreenshotFiles = 0;
for (const error of Object.values(stats.errors)) {
- if (hasNestedKey(error, 'firstErrorHtmlUrl')) {
+ if (hasNestedKey(error, 'firstErrorHtml')) {
totalErrorHtmlFiles++;
}
}
for (const error of Object.values(stats.errors)) {
- if (hasNestedKey(error, 'firstErrorScreenshotUrl')) {
+ if (hasNestedKey(error, 'firstErrorScreenshot')) {
totalErrorScreenshotFiles++;
}
}