cypress-plugin-grep-boxes 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/index.js +37 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ A companion Cypress plugin for <code>cy-grep</code> that allows user to run spec
|
|
|
20
20
|
- [Open mode](#-open-mode)
|
|
21
21
|
- [Using cypress-plugin-filter-runnables](#using-cypress-plugin-filter-runnables)
|
|
22
22
|
- [Use Required Test Tags Instead Of Skipping Tests](#use-required-test-tags-instead-of-skipping-tests)
|
|
23
|
+
- [hideSpecTags](#hideSpecTags)
|
|
23
24
|
- [disableInitialAutoRun](#disableInitialAutoRun)
|
|
24
25
|
- [Contributions](#contributions)
|
|
25
26
|
|
|
@@ -105,6 +106,54 @@ To run just those tests with the required tag `@skip` in interactive mode:
|
|
|
105
106
|
npx cypress open --env grepTags=@skip
|
|
106
107
|
```
|
|
107
108
|
|
|
109
|
+
## hideSpecTags
|
|
110
|
+
|
|
111
|
+
The `cypress-plugin-grep-boxes` plugin (new in v2.0.0) displays all available `effectiveTestTags` in the Cypress Test Runner for each test.
|
|
112
|
+
|
|
113
|
+
If for any reason you'd like to exclude tags from being displayed in the Cypress Test Runner, use the environment variable `hideSpecTags` set to an array of tags you do not want to be displayed in the Cypress Test Runner.
|
|
114
|
+
|
|
115
|
+
### Hide specific tags
|
|
116
|
+
|
|
117
|
+
Example:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"env": {
|
|
122
|
+
"hideSpecTags": ["@smoke", "@sanity"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The example above would hide `@smoke` and `@sanity` tags, but show all other tags, in the Cypress Test Runner.
|
|
128
|
+
|
|
129
|
+
### Hide all tags
|
|
130
|
+
|
|
131
|
+
If you'd like to exclude all tags from being displayed in the Cypress Test Runner, use the following:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"env": {
|
|
136
|
+
"hideSpecTags": ["*"]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The example above would not display ANY tags to Cypress Test Runner.
|
|
142
|
+
|
|
143
|
+
### Hide all tags EXCEPT specified
|
|
144
|
+
|
|
145
|
+
If you'd like to ONLY display a specific subset of tags in the Cypress Test Runner, prefix tags you'd like to see displayed with `+`:
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"env": {
|
|
150
|
+
"hideSpecTags": ["*", "+@smoke", "+@sanity"]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The example above would hide all tags EXCEPT `@smoke` and `@sanity` tags in the Cypress Test Runner.
|
|
156
|
+
|
|
108
157
|
## disableInitialAutoRun
|
|
109
158
|
|
|
110
159
|
Cypress Test Runner UI automatically runs available tests once a spec file is open.
|
package/index.js
CHANGED
|
@@ -402,11 +402,45 @@ export const addTags = () => {
|
|
|
402
402
|
|
|
403
403
|
function getTagsForTitle(title, fullTagsObj) {
|
|
404
404
|
const test = fullTagsObj[title];
|
|
405
|
-
if (!test)
|
|
406
|
-
|
|
405
|
+
if (!test) return [];
|
|
406
|
+
|
|
407
|
+
const allTags = [...test.effectiveTestTags, ...test.requiredTestTags];
|
|
408
|
+
|
|
409
|
+
let raw = Cypress.env('hideSpecTags');
|
|
410
|
+
if (!raw) return allTags;
|
|
411
|
+
|
|
412
|
+
let rules = Array.isArray(raw)
|
|
413
|
+
? raw
|
|
414
|
+
: String(raw)
|
|
415
|
+
.split(',')
|
|
416
|
+
.map((s) => s.trim());
|
|
417
|
+
|
|
418
|
+
const includeSet = new Set();
|
|
419
|
+
const excludeSet = new Set();
|
|
420
|
+
let hideAll = false;
|
|
421
|
+
|
|
422
|
+
for (const r of rules) {
|
|
423
|
+
if (r === '*') {
|
|
424
|
+
hideAll = true;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (r.startsWith('+')) {
|
|
428
|
+
includeSet.add(r.substring(1));
|
|
429
|
+
} else {
|
|
430
|
+
excludeSet.add(r);
|
|
431
|
+
}
|
|
407
432
|
}
|
|
408
433
|
|
|
409
|
-
|
|
434
|
+
// Apply tag display filtering logic
|
|
435
|
+
return allTags.filter((tag) => {
|
|
436
|
+
if (includeSet.has(tag)) return true;
|
|
437
|
+
|
|
438
|
+
if (hideAll) return false;
|
|
439
|
+
|
|
440
|
+
if (excludeSet.has(tag)) return false;
|
|
441
|
+
|
|
442
|
+
return true;
|
|
443
|
+
});
|
|
410
444
|
}
|
|
411
445
|
|
|
412
446
|
function renderTagPills(tags, container) {
|