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.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
test: fix e2e tests after yet another store redesign (#2402)
Martin Adámek35594369f219
diff --git a/test/e2e/playwright-enqueue-links/actor/main.js b/test/e2e/playwright-enqueue-links/actor/main.jsindex 66d8a2d07..a5c2911f4 100644--- a/test/e2e/playwright-enqueue-links/actor/main.js+++ b/test/e2e/playwright-enqueue-links/actor/main.js@@ -1,5 +1,6 @@+import { PlaywrightCrawler, Dataset, log } from '@crawlee/playwright';import { Actor } from 'apify';-import { PlaywrightCrawler, log } from '@crawlee/playwright';+import deepEqual from 'deep-equal';process.env.APIFY_LOG_LEVEL = 'DEBUG';@@ -18,17 +19,15 @@ await Actor.main(async () => {log.info(`URL: ${url}; LOADED_URL: ${loadedUrl}; TITLE: ${pageTitle}`);await closeCookieModals();- // Wait for the actor cards to render,- // otherwise enqueueLinks wouldn't enqueue anything.- await page.waitForSelector('.ActorStorePagination-buttons a');-- // Add links to the queue, but only from- // elements matching the provided selector.- await enqueueLinks({- selector: '.ActorStorePagination-buttons a',- });++ const results = await enqueueLinks();++ if (loadedUrl.startsWith('https://drive')) {+ const isEqual = deepEqual(results, { processedRequests: [], unprocessedRequests: [] });+ await Dataset.pushData({ isEqual });+ }},});- await crawler.run(['https://apify.com/store']);+ await crawler.run(['https://apify.com/press-kit', 'https://apify.com/about']);}, mainOptions);diff --git a/test/e2e/playwright-enqueue-links/test.mjs b/test/e2e/playwright-enqueue-links/test.mjsindex 0eb37b5b7..d088b70d1 100644--- a/test/e2e/playwright-enqueue-links/test.mjs+++ b/test/e2e/playwright-enqueue-links/test.mjs@@ -3,6 +3,7 @@ import { initialize, getActorTestDir, runActor, expect } from '../tools.mjs';const testActorDirname = getActorTestDir(import.meta.url);await initialize(testActorDirname);-const { stats } = await runActor(testActorDirname, 16384);+const { datasetItems } = await runActor(testActorDirname, 16384);+const { isEqual } = datasetItems[0];-await expect(stats.requestsFinished >= 30, 'All requests finished');+await expect(isEqual, `Enqueueing on same subdomain but different loaded url doesn't enqueue`);