WebdriverIO Shared Store Service=========================> Exchange data between main process and workers (specs).## InstallationThe easiest way is to keep `@wdio/shared-store-service` as a dev dependency in your `package.json`, via:```shnpm install @wdio/shared-store-service --save-dev```Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)## UsageGet/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 ValuesTo set values to the store call:```jsawait browser.sharedStore.set('key', 'foobar123')```### Get ValuesTo get values from the store call:```jsconst value = await browser.sharedStore.get('key')console.log(value) // returns "foobar123"```You can also fetch all key values by using the `*` key:```jsconst store = await browser.sharedStore.get('*')console.log(value) // returns `{ key: "foobar" }````### Access Store in WDIO HooksYou could also directly access to `setValue` and `getValue` async handlers.Make sure you properly call them with the `await` keyword.```js// wdio.conf.jsimport { setValue, getValue } from '@wdio/shared-store-service'export const config = {// ...onPrepare: [async function (config, capabilities) {await setValue('foo', 'bar')}],// ...after: async () => {const value = await getValue('foo')// ...}```IMPORTANT! Every spec file should be atomic and isolated from others' specs.The idea of the service is to deal with very specific environment setup issues.Please avoid sharing test execution data!### Resource PoolsIf the worker threads are competing for resources that must be assigned for each worker, you can use Resource Pool API:```js// wdio.conf.jsimport { setResourcePool, getValueFromPool, addValueToPool } from '@wdio/shared-store-service'export const config = {maxInstances: 2,// ...onPrepare: async function (config, capabilities) {await setResourcePool('availableUrls', ['url01.com', 'url02.com'])},// ...beforeSession: async (conf) => {conf.baseUrl = await getValueFromPool('availableUrls');},// ...afterSession: async (conf) => {// worker returns the used resource for next workers to useawait addValueToPool('availableUrls', conf.baseUrl);}```This example ensures that both workers never use the same `baseUrl`. A unique url is only assigned to one worker until it's released by it.## ConfigurationAdd `shared-store` to the services list and the `sharedStore` object will be accessible to you on the [`browser` scope](https://webdriver.io/docs/api/browser) in your test.```js// wdio.conf.jsexport const config = {// ...services: ['shared-store'],// ...};```If you are using typescript, make sure to add `@wdio/shared-store-service` to your `compilerOptions.types`:```js{"compilerOptions": {"types": ["node", "@wdio/globals/types", "@wdio/shared-store-service"],}}```