As per this https://github.com/webdriverio/webdriverio/issues/1500, webdriverio test runner will load the config file for each spec file, which prevents us from persisting/sharing data/status across these specs (and sessions).
I'm wondering how it could be worked around. I guess it should be do-able, because the test-runner itself knows which spec it's going to run every time it loads the config file although the config file actually contains all the spec files as below
specs: [
'test/spec/**'
],
Just don't know how.
The bottom line is that keep the data in a temp file on the disk. However, this is quite ugly.
Unfortunately reason for that is every parallel thread in WebdriverIO is running in separate nodejs process, so they just don't have shared memory. Ways you can share data between workers:
I did something similar for ProtractorJS (some time ago): https://gist.github.com/Xotabu4/011d728752507f6a2d4775fd8659cfc4
And i also saw one service implemented exactly for webdriverio: https://webdriver.io/docs/shared-store-service.html
It also uses webserver under the hood.