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 failing tests (#1366)

Andrey Bykov88aa84909bf7
diff --git a/test/crawlers/browser_crawler.test.js b/test/crawlers/browser_crawler.test.js
index df3fbb506..1a4e964c1 100644
--- a/test/crawlers/browser_crawler.test.js
+++ b/test/crawlers/browser_crawler.test.js
@@ -627,7 +627,7 @@ describe('BrowserCrawler', () => {
const stub = sinon.stub(utilsRequest, 'requestAsBrowser').callsFake(fakeCall);
const proxyConfiguration = await Apify.createProxyConfiguration();
- const generatedProxyUrl = new URL(await proxyConfiguration.newUrl()).href;
+ const generatedProxyUrl = new URL(await proxyConfiguration.newUrl()).href.slice(0, -1);
let browserProxy;
const browserCrawler = new Apify.BrowserCrawler({
@@ -731,7 +731,7 @@ describe('BrowserCrawler', () => {
const proxiesToUse = proxyConfiguration.proxyUrls;
for (const proxyUrl of proxiesToUse) {
- expect(browserProxies.includes(new URL(proxyUrl).href)).toBeTruthy();
+ expect(browserProxies.includes(new URL(proxyUrl).href.slice(0, -1))).toBeTruthy();
}
delete process.env[ENV_VARS.PROXY_PASSWORD];