Closed jeffb-sfdc closed 1 year ago
- Is it possible to have a singleton be accessible to the various test suites?
Yes , you can write a custom service that launches a Node.js process running that singleton and allowing to communicate to this process via ipc. You can create custom commands to simplify this.
2. Is it possible to configure a project, so that the test suites run sequentially and only run one test suite at a time?
Yes, see https://webdriver.io/docs/organizingsuites#grouping-test-specs-to-run-sequentially
Our extension relies on a dependency, and we need to manage when and how the dependency runs. When our test suites run, they run in parallel and when we run this dependency, we've found that it needs to run sequentially, just one at a time, and this conflicts with our test suites which are running in parallel.
To overcome this, I tried creating a singleton to manage the resource, but I've since found out that each test suite (eg
a.e2e.ts
,b.e2e.ts
,c.e2e.ts
, etc...) runs in its own (siloed) memory space.So when
a.e2e.ts
runs,Singleton.instance
is null and an instance ofSingleton()
is created (which is expected), and whenb.2e.ts
runs,Singleton.instance
is ALSO null and a new instance ofSingleton()
is created (which is not expected), and whenc.2e.ts
runs,Singleton.instance
is ALSO null... etc...I have two questions:
Thanks,
Jeff