Shared Store Service
Exchange data between main process and workers (specs).
Installation
The easiest way is to keep @wdio/shared-store-service as a dev dependency in your package.json, via:
npm install @wdio/shared-store-service --save-dev
Instructions on how to install WebdriverIO can be found here.
Usage
Get/set a value (a plain object) to/from the store by key (string). The key can be any arbitrary string except * which is reserved as it allows you to fetch the whole store.
Set Values
To set values to the store call:
await browser.sharedStore.set('key', 'foobar123')
Get Values
To get values from the store call:
const value = await browser.sharedStore.get('key')
console.log(value) // returns "foobar123"
You can also fetch all key values by using the * key:
const store = await browser.sharedStore.get('*')
console.log(value) // returns `{ key: "foobar" }`