11import Admonition from " @theme/Admonition" ;
2+ import Version from " ../_partials/specs/version.mdx" ;
23
34# CLI { #cli }
45
@@ -21,6 +22,7 @@ Main command to run tests.
2122 -s, --set < set> run tests only in the specified set
2223 -r, --require < module> require module
2324 --grep < grep> run only tests matching the pattern
25+ --tag < tag> run only tests with specified tags
2426 --reporter < name> test reporters
2527 --update-refs update screenshot references or gather them if they do not exist (" assertView" command)
2628 --inspect [inspect] nodejs inspector on [= [host:]port]
@@ -136,6 +138,50 @@ testplane --grep "with nested path"
136138testplane --grep " test with nested path"
137139` ` `
138140
141+ # ### Tag {#testplane-tag}
142+
143+ < Version version=" 8.37.0" />
144+
145+ Run only tests, which matches the tag pattern.
146+
147+ # #### Example {#testplane-tag-example}
148+
149+ You can assign tags to a test using the second parameter of ` describe` ot ` it` (see example below).
150+ You can also add tags dynamically during test execution with the [addTag][add-tag] command,
151+ but you can not use dynamic tags to filter tests at launch.
152+
153+ ` ` ` ts
154+ describe(" test" , {tag: " all" }, () => {
155+ describe(" with" , {tag: " desktop" }, () => {
156+ describe(" nested path" , {tag: [" smoke" , " slow" ]}, () => {
157+ await browser.addTag(" some" );
158+ ...
159+ });
160+ describe(" other path" , {tag: " slow" }, () => {
161+ ...
162+ })
163+ });
164+ describe(" with" , {tag: " mobile" }, () => {
165+ describe(" nested path" , {tag: " smoke" }, () => {
166+ ...
167+ });
168+ describe(" other path" , {tag: " slow" }, () => {
169+ ...
170+ })
171+ });
172+ });
173+ ` ` `
174+
175+ You can use tags to run tests and combine them with logical operators & (and), | (or), and ! (not).
176+
177+ ` ` ` bash
178+ testplane --tag " desktop"
179+ testplane --tag " mobile"
180+ testplane --tag " mobile&smoke"
181+ testplane --tag " desktop|slow"
182+ testplane --tag " !slow"
183+ ` ` `
184+
139185# ### Update refs {#testplane-update-refs}
140186
141187Run tests, updating all screenshot references, created by [assertView][assert-view] command.
@@ -700,5 +746,6 @@ TESTPLANE_SETS=desktop,touch testplane
700746
701747[html-reporter]: ../html-reporter/html-reporter-setup
702748[assert-view]: ../commands/browser/assertView
749+ [add-tag]: ../commands/browser/addTag
703750[switch-to-repl]: ../commands/browser/switchToRepl
704751[webdriver-vs-cdp]: ../reference/webdriver-vs-cdp
0 commit comments