with WebdriverIO 7.21 & Jasmine 3.7 the following works stable, hope it's not changed in Wdio 8 or Jasmine 4.
At least the jasmineOpts
(instead of older jasmineNodeOpts
) works fine in wdio 7, but is correctly mentioned from wdio 8 docs.
A working package.json script is using the Jasmine's grep:
"smoketest": "wdio run wdio.local.conf.js --suite=temp --jasmineOpts.grep=_smoke"
where:
--suite=temp
is defined in the wdio.local.conf.js suites and runs only those spec files,
--jasmineOpts.grep=_smoke
finds '_smoke' part in the test (it
) titles AND describe
titles inside the above spec files and runs only them.
This would run the full describe
describe(`Suite 1 _smoke any other text`, () => {
it('Test 1-1', async () => {});
it('Test 1-2', async () => {});
});
and tests from another describe(s) like:
it('Test 2-1 _smoke is for smoke runs', async () => {});
Non-matching tests (its) are skipped.
_smoke
can be any other text tag you add to the titles.
Additional info:
- Of course, you remember to add an extra
--
to run an npm script with extra options :)
(I used to forget)))
package.json script:
"localtest": "wdio run wdio.local.conf.js --suite=temp"
command line:
$ npm run localtest -- --jasmineOpts.grep=_smoke
> wdio run wdio.local.conf.js --suite=temp --jasmineOpts.grep=_smoke
--spec=_smoke
would find and launch the filenames that contain '_smoke' (e.g. test1_smoke.js
), not the Describe names, but may be useful. Wdio docs here.
Please note that "When the --spec
option is provided, it will override any patterns defined by the config or capability level's specs parameter", so --suite=temp --spec=_smoke
will run all files from the config suite named temp
AND all files with matching filename.
I could not make --grep=_smoke
work, it starts all suites and tests. Seems to have no effect for Wdio runner + Jasmine.
Also failed with multiple tags like
--jasmineOpts.grep='@describe_tag||@test_tag'
,
--jasmineOpts.grep='@describe_tag|@test_tag'
,
--jasmineOpts.grep='@describe_tag&&@test_tag'
.
Maybe someone will have more luck.
Hope this helps someone :)