We are on latest 8.X WebdriverIO version and latest Jasmine 4.X at this moment, using latest Node 18.X.
In my Wdio.conf.js file I have suite:
all: [ 'path/test1.js', 'path/test2.js'],
test1.js has a Describe with value "SMOKE test 1", while test2.js has "test 2".
I want to run --suite=all but exclude all files that DOESN'T contain "SMOKE" in the title, or run --suite=all but include only tests which contains "SMOKE" in the title. Is this possible, and how? I'm having real troubles finding examples for this case. Can we use grep for this example somehow? I don't have an idea how can we do it.
Basically, the idea is to run only smoke test from some suite. We are not using Mocha and Cucumber runners which have additional tagging, so we are basically running suites all the time. I don't want to create more suites and divide tests in separate suites, we have to many test files.
I tried following the documentation, but I'm having troubles using their example: grep -r -l --include "*.js" "myText" | wdio wdio.conf.js
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 olderjasmineNodeOpts) works fine in wdio 7, but is correctly mentioned from wdio 8 docs.A working package.json script is using the Jasmine's grep:
where:
--suite=tempis defined in the wdio.local.conf.js suites and runs only those spec files,--jasmineOpts.grep=_smokefinds '_smoke' part in the test (it) titles ANDdescribetitles inside the above spec files and runs only them.This would run the full describe
and tests from another describe(s) like:
Non-matching tests (its) are skipped.
_smokecan be any other text tag you add to the titles.Additional info:
--to run an npm script with extra options :) (I used to forget)))package.json script:
command line:
--spec=_smokewould 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
--specoption is provided, it will override any patterns defined by the config or capability level's specs parameter", so--suite=temp --spec=_smokewill run all files from the config suite namedtempAND all files with matching filename.I could not make
--grep=_smokework, 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 :)