Skip to content

Commit b88a8b1

Browse files
committed
test(e2e): use impit in the robots file test
The store 429s plain HTTP clients, so `cheerio-robots-file` never got a single request through and failed on its `requestsFinished >= 1` precondition rather than on the robots.txt behaviour it asserts. The block keys off the client, not the IP: the browser-based tests reach the same store from the same address, and routing the crawl through a proxy changed nothing. Impersonating Firefox gets us through, the same way `cheerio-impit-ts` already does.
1 parent 3e3dc63 commit b88a8b1

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

test/e2e/cheerio-robots-file/actor/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CheerioCrawler } from '@crawlee/cheerio';
2+
import { Browser, ImpitHttpClient } from '@crawlee/impit-client';
23
import { Actor } from 'apify';
34

45
await Actor.init({
@@ -9,8 +10,9 @@ await Actor.init({
910
});
1011

1112
const crawler = new CheerioCrawler({
12-
// The store rate-limits the platform's shared egress IP, so crawl through a proxy.
1313
proxyConfiguration: await Actor.createProxyConfiguration(),
14+
// The store 429s plain HTTP clients; impersonating a browser gets us through.
15+
httpClient: new ImpitHttpClient({ browser: Browser.Firefox }),
1416
maxRequestsPerCrawl: 10,
1517
respectRobotsTxtFile: true,
1618
});

test/e2e/cheerio-robots-file/actor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@crawlee/core": "file:./packages/core",
1212
"@crawlee/memory-storage": "file:./packages/memory-storage",
1313
"@crawlee/cheerio": "file:./packages/cheerio-crawler",
14+
"@crawlee/impit-client": "file:./packages/impit-client",
1415
"@crawlee/types": "file:./packages/types",
1516
"@crawlee/utils": "file:./packages/utils"
1617
},

0 commit comments

Comments
 (0)