{"_id":"@btapai/playwright-indexeddb","_rev":"4-596937ec082be324e2f5feb6f2533492","name":"@btapai/playwright-indexeddb","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@btapai/playwright-indexeddb","version":"0.0.1","keywords":["playwright","indexedDB","testing","javascript","typescript"],"author":{"name":"Balázs Tápai","email":"balazs.tapai1990+oss@gmail.com"},"_id":"@btapai/playwright-indexeddb@0.0.1","maintainers":[{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"}],"homepage":"https://github.com/TapaiBalazs/playwright-indexeddb/blob/main/libs/playwright-indexeddb","bugs":{"url":"https://github.com/TapaiBalazs/playwright-indexeddb/issues"},"dist":{"shasum":"3b6f2969bff4f63a8015da10f25ae0cd5f77ca84","tarball":"https://registry.npmjs.org/@btapai/playwright-indexeddb/-/playwright-indexeddb-0.0.1.tgz","fileCount":16,"integrity":"sha512-wA1cqYso34HR15AeI4EnXClI1F4JpDPj6dtoO/b/fRo+BMG5vagP/KTll8J3cE1mGR6wxwmVY2yEhTvnUA67JA==","signatures":[{"sig":"MEUCIC7G7huRx8lRJ4qE9rESvWEyFQmd5lgixqCi9og86BbyAiEAhWZXWwcKcmslHdTt1S0Vsx/odi3f5UtBY01eVngMDOc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58951},"main":"./../../dist/libs/playwright-indexeddb/src/index.js","type":"commonjs","types":"./../../dist/libs/playwright-indexeddb/src/index.d.ts","gitHead":"96d6d39420d6031fe2fc478d4459e5489ab7b927","private":false,"_npmUser":{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"},"repository":{"url":"git+https://github.com/TapaiBalazs/playwright-indexeddb.git","type":"git"},"_npmVersion":"11.9.0","description":"A Playwright helper library for reading and manipulating data inside IndexedDb","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"peerDependencies":{"playwright":"*"},"_npmOperationalInternal":{"tmp":"tmp/playwright-indexeddb_0.0.1_1773429088477_0.2519631749307978","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@btapai/playwright-indexeddb","version":"0.0.2","keywords":["playwright","indexedDB","testing","javascript","typescript"],"author":{"name":"Balázs Tápai","email":"balazs.tapai1990+oss@gmail.com"},"_id":"@btapai/playwright-indexeddb@0.0.2","maintainers":[{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"}],"homepage":"https://github.com/TapaiBalazs/playwright-indexeddb/blob/main/libs/playwright-indexeddb","bugs":{"url":"https://github.com/TapaiBalazs/playwright-indexeddb/issues"},"dist":{"shasum":"bfacd9874f7374ad4c59391e4349a03120f61198","tarball":"https://registry.npmjs.org/@btapai/playwright-indexeddb/-/playwright-indexeddb-0.0.2.tgz","fileCount":17,"integrity":"sha512-xf4fOnbHYZmk2N5ub7z6tx4PBEnXKqFEA5MieB0OvGj0gz+d7hltqq1LKtDuAVjXolHuAEP+unLF6v6j1qwocw==","signatures":[{"sig":"MEYCIQDlTZMUVO/Uz2zQytszbT7nz7uJF0t53xbBcPEfyWsEtQIhAP7WRpHr/FDZVo4cqND7R8PTu3nmOJyXnnxmbGR7xJsO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65795},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"cea0577411369c56d34557375f2922215e2c0991","private":false,"_npmUser":{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"},"repository":{"url":"git+https://github.com/TapaiBalazs/playwright-indexeddb.git","type":"git"},"_npmVersion":"11.9.0","description":"A Playwright helper library for reading and manipulating data inside IndexedDb","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"peerDependencies":{"playwright":"*"},"_npmOperationalInternal":{"tmp":"tmp/playwright-indexeddb_0.0.2_1773429293556_0.7187369699182273","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@btapai/playwright-indexeddb","version":"0.0.3","keywords":["playwright","indexedDB","testing","javascript","typescript"],"author":{"name":"Balázs Tápai","email":"balazs.tapai1990+oss@gmail.com"},"_id":"@btapai/playwright-indexeddb@0.0.3","maintainers":[{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"}],"homepage":"https://github.com/TapaiBalazs/playwright-indexeddb/blob/main/libs/playwright-indexeddb","bugs":{"url":"https://github.com/TapaiBalazs/playwright-indexeddb/issues"},"dist":{"shasum":"7cd3c9ceeb55dd354d659e89e81c36e58deecda5","tarball":"https://registry.npmjs.org/@btapai/playwright-indexeddb/-/playwright-indexeddb-0.0.3.tgz","fileCount":17,"integrity":"sha512-LqLnkk/6kdupQdpDxWgLpYQAapcbey47Nd5BXnR2ZmZ0ROeqtGFRASUYfB3RHKA7mcHnd+cv8FCs23CaOLGFyw==","signatures":[{"sig":"MEUCIDuIEzfuOMIdSina6K31CUlPdk5IZoYE6Njq8zbdA4U0AiEAraiWId0UF8+OTvdN6Gn5ie7Q1stUHcgcs4YFb9W0Q6c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65958},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"5303b6bfa7136292408fbc7c8f1365beea011b4b","private":false,"_npmUser":{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"},"repository":{"url":"git+https://github.com/TapaiBalazs/playwright-indexeddb.git","type":"git"},"_npmVersion":"11.9.0","description":"A Playwright helper library for reading and manipulating data inside IndexedDb","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"peerDependencies":{"playwright":"*"},"_npmOperationalInternal":{"tmp":"tmp/playwright-indexeddb_0.0.3_1773430700150_0.8560642190978285","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@btapai/playwright-indexeddb","version":"0.0.4","description":"A Playwright helper library for reading and manipulating data inside IndexedDb","author":{"name":"Balázs Tápai","email":"balazs.tapai1990+oss@gmail.com"},"private":false,"keywords":["playwright","indexedDB","testing","javascript","typescript"],"license":"MIT","peerDependencies":{"playwright":"*"},"homepage":"https://github.com/TapaiBalazs/playwright-indexeddb/blob/main/libs/playwright-indexeddb","bugs":{"url":"https://github.com/TapaiBalazs/playwright-indexeddb/issues"},"repository":{"type":"git","url":"git+https://github.com/TapaiBalazs/playwright-indexeddb.git"},"types":"./src/index.d.ts","main":"./src/index.js","type":"commonjs","gitHead":"9c58759ad0113a4aa8b23dd17933f278a73c4da7","_id":"@btapai/playwright-indexeddb@0.0.4","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-Ghh7JdecTal6prFDZ8ZTmZPUUK62DRqo+eZbbdsm78GDC6b3pwWKhE4BgZJo5gsfoVvp9zaQ/9LP4yk5OUCw5Q==","shasum":"80cbc2dff47ef5f5311d5875c3d9acdf0bbb338d","tarball":"https://registry.npmjs.org/@btapai/playwright-indexeddb/-/playwright-indexeddb-0.0.4.tgz","fileCount":17,"unpackedSize":65978,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxqrqku63Kl/yR+vCVvwBQvXHnUJy5icAuvfmPYkrCOAIgWA9OrowufTjlNAmSip6ojcwmxrfd8sqf2Id6utt9Ax8="}]},"_npmUser":{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"},"directories":{},"maintainers":[{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/playwright-indexeddb_0.0.4_1773528107109_0.3589497018924557"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T19:11:28.368Z","modified":"2026-03-14T22:41:47.378Z","0.0.1":"2026-03-13T19:11:28.611Z","0.0.2":"2026-03-13T19:14:53.714Z","0.0.3":"2026-03-13T19:38:20.304Z","0.0.4":"2026-03-14T22:41:47.274Z"},"bugs":{"url":"https://github.com/TapaiBalazs/playwright-indexeddb/issues"},"author":{"name":"Balázs Tápai","email":"balazs.tapai1990+oss@gmail.com"},"homepage":"https://github.com/TapaiBalazs/playwright-indexeddb/blob/main/libs/playwright-indexeddb","keywords":["playwright","indexedDB","testing","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/TapaiBalazs/playwright-indexeddb.git"},"description":"A Playwright helper library for reading and manipulating data inside IndexedDb","maintainers":[{"name":"btapai","email":"balazs.tapai1990+npm@gmail.com"}],"readme":"# @btapai/playwright-indexeddb\n\n`@btapai/playwright-indexeddb` is a Playwright helper library for preparing,\ninspecting, and manipulating IndexedDB state from tests.\n\n## How to install\n\nThe package is published on npm as `@btapai/playwright-indexeddb`.\n\nInstall it with npm:\n\n```bash\nnpm install @btapai/playwright-indexeddb\n```\n\nThe main entry point is `PlaywrightIdbHelper`:\n\n```ts\nimport { PlaywrightIdbHelper } from '@btapai/playwright-indexeddb';\n```\n\nThe examples below are based on the real end-to-end usage in\n`apps/showcase-e2e/src/playwright-indexeddb.spec.ts`.\n\n## Best practice before initialization\n\nBefore calling `init()`, delete the IndexedDB database you want to use in the\ntest. This keeps setup deterministic and avoids stale data or leftover schema\nfrom previous test runs.\n\nRecommended setup pattern:\n\n```ts\nconst playwrightIdb = new PlaywrightIdbHelper(page);\n\nawait page.goto('/');\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\nawait playwrightIdb.init('FORM_CACHE');\nawait playwrightIdb.createObjectStore('user_form_store');\n```\n\n## How to clear a database?\n\nThe library supports both clearing store contents and deleting the whole\ndatabase.\n\n### Clear the contents of a store through the library\n\nIf your test only needs an empty object store, delete each key through the\nstore helper:\n\n```ts\nconst playwrightIdb = new PlaywrightIdbHelper(page);\n\nawait page.goto('/');\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\nawait playwrightIdb.init('FORM_CACHE');\nawait playwrightIdb.createObjectStore('user_form_store');\n\nconst store = playwrightIdb.getStore('user_form_store');\nfor (const key of await store.keys()) {\n  await store.deleteItem(key);\n}\n\nexpect(await store.keys()).toHaveLength(0);\n```\n\nThis matches the form showcase flow where the stored `user_form` entry is\ndeleted and the store becomes empty again.\n\n### Delete the whole IndexedDB database through Playwright\n\nIf you need to remove the whole IndexedDB database, call\n`deleteDatabase()` on `PlaywrightIdbHelper` before you initialize the\ndatabase:\n\n```ts\nconst playwrightIdb = new PlaywrightIdbHelper(page);\n\nawait page.goto('/');\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\n```\n\nThis removes the full database, including every object store inside it, not\njust the current store.\n\nAfter deletion, initialize the same helper and recreate the store if your test\nneeds the database again:\n\n```ts\nawait playwrightIdb.init('FORM_CACHE');\nawait playwrightIdb.createObjectStore('user_form_store');\n```\n\n## How to create a database connection?\n\nCreate a Playwright page, navigate to the application, instantiate\n`PlaywrightIdbHelper`, and call `init()`.\n\n```ts\nconst page = await browser.newPage();\nawait page.goto('/');\n\nconst playwrightIdb = new PlaywrightIdbHelper(page);\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\nawait playwrightIdb.init('FORM_CACHE');\n```\n\nImportant details:\n\n- Call `page.goto()` before `init()`, otherwise the browser context is not\n  ready for IndexedDB access.\n- `init()` should be called once per helper instance.\n- You can optionally pass a version if your test needs an explicit database\n  version:\n\n```ts\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\nawait playwrightIdb.init('FORM_CACHE', 1);\n```\n\n## How to create an Object Store?\n\nAfter initializing the database, create an object store with\n`createObjectStore()`.\n\n### Standard store with explicit keys\n\n```ts\nawait playwrightIdb.deleteDatabase('FORM_CACHE');\nawait playwrightIdb.init('FORM_CACHE');\nconst formStore = await playwrightIdb.createObjectStore('user_form_store');\n```\n\n### Store with IndexedDB options\n\nFor auto-increment stores, pass the normal `IDBObjectStoreParameters`:\n\n```ts\nawait playwrightIdb.deleteDatabase('AUTO_INCREMENT');\nawait playwrightIdb.init('AUTO_INCREMENT');\nconst queueStore = await playwrightIdb.createObjectStore('store', {\n  autoIncrement: true,\n});\n```\n\nOnce created, you can fetch the same helper later with `getStore()`:\n\n```ts\nconst queueStore = playwrightIdb.getStore('store');\n```\n\n## How to make CRUD operations on an Object Store?\n\nThe store helper exposes `createItem`, `readItem`, `updateItem`, and\n`deleteItem`.\n\n### Create\n\nUse `createItem(key, value)` for stores that use explicit keys:\n\n```ts\nawait playwrightIdb\n  .getStore('user_form_store')\n  .createItem('user_form', {\n    firstName: 'John',\n    lastName: 'McClane',\n    country: 'USA',\n    city: 'New York',\n  });\n```\n\n### Read\n\nUse `readItem(key)` to fetch the stored value:\n\n```ts\nconst savedForm = await playwrightIdb\n  .getStore('user_form_store')\n  .readItem<{\n    firstName: string;\n    lastName: string;\n    country: string;\n    city: string;\n  }>('user_form');\n\nexpect(savedForm).toEqual({\n  firstName: 'John',\n  lastName: 'McClane',\n  country: 'USA',\n  city: 'New York',\n});\n```\n\nThis is the same pattern used by the showcase e2e tests when they poll the\ndatabase to verify that form values were written.\n\n### Update\n\nUse `updateItem(key, value)` to replace the stored value:\n\n```ts\nawait playwrightIdb.getStore('store').updateItem(2, 'updated-test2');\n```\n\n### Delete\n\nUse `deleteItem(key)` to remove a value:\n\n```ts\nawait playwrightIdb.getStore('store').deleteItem(2);\n```\n\n`deleteItem()` returns the same store helper, so you can immediately continue\nwith metadata reads:\n\n```ts\nconst keysAfterDeletion = await playwrightIdb\n  .getStore('user_form_store')\n  .deleteItem('user_form')\n  .then((store) => store.keys());\n```\n\n### Read all keys and values\n\nUse `keys()` and `values()` when you want to inspect the full store content:\n\n```ts\nconst store = playwrightIdb.getStore('store');\n\nexpect(await store.keys()).toEqual([1, 2, 3]);\nexpect(await store.values<string>()).toEqual(['test', 'test2', '1337']);\n```\n\n## How to handle Object Stores with autoIncrement?\n\nAuto-increment stores are useful for queue-like data where IndexedDB generates\nthe numeric keys for you.\n\n### 1. Create the store with `autoIncrement: true`\n\n```ts\nawait page.goto('/playwright-indexeddb/auto-increment');\n\nconst playwrightIdb = new PlaywrightIdbHelper(page);\nawait playwrightIdb.deleteDatabase('AUTO_INCREMENT');\nawait playwrightIdb.init('AUTO_INCREMENT');\n\nconst store = await playwrightIdb.createObjectStore('store', {\n  autoIncrement: true,\n});\n```\n\n### 2. Append values with `addItem()`\n\n```ts\nawait store.addItem('test');\nawait store.addItem('test2');\nawait store.addItem('1337');\n```\n\n### 3. Inspect the generated keys and values\n\n```ts\nexpect(await store.keys()).toEqual([1, 2, 3]);\nexpect(await store.values<string>()).toEqual(['test', 'test2', '1337']);\n```\n\n### 4. Update or delete entries by numeric key\n\n```ts\nawait store.updateItem(2, 'updated-test2');\nawait store.deleteItem(3);\n```\n\n### 5. Verify application behavior against IndexedDB state\n\nThis is a common test pattern from the showcase app:\n\n```ts\nawait expect.poll(async () => store.values<string>()).toEqual([\n  'test',\n  'test2',\n  '1337',\n  'something',\n  'anything',\n  'whatever',\n  'seriously',\n]);\n```\n\nThis makes the library useful both for setup and for validating that UI\nactions changed IndexedDB exactly as expected.\n","readmeFilename":"README.md","license":"MIT"}