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.

894 B
Raw Blame
import { expect, getActorTestDir, initialize, runActor } from '../tools.mjs';

const testActorDirname = getActorTestDir(import.meta.url);
await initialize(testActorDirname);

const { defaultKeyValueStoreItems: items } = await runActor(testActorDirname);

await expect(items !== undefined, 'Key value store exists');

await expect(items.length === 1, 'Key-value store automatically saved the value expected to be auto-saved');

const item = items.find((kvItem) => kvItem.name === 'crawlee');

await expect(item !== undefined, 'Key-value store auto-saved value is named "crawlee"');

const parsed = JSON.parse(item.raw.toString());

await expect(typeof parsed === 'object' && parsed !== null, 'Key-value store auto-save value is a non-nullable object');
await expect(
    parsed.crawlee === 'awesome!',
    'Key-value store auto-save value has a property "crawlee" that is set to "awesome!"',
);