From fd74447438e2d5f3f143a0ca857fef3e1146a49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Wed, 14 Dec 2022 14:58:52 +0100 Subject: [PATCH] test: e2e tests fix, better logging (#1713) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixes the e2e tests in regard to the new [apify.com](apify.com) structure - `stdout` + `stderr` from `execSync` in the e2e tests are UTF-8 decoded now, no more byte arrays in error logs - All e2e tests now have the new `.actor/actor.json` structure - This was causing the PLATFORM issue, the new `apify-cli` version automatically transforms the old config, but requires confirmation - no interactive shell, no show, I guess 🤷🏻 TODO: - random platform tests still failing, mostly because of request timeouts - seems more like a platform issue though --- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../autoscaling-max-tasks-per-minute/test.mjs | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/cheerio-max-requests/actor/main.js | 16 ++++++-------- test/e2e/cheerio-max-requests/test.mjs | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/cheerio-page-info/actor/main.js | 14 +++++------- test/e2e/cheerio-page-info/test.mjs | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/migration/actor/main.js | 4 ++-- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/playwright-default/actor/Dockerfile | 2 +- test/e2e/playwright-default/actor/main.js | 6 +++-- test/e2e/playwright-default/test.mjs | 4 ++-- .../actor/{apify.json => .actor/actor.json} | 1 + .../playwright-enqueue-links/actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/proxy-rotation/actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/puppeteer-default/actor/Dockerfile | 2 +- test/e2e/puppeteer-default/actor/main.js | 6 +++-- test/e2e/puppeteer-default/test.mjs | 4 ++-- .../actor/{apify.json => .actor/actor.json} | 1 + .../puppeteer-enqueue-links/actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/puppeteer-page-info/actor/Dockerfile | 2 +- test/e2e/puppeteer-page-info/actor/main.js | 22 +++++++------------ test/e2e/puppeteer-page-info/test.mjs | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/main.js | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../puppeteer-store-pagination/actor/main.js | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/Dockerfile | 2 +- .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + .../actor/{apify.json => .actor/actor.json} | 1 + test/e2e/session-rotation/actor/main.js | 2 +- test/e2e/tools.mjs | 6 ++++- 61 files changed, 92 insertions(+), 63 deletions(-) rename test/e2e/automatic-persist-value/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/autoscaling-max-tasks-per-minute/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/cheerio-default-ts/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/cheerio-default/actor/{apify.json => .actor/actor.json} (77%) rename test/e2e/cheerio-enqueue-links/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/cheerio-ignore-ssl-errors/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/cheerio-initial-cookies/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/cheerio-max-requests/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/cheerio-page-info/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/cheerio-throw-on-ssl-errors/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/input-json5/actor/{apify.json => .actor/actor.json} (77%) rename test/e2e/jsdom-default-ts/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/jsdom-react-ts/actor/{apify.json => .actor/actor.json} (77%) rename test/e2e/migration/actor/{apify.json => .actor/actor.json} (76%) rename test/e2e/playwright-chromium-experimental-containers/actor/{apify.json => .actor/actor.json} (82%) rename test/e2e/playwright-default/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/playwright-enqueue-links/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/playwright-firefox-experimental-containers/actor/{apify.json => .actor/actor.json} (82%) rename test/e2e/playwright-initial-cookies/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/proxy-rotation/actor/{apify.json => .actor/actor.json} (77%) rename test/e2e/puppeteer-default/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/puppeteer-enqueue-links/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/puppeteer-ignore-ssl-errors/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/puppeteer-initial-cookies/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/puppeteer-page-info/actor/{apify.json => .actor/actor.json} (78%) rename test/e2e/puppeteer-store-pagination-jquery/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/puppeteer-store-pagination/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/puppeteer-throw-on-ssl-errors/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/request-queue-zero-concurrency/actor/{apify.json => .actor/actor.json} (80%) rename test/e2e/request-skip-navigation/actor/{apify.json => .actor/actor.json} (79%) rename test/e2e/session-rotation/actor/{apify.json => .actor/actor.json} (78%) diff --git a/test/e2e/automatic-persist-value/actor/apify.json b/test/e2e/automatic-persist-value/actor/.actor/actor.json similarity index 79% rename from test/e2e/automatic-persist-value/actor/apify.json rename to test/e2e/automatic-persist-value/actor/.actor/actor.json index 944ceeb3da6e..7f7835da440e 100644 --- a/test/e2e/automatic-persist-value/actor/apify.json +++ b/test/e2e/automatic-persist-value/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-automatic-persist-value", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/autoscaling-max-tasks-per-minute/actor/apify.json b/test/e2e/autoscaling-max-tasks-per-minute/actor/.actor/actor.json similarity index 80% rename from test/e2e/autoscaling-max-tasks-per-minute/actor/apify.json rename to test/e2e/autoscaling-max-tasks-per-minute/actor/.actor/actor.json index b6f64269e55e..e6e0c1ed5aea 100644 --- a/test/e2e/autoscaling-max-tasks-per-minute/actor/apify.json +++ b/test/e2e/autoscaling-max-tasks-per-minute/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-autoscaling-max-tasks-per-minute", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/autoscaling-max-tasks-per-minute/test.mjs b/test/e2e/autoscaling-max-tasks-per-minute/test.mjs index 6e9351c559b6..3979c69e0309 100644 --- a/test/e2e/autoscaling-max-tasks-per-minute/test.mjs +++ b/test/e2e/autoscaling-max-tasks-per-minute/test.mjs @@ -7,6 +7,6 @@ const { stats } = await runActor(testActorDirname); await expect(stats.requestsFinished === 2, 'All requests finished'); await expect( - stats.crawlerRuntimeMillis > 60_000 && stats.crawlerRuntimeMillis < 65_000, + stats.crawlerRuntimeMillis > 60_000 && stats.crawlerRuntimeMillis < 70_000, `Ran one task per minute, took ~1 minute to complete, but no more than that (${stats.crawlerRuntimeMillis}ms)`, ); diff --git a/test/e2e/cheerio-default-ts/actor/apify.json b/test/e2e/cheerio-default-ts/actor/.actor/actor.json similarity index 78% rename from test/e2e/cheerio-default-ts/actor/apify.json rename to test/e2e/cheerio-default-ts/actor/.actor/actor.json index d3e05a49e72b..d1802658a3ee 100644 --- a/test/e2e/cheerio-default-ts/actor/apify.json +++ b/test/e2e/cheerio-default-ts/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-default-ts", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-default/actor/apify.json b/test/e2e/cheerio-default/actor/.actor/actor.json similarity index 77% rename from test/e2e/cheerio-default/actor/apify.json rename to test/e2e/cheerio-default/actor/.actor/actor.json index 4d5d0a673c89..69e8b83b6d07 100644 --- a/test/e2e/cheerio-default/actor/apify.json +++ b/test/e2e/cheerio-default/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-default", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-enqueue-links/actor/apify.json b/test/e2e/cheerio-enqueue-links/actor/.actor/actor.json similarity index 79% rename from test/e2e/cheerio-enqueue-links/actor/apify.json rename to test/e2e/cheerio-enqueue-links/actor/.actor/actor.json index 8a288a3b456a..d51768db2b9e 100644 --- a/test/e2e/cheerio-enqueue-links/actor/apify.json +++ b/test/e2e/cheerio-enqueue-links/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-enqueue-links", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-ignore-ssl-errors/actor/apify.json b/test/e2e/cheerio-ignore-ssl-errors/actor/.actor/actor.json similarity index 79% rename from test/e2e/cheerio-ignore-ssl-errors/actor/apify.json rename to test/e2e/cheerio-ignore-ssl-errors/actor/.actor/actor.json index 3faacd490713..fbf791bef611 100644 --- a/test/e2e/cheerio-ignore-ssl-errors/actor/apify.json +++ b/test/e2e/cheerio-ignore-ssl-errors/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-ignore-ssl-errors", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-initial-cookies/actor/apify.json b/test/e2e/cheerio-initial-cookies/actor/.actor/actor.json similarity index 79% rename from test/e2e/cheerio-initial-cookies/actor/apify.json rename to test/e2e/cheerio-initial-cookies/actor/.actor/actor.json index 98ab258fe875..e3df9a5b52fe 100644 --- a/test/e2e/cheerio-initial-cookies/actor/apify.json +++ b/test/e2e/cheerio-initial-cookies/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-initial-cookies", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-max-requests/actor/apify.json b/test/e2e/cheerio-max-requests/actor/.actor/actor.json similarity index 78% rename from test/e2e/cheerio-max-requests/actor/apify.json rename to test/e2e/cheerio-max-requests/actor/.actor/actor.json index 965ffae6d9f6..28134cf02c23 100644 --- a/test/e2e/cheerio-max-requests/actor/apify.json +++ b/test/e2e/cheerio-max-requests/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-max-requests", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-max-requests/actor/main.js b/test/e2e/cheerio-max-requests/actor/main.js index bbd6cca412e5..3e1344eccd23 100644 --- a/test/e2e/cheerio-max-requests/actor/main.js +++ b/test/e2e/cheerio-max-requests/actor/main.js @@ -15,9 +15,9 @@ await Actor.main(async () => { const { url, userData: { label } } = request; if (label === 'START') { - const links = $('.ActorStoreItem').toArray().map((item) => $(item).attr('href')); + const links = $('a.card').toArray().map((item) => $(item).attr('href')); for (const link of links) { - const actorDetailUrl = `https://apify.com${link}`; + const actorDetailUrl = `https://crawlee.dev${link}`; await crawler.addRequests([{ url: actorDetailUrl, userData: { label: 'DETAIL' }, @@ -26,21 +26,19 @@ await Actor.main(async () => { } else if (label === 'DETAIL') { const uniqueIdentifier = url.split('/').slice(-2).join('/'); const title = $('header h1').text(); - const description = $('header span.actor-description').text(); - const modifiedDate = $('ul.ActorHeader-stats time').attr('datetime'); - const runCount = $('ul.ActorHeader-stats > li:nth-of-type(3)').text().match(/[\d,]+/)[0].replace(/,/g, ''); + const firstParagraph = $('header + p').text(); + const modifiedDate = $('.theme-last-updated time').attr('datetime'); await Dataset.pushData({ url, uniqueIdentifier, title, - description, - modifiedDate: new Date(Number(modifiedDate)), - runCount: Number(runCount), + firstParagraph, + modifiedDate, }); } }, }); - await crawler.run([{ url: 'https://apify.com/apify', userData: { label: 'START' } }]); + await crawler.run([{ url: 'https://crawlee.dev/docs/examples', userData: { label: 'START' } }]); }, mainOptions); diff --git a/test/e2e/cheerio-max-requests/test.mjs b/test/e2e/cheerio-max-requests/test.mjs index fd8394e084fc..cf70bbf939d4 100644 --- a/test/e2e/cheerio-max-requests/test.mjs +++ b/test/e2e/cheerio-max-requests/test.mjs @@ -8,6 +8,6 @@ const { stats, datasetItems } = await runActor(testActorDirname); await expect(stats.requestsFinished > 10, 'All requests finished'); await expect(datasetItems.length > 5 && datasetItems.length < 15, 'Number of dataset items'); await expect( - validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'description', 'modifiedDate', 'runCount']), + validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'firstParagraph', 'modifiedDate']), 'Dataset items validation', ); diff --git a/test/e2e/cheerio-page-info/actor/apify.json b/test/e2e/cheerio-page-info/actor/.actor/actor.json similarity index 78% rename from test/e2e/cheerio-page-info/actor/apify.json rename to test/e2e/cheerio-page-info/actor/.actor/actor.json index d8aa10fb9b76..448dc8868465 100644 --- a/test/e2e/cheerio-page-info/actor/apify.json +++ b/test/e2e/cheerio-page-info/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-page-info", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/cheerio-page-info/actor/main.js b/test/e2e/cheerio-page-info/actor/main.js index 62f6e4c4ed5b..191217c29dd5 100644 --- a/test/e2e/cheerio-page-info/actor/main.js +++ b/test/e2e/cheerio-page-info/actor/main.js @@ -12,7 +12,7 @@ const router = createCheerioRouter(); router.addHandler('START', async ({ enqueueLinks }) => { await enqueueLinks({ label: 'DETAIL', - globs: ['https://apify.com/apify/web-scraper'], + globs: ['**/examples/accept-user-input'], }); }); @@ -21,17 +21,15 @@ router.addHandler('DETAIL', async ({ request, $ }) => { const uniqueIdentifier = url.split('/').slice(-2).join('/'); const title = $('header h1').text(); - const description = $('header span.actor-description').text(); - const modifiedDate = $('ul.ActorHeader-stats time').attr('datetime'); - const runCount = $('ul.ActorHeader-stats > li:nth-of-type(3)').text().match(/[\d,]+/)[0].replace(/,/g, ''); + const firstParagraph = $('header + p').text(); + const modifiedDate = $('.theme-last-updated time').attr('datetime'); await Dataset.pushData({ url, uniqueIdentifier, title, - description, - modifiedDate: new Date(Number(modifiedDate)), - runCount: Number(runCount), + firstParagraph, + modifiedDate, }); }); @@ -40,5 +38,5 @@ await Actor.main(async () => { requestHandler: router, }); - await crawler.run([{ url: 'https://apify.com/apify', userData: { label: 'START' } }]); + await crawler.run([{ url: 'https://crawlee.dev/docs/3.0/examples', userData: { label: 'START' } }]); }, mainOptions); diff --git a/test/e2e/cheerio-page-info/test.mjs b/test/e2e/cheerio-page-info/test.mjs index e051e3b849a5..6ed16a4f6b72 100644 --- a/test/e2e/cheerio-page-info/test.mjs +++ b/test/e2e/cheerio-page-info/test.mjs @@ -8,6 +8,6 @@ const { stats, datasetItems } = await runActor(testActorDirname); await expect(stats.requestsFinished === 2, 'All requests finished'); await expect(datasetItems.length === 1, 'Number of dataset items'); await expect( - validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'description', 'modifiedDate', 'runCount']), + validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'firstParagraph', 'modifiedDate']), 'Dataset items validation', ); diff --git a/test/e2e/cheerio-throw-on-ssl-errors/actor/apify.json b/test/e2e/cheerio-throw-on-ssl-errors/actor/.actor/actor.json similarity index 80% rename from test/e2e/cheerio-throw-on-ssl-errors/actor/apify.json rename to test/e2e/cheerio-throw-on-ssl-errors/actor/.actor/actor.json index 71bf834585ea..051de11176db 100644 --- a/test/e2e/cheerio-throw-on-ssl-errors/actor/apify.json +++ b/test/e2e/cheerio-throw-on-ssl-errors/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-cheerio-throw-on-ssl-errors", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/input-json5/actor/apify.json b/test/e2e/input-json5/actor/.actor/actor.json similarity index 77% rename from test/e2e/input-json5/actor/apify.json rename to test/e2e/input-json5/actor/.actor/actor.json index aa48ca695439..c3a5b0ca6a7c 100644 --- a/test/e2e/input-json5/actor/apify.json +++ b/test/e2e/input-json5/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-input-json5", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/jsdom-default-ts/actor/apify.json b/test/e2e/jsdom-default-ts/actor/.actor/actor.json similarity index 78% rename from test/e2e/jsdom-default-ts/actor/apify.json rename to test/e2e/jsdom-default-ts/actor/.actor/actor.json index dfa4a1d459f8..976cd31c4f1d 100644 --- a/test/e2e/jsdom-default-ts/actor/apify.json +++ b/test/e2e/jsdom-default-ts/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-jsdom-default-ts", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/jsdom-react-ts/actor/apify.json b/test/e2e/jsdom-react-ts/actor/.actor/actor.json similarity index 77% rename from test/e2e/jsdom-react-ts/actor/apify.json rename to test/e2e/jsdom-react-ts/actor/.actor/actor.json index 834a0018b97f..9fe495397a2d 100644 --- a/test/e2e/jsdom-react-ts/actor/apify.json +++ b/test/e2e/jsdom-react-ts/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-jsdom-react-ts", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/migration/actor/apify.json b/test/e2e/migration/actor/.actor/actor.json similarity index 76% rename from test/e2e/migration/actor/apify.json rename to test/e2e/migration/actor/.actor/actor.json index f65813559ec2..29134d82e811 100644 --- a/test/e2e/migration/actor/apify.json +++ b/test/e2e/migration/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-migration", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/migration/actor/main.js b/test/e2e/migration/actor/main.js index 9aa1963f14c6..f06fc8ecef35 100644 --- a/test/e2e/migration/actor/main.js +++ b/test/e2e/migration/actor/main.js @@ -37,7 +37,7 @@ if (workerData !== '#actor') { maxRequestsPerCrawl: 5, async requestHandler({ enqueueLinks, request }) { const { url } = request; - await enqueueLinks({ pseudoUrls: ['https://apify.com[(/[\\w-]+)?]'] }); + await enqueueLinks(); await Dataset.pushData({ url }); @@ -48,6 +48,6 @@ if (workerData !== '#actor') { // eslint-disable-next-line no-underscore-dangle Configuration.getGlobalConfig().getStorageClient().__purged = false; - await crawler.run(['https://apify.com']); + await crawler.run(['https://crawlee.dev']); }, mainOptions); } diff --git a/test/e2e/playwright-chromium-experimental-containers/actor/apify.json b/test/e2e/playwright-chromium-experimental-containers/actor/.actor/actor.json similarity index 82% rename from test/e2e/playwright-chromium-experimental-containers/actor/apify.json rename to test/e2e/playwright-chromium-experimental-containers/actor/.actor/actor.json index 7f43847aef59..0be68bf205ad 100644 --- a/test/e2e/playwright-chromium-experimental-containers/actor/apify.json +++ b/test/e2e/playwright-chromium-experimental-containers/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-playwright-chromium-experimental-containers", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/playwright-chromium-experimental-containers/actor/Dockerfile b/test/e2e/playwright-chromium-experimental-containers/actor/Dockerfile index de06663ad921..58d737169f5e 100644 --- a/test/e2e/playwright-chromium-experimental-containers/actor/Dockerfile +++ b/test/e2e/playwright-chromium-experimental-containers/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/playwright-default/actor/apify.json b/test/e2e/playwright-default/actor/.actor/actor.json similarity index 78% rename from test/e2e/playwright-default/actor/apify.json rename to test/e2e/playwright-default/actor/.actor/actor.json index ddddf0cba3df..9ed1dfad0f92 100644 --- a/test/e2e/playwright-default/actor/apify.json +++ b/test/e2e/playwright-default/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-playwright-default", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/playwright-default/actor/Dockerfile b/test/e2e/playwright-default/actor/Dockerfile index de06663ad921..58d737169f5e 100644 --- a/test/e2e/playwright-default/actor/Dockerfile +++ b/test/e2e/playwright-default/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/playwright-default/actor/main.js b/test/e2e/playwright-default/actor/main.js index 5592a895ba2a..5a725fbadf7c 100644 --- a/test/e2e/playwright-default/actor/main.js +++ b/test/e2e/playwright-default/actor/main.js @@ -16,9 +16,11 @@ await Actor.main(async () => { const { url } = request; const pageTitle = await page.title(); await Dataset.pushData({ url, pageTitle }); - await enqueueLinks({ regexps: [/^https:\/\/apify\.com(\/[\w-]+)?$/i] }); + await enqueueLinks({ + globs: ['**/3.0/examples/*'], + }); }, }); - await crawler.run(['https://apify.com']); + await crawler.run(['https://crawlee.dev/docs/3.0/examples/']); }, mainOptions); diff --git a/test/e2e/playwright-default/test.mjs b/test/e2e/playwright-default/test.mjs index 7b0d5153c132..b82824ae1941 100644 --- a/test/e2e/playwright-default/test.mjs +++ b/test/e2e/playwright-default/test.mjs @@ -5,6 +5,6 @@ await initialize(testActorDirname); const { stats, datasetItems } = await runActor(testActorDirname, 16384); -await expect(stats.requestsFinished > 50, 'All requests finished'); -await expect(datasetItems.length > 50 && datasetItems.length < 150, 'Number of dataset items'); +await expect(stats.requestsFinished > 15, 'All requests finished'); +await expect(datasetItems.length > 15 && datasetItems.length < 25, 'Number of dataset items'); await expect(validateDataset(datasetItems, ['url', 'pageTitle']), 'Dataset items validation'); diff --git a/test/e2e/playwright-enqueue-links/actor/apify.json b/test/e2e/playwright-enqueue-links/actor/.actor/actor.json similarity index 79% rename from test/e2e/playwright-enqueue-links/actor/apify.json rename to test/e2e/playwright-enqueue-links/actor/.actor/actor.json index e36af37c1566..7294db34b97a 100644 --- a/test/e2e/playwright-enqueue-links/actor/apify.json +++ b/test/e2e/playwright-enqueue-links/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-playwright-enqueue-links", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/playwright-enqueue-links/actor/Dockerfile b/test/e2e/playwright-enqueue-links/actor/Dockerfile index de06663ad921..58d737169f5e 100644 --- a/test/e2e/playwright-enqueue-links/actor/Dockerfile +++ b/test/e2e/playwright-enqueue-links/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/playwright-firefox-experimental-containers/actor/apify.json b/test/e2e/playwright-firefox-experimental-containers/actor/.actor/actor.json similarity index 82% rename from test/e2e/playwright-firefox-experimental-containers/actor/apify.json rename to test/e2e/playwright-firefox-experimental-containers/actor/.actor/actor.json index 8bc7a689eb30..d1bf754a588a 100644 --- a/test/e2e/playwright-firefox-experimental-containers/actor/apify.json +++ b/test/e2e/playwright-firefox-experimental-containers/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-playwright-firefox-experimental-containers", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/playwright-firefox-experimental-containers/actor/Dockerfile b/test/e2e/playwright-firefox-experimental-containers/actor/Dockerfile index 8a1c0fff05c1..af65b94ebec5 100644 --- a/test/e2e/playwright-firefox-experimental-containers/actor/Dockerfile +++ b/test/e2e/playwright-firefox-experimental-containers/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/playwright-initial-cookies/actor/apify.json b/test/e2e/playwright-initial-cookies/actor/.actor/actor.json similarity index 79% rename from test/e2e/playwright-initial-cookies/actor/apify.json rename to test/e2e/playwright-initial-cookies/actor/.actor/actor.json index ca72b5fff53f..0404c8af3b89 100644 --- a/test/e2e/playwright-initial-cookies/actor/apify.json +++ b/test/e2e/playwright-initial-cookies/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-playwright-initial-cookies", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/playwright-initial-cookies/actor/Dockerfile b/test/e2e/playwright-initial-cookies/actor/Dockerfile index de06663ad921..58d737169f5e 100644 --- a/test/e2e/playwright-initial-cookies/actor/Dockerfile +++ b/test/e2e/playwright-initial-cookies/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/proxy-rotation/actor/apify.json b/test/e2e/proxy-rotation/actor/.actor/actor.json similarity index 77% rename from test/e2e/proxy-rotation/actor/apify.json rename to test/e2e/proxy-rotation/actor/.actor/actor.json index eb8ac5e01f3d..4af4d048905f 100644 --- a/test/e2e/proxy-rotation/actor/apify.json +++ b/test/e2e/proxy-rotation/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-proxy-rotation", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/proxy-rotation/actor/Dockerfile b/test/e2e/proxy-rotation/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/proxy-rotation/actor/Dockerfile +++ b/test/e2e/proxy-rotation/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-default/actor/apify.json b/test/e2e/puppeteer-default/actor/.actor/actor.json similarity index 78% rename from test/e2e/puppeteer-default/actor/apify.json rename to test/e2e/puppeteer-default/actor/.actor/actor.json index f57a60ea828f..f2fa978c5cd6 100644 --- a/test/e2e/puppeteer-default/actor/apify.json +++ b/test/e2e/puppeteer-default/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-default", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-default/actor/Dockerfile b/test/e2e/puppeteer-default/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-default/actor/Dockerfile +++ b/test/e2e/puppeteer-default/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-default/actor/main.js b/test/e2e/puppeteer-default/actor/main.js index 291249bdadfa..699239d1a000 100644 --- a/test/e2e/puppeteer-default/actor/main.js +++ b/test/e2e/puppeteer-default/actor/main.js @@ -16,9 +16,11 @@ await Actor.main(async () => { const { url } = request; const pageTitle = await page.title(); await Dataset.pushData({ url, pageTitle }); - await enqueueLinks({ regexps: [/^https:\/\/apify\.com(\/[\w-]+)?$/i] }); + await enqueueLinks({ + globs: ['**/3.0/examples/*'], + }); }, }); - await crawler.run(['https://apify.com']); + await crawler.run(['https://crawlee.dev/docs/3.0/examples/']); }, mainOptions); diff --git a/test/e2e/puppeteer-default/test.mjs b/test/e2e/puppeteer-default/test.mjs index 7b0d5153c132..b82824ae1941 100644 --- a/test/e2e/puppeteer-default/test.mjs +++ b/test/e2e/puppeteer-default/test.mjs @@ -5,6 +5,6 @@ await initialize(testActorDirname); const { stats, datasetItems } = await runActor(testActorDirname, 16384); -await expect(stats.requestsFinished > 50, 'All requests finished'); -await expect(datasetItems.length > 50 && datasetItems.length < 150, 'Number of dataset items'); +await expect(stats.requestsFinished > 15, 'All requests finished'); +await expect(datasetItems.length > 15 && datasetItems.length < 25, 'Number of dataset items'); await expect(validateDataset(datasetItems, ['url', 'pageTitle']), 'Dataset items validation'); diff --git a/test/e2e/puppeteer-enqueue-links/actor/apify.json b/test/e2e/puppeteer-enqueue-links/actor/.actor/actor.json similarity index 79% rename from test/e2e/puppeteer-enqueue-links/actor/apify.json rename to test/e2e/puppeteer-enqueue-links/actor/.actor/actor.json index 7dd9d68c5729..7beecb4304d4 100644 --- a/test/e2e/puppeteer-enqueue-links/actor/apify.json +++ b/test/e2e/puppeteer-enqueue-links/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-enqueue-links", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-enqueue-links/actor/Dockerfile b/test/e2e/puppeteer-enqueue-links/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-enqueue-links/actor/Dockerfile +++ b/test/e2e/puppeteer-enqueue-links/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-ignore-ssl-errors/actor/apify.json b/test/e2e/puppeteer-ignore-ssl-errors/actor/.actor/actor.json similarity index 80% rename from test/e2e/puppeteer-ignore-ssl-errors/actor/apify.json rename to test/e2e/puppeteer-ignore-ssl-errors/actor/.actor/actor.json index 049cfe03dc62..abbeda5d965d 100644 --- a/test/e2e/puppeteer-ignore-ssl-errors/actor/apify.json +++ b/test/e2e/puppeteer-ignore-ssl-errors/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-ignore-ssl-errors", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-ignore-ssl-errors/actor/Dockerfile b/test/e2e/puppeteer-ignore-ssl-errors/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-ignore-ssl-errors/actor/Dockerfile +++ b/test/e2e/puppeteer-ignore-ssl-errors/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-initial-cookies/actor/apify.json b/test/e2e/puppeteer-initial-cookies/actor/.actor/actor.json similarity index 79% rename from test/e2e/puppeteer-initial-cookies/actor/apify.json rename to test/e2e/puppeteer-initial-cookies/actor/.actor/actor.json index aa2946018476..328c5bb8a8c3 100644 --- a/test/e2e/puppeteer-initial-cookies/actor/apify.json +++ b/test/e2e/puppeteer-initial-cookies/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-initial-cookies", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-initial-cookies/actor/Dockerfile b/test/e2e/puppeteer-initial-cookies/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-initial-cookies/actor/Dockerfile +++ b/test/e2e/puppeteer-initial-cookies/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-page-info/actor/apify.json b/test/e2e/puppeteer-page-info/actor/.actor/actor.json similarity index 78% rename from test/e2e/puppeteer-page-info/actor/apify.json rename to test/e2e/puppeteer-page-info/actor/.actor/actor.json index e136f456e4a0..285cbce737d3 100644 --- a/test/e2e/puppeteer-page-info/actor/apify.json +++ b/test/e2e/puppeteer-page-info/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-page-info", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-page-info/actor/Dockerfile b/test/e2e/puppeteer-page-info/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-page-info/actor/Dockerfile +++ b/test/e2e/puppeteer-page-info/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-page-info/actor/main.js b/test/e2e/puppeteer-page-info/actor/main.js index ee853ff0e177..e851d45691d9 100644 --- a/test/e2e/puppeteer-page-info/actor/main.js +++ b/test/e2e/puppeteer-page-info/actor/main.js @@ -17,7 +17,7 @@ await Actor.main(async () => { if (label === 'START') { await enqueueLinks({ - globs: [{ glob: 'https://apify.com/apify/web-scraper', userData: { label: 'DETAIL' } }], + globs: ['**/examples/accept-user-input'], userData: { label: 'DETAIL' }, }); } @@ -27,28 +27,22 @@ await Actor.main(async () => { const uniqueIdentifier = url.split('/').slice(-2).join('/'); const titleP = page.$eval('header h1', ((el) => el.textContent)); - const descriptionP = page.$eval('header span.actor-description', ((el) => el.textContent)); - const modifiedTimestampP = page.$eval('ul.ActorHeader-stats time', (el) => el.getAttribute('datetime')); - const runCountTextP = page.$eval('ul.ActorHeader-stats > li:nth-of-type(3)', ((el) => el.textContent)); + const firstParagraphP = page.$eval('header + p', ((el) => el.textContent)); + const modifiedDateP = page.$eval('.theme-last-updated time', (el) => el.getAttribute('datetime')); const [ title, description, - modifiedTimestamp, - runCountText, + modifiedDate, ] = await Promise.all([ titleP, - descriptionP, - modifiedTimestampP, - runCountTextP, + firstParagraphP, + modifiedDateP, ]); - const modifiedDate = new Date(Number(modifiedTimestamp)); - const runCount = Number(runCountText.match(/[\d,]+/)[0].replace(/,/g, '')); - - await Dataset.pushData({ url, uniqueIdentifier, title, description, modifiedDate, runCount }); + await Dataset.pushData({ url, uniqueIdentifier, title, description, modifiedDate }); } }, }); - await crawler.run([{ url: 'https://apify.com/store', userData: { label: 'START' } }]); + await crawler.run([{ url: 'https://crawlee.dev/docs/3.0/examples', userData: { label: 'START' } }]); }, mainOptions); diff --git a/test/e2e/puppeteer-page-info/test.mjs b/test/e2e/puppeteer-page-info/test.mjs index 3f9f005d1089..06d47068cb4b 100644 --- a/test/e2e/puppeteer-page-info/test.mjs +++ b/test/e2e/puppeteer-page-info/test.mjs @@ -8,6 +8,6 @@ const { stats, datasetItems } = await runActor(testActorDirname, 16384); await expect(stats.requestsFinished === 2, 'All requests finished'); await expect(datasetItems.length === 1, 'Number of dataset items'); await expect( - validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'description', 'modifiedDate', 'runCount']), + validateDataset(datasetItems, ['url', 'title', 'uniqueIdentifier', 'description', 'modifiedDate']), 'Dataset items validation', ); diff --git a/test/e2e/puppeteer-store-pagination-jquery/actor/apify.json b/test/e2e/puppeteer-store-pagination-jquery/actor/.actor/actor.json similarity index 80% rename from test/e2e/puppeteer-store-pagination-jquery/actor/apify.json rename to test/e2e/puppeteer-store-pagination-jquery/actor/.actor/actor.json index 238376e780c1..8d6941f71f80 100644 --- a/test/e2e/puppeteer-store-pagination-jquery/actor/apify.json +++ b/test/e2e/puppeteer-store-pagination-jquery/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-store-pagination-jquery", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-store-pagination-jquery/actor/Dockerfile b/test/e2e/puppeteer-store-pagination-jquery/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-store-pagination-jquery/actor/Dockerfile +++ b/test/e2e/puppeteer-store-pagination-jquery/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-store-pagination-jquery/actor/main.js b/test/e2e/puppeteer-store-pagination-jquery/actor/main.js index f18f8b5dcaf8..8d641cd527df 100644 --- a/test/e2e/puppeteer-store-pagination-jquery/actor/main.js +++ b/test/e2e/puppeteer-store-pagination-jquery/actor/main.js @@ -26,7 +26,7 @@ await Actor.main(async () => { await page.waitForNetworkIdle(); // Enqueue all loaded links await enqueueLinks({ - selector: 'a.ActorStoreItem', + selector: '[data-test="actorCard"] > a', globs: [{ glob: 'https://apify.com/*/*', userData: { label: 'DETAIL' } }], }); log.info(`Enqueued actors for page ${pageNo}`); diff --git a/test/e2e/puppeteer-store-pagination/actor/apify.json b/test/e2e/puppeteer-store-pagination/actor/.actor/actor.json similarity index 79% rename from test/e2e/puppeteer-store-pagination/actor/apify.json rename to test/e2e/puppeteer-store-pagination/actor/.actor/actor.json index d87f9cd56931..0fd41a53d7f3 100644 --- a/test/e2e/puppeteer-store-pagination/actor/apify.json +++ b/test/e2e/puppeteer-store-pagination/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-store-pagination", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-store-pagination/actor/Dockerfile b/test/e2e/puppeteer-store-pagination/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-store-pagination/actor/Dockerfile +++ b/test/e2e/puppeteer-store-pagination/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/puppeteer-store-pagination/actor/main.js b/test/e2e/puppeteer-store-pagination/actor/main.js index 9357d65d7e7c..86726517aad9 100644 --- a/test/e2e/puppeteer-store-pagination/actor/main.js +++ b/test/e2e/puppeteer-store-pagination/actor/main.js @@ -21,7 +21,7 @@ crawler.router.addHandler('START', async ({ log, enqueueLinks, page }) => { await page.waitForNetworkIdle(); // Enqueue all loaded links await enqueueLinks({ - selector: 'a.ActorStoreItem', + selector: '[data-test="actorCard"] > a', label: 'DETAIL', globs: ['https://apify.com/*/*'], }); diff --git a/test/e2e/puppeteer-throw-on-ssl-errors/actor/apify.json b/test/e2e/puppeteer-throw-on-ssl-errors/actor/.actor/actor.json similarity index 80% rename from test/e2e/puppeteer-throw-on-ssl-errors/actor/apify.json rename to test/e2e/puppeteer-throw-on-ssl-errors/actor/.actor/actor.json index 8c375a7490f0..224de98d2f9e 100644 --- a/test/e2e/puppeteer-throw-on-ssl-errors/actor/apify.json +++ b/test/e2e/puppeteer-throw-on-ssl-errors/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-puppeteer-throw-on-ssl-errors", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/puppeteer-throw-on-ssl-errors/actor/Dockerfile b/test/e2e/puppeteer-throw-on-ssl-errors/actor/Dockerfile index 7c7d30b8202a..de6b194d086f 100644 --- a/test/e2e/puppeteer-throw-on-ssl-errors/actor/Dockerfile +++ b/test/e2e/puppeteer-throw-on-ssl-errors/actor/Dockerfile @@ -12,7 +12,7 @@ RUN rm -r node_modules COPY --from=builder /node_modules ./node_modules COPY --from=builder /packages ./packages COPY --from=builder /package*.json ./ -COPY /apify.json ./ +COPY /.actor ./.actor COPY /main.js ./ RUN echo "Installed NPM packages:" \ diff --git a/test/e2e/request-queue-zero-concurrency/actor/apify.json b/test/e2e/request-queue-zero-concurrency/actor/.actor/actor.json similarity index 80% rename from test/e2e/request-queue-zero-concurrency/actor/apify.json rename to test/e2e/request-queue-zero-concurrency/actor/.actor/actor.json index ccfd2bacdf12..959ec7eaa2b0 100644 --- a/test/e2e/request-queue-zero-concurrency/actor/apify.json +++ b/test/e2e/request-queue-zero-concurrency/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-request-queue-zero-concurrency", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/request-skip-navigation/actor/apify.json b/test/e2e/request-skip-navigation/actor/.actor/actor.json similarity index 79% rename from test/e2e/request-skip-navigation/actor/apify.json rename to test/e2e/request-skip-navigation/actor/.actor/actor.json index 391f5a195bba..0f06a7057474 100644 --- a/test/e2e/request-skip-navigation/actor/apify.json +++ b/test/e2e/request-skip-navigation/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-request-skip-navigation", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/session-rotation/actor/apify.json b/test/e2e/session-rotation/actor/.actor/actor.json similarity index 78% rename from test/e2e/session-rotation/actor/apify.json rename to test/e2e/session-rotation/actor/.actor/actor.json index bac48c79ccf4..7308531edb0f 100644 --- a/test/e2e/session-rotation/actor/apify.json +++ b/test/e2e/session-rotation/actor/.actor/actor.json @@ -1,4 +1,5 @@ { + "actorSpecification": 1, "name": "test-session-rotation", "version": "0.0", "buildTag": "latest", diff --git a/test/e2e/session-rotation/actor/main.js b/test/e2e/session-rotation/actor/main.js index 06a71131522a..107dd47c02a3 100644 --- a/test/e2e/session-rotation/actor/main.js +++ b/test/e2e/session-rotation/actor/main.js @@ -17,7 +17,7 @@ await Actor.main(async () => { }, requestHandler: async ({ session }) => { const { id, usageCount, errorScore } = session; - Actor.pushData({ id, usageCount, errorScore }); + await Actor.pushData({ id, usageCount, errorScore }); throw new Error('retry'); }, }); diff --git a/test/e2e/tools.mjs b/test/e2e/tools.mjs index 1603168b9d5d..85f9aa29ffe0 100644 --- a/test/e2e/tools.mjs +++ b/test/e2e/tools.mjs @@ -4,13 +4,17 @@ import { existsSync } from 'node:fs'; import { readdir, readFile } from 'node:fs/promises'; import { homedir } from 'node:os'; import { setTimeout } from 'node:timers/promises'; -import { execSync } from 'node:child_process'; +import { execSync as execSyncOriginal } from 'node:child_process'; import { got } from 'got'; import fs from 'fs-extra'; import { Actor } from 'apify'; // eslint-disable-next-line import/no-relative-packages import { URL_NO_COMMAS_REGEX } from '../../packages/utils/dist/index.mjs'; +function execSync(command, options) { + return execSyncOriginal(command, { ...options, encoding: 'utf-8' }); +} + /** * @param {string} name */