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.

fixed utils localEmulation.

Petr Patek0e2644d94564
diff --git a/test/puppeteer_utils.test.js b/test/puppeteer_utils.test.js
index 54c579174..e24241356 100644
--- a/test/puppeteer_utils.test.js
+++ b/test/puppeteer_utils.test.js
@@ -2,17 +2,28 @@ import sinon from 'sinon';
import path from 'path';
import Apify from '../build/index';
import * as keyValueStore from '../build/key_value_store';
+import LocalStorageDirEmulator from './local_storage_dir_emulator';
const { utils: { log } } = Apify;
describe('Apify.utils.puppeteer', () => {
let ll;
- beforeAll(() => {
+ let localStorageEmulator;
+
+ beforeAll(async () => {
ll = log.getLevel();
log.setLevel(log.LEVELS.ERROR);
+ localStorageEmulator = new LocalStorageDirEmulator();
+ await localStorageEmulator.init();
+ });
+
+ beforeEach(async () => {
+ await localStorageEmulator.clean();
});
- afterAll(() => {
+
+ afterAll(async () => {
log.setLevel(ll);
+ await localStorageEmulator.destroy();
});
test('injectFile()', async () => {