cypress-plugin-grep-boxes 2.2.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 +32 -2
- package/index.js +35 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,7 +110,9 @@ npx cypress open --env grepTags=@skip
|
|
|
110
110
|
|
|
111
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
112
|
|
|
113
|
-
If for any reason you'd like to exclude
|
|
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
|
|
114
116
|
|
|
115
117
|
Example:
|
|
116
118
|
|
|
@@ -122,7 +124,35 @@ Example:
|
|
|
122
124
|
}
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
The example above would
|
|
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.
|
|
126
156
|
|
|
127
157
|
## disableInitialAutoRun
|
|
128
158
|
|
package/index.js
CHANGED
|
@@ -402,17 +402,45 @@ export const addTags = () => {
|
|
|
402
402
|
|
|
403
403
|
function getTagsForTitle(title, fullTagsObj) {
|
|
404
404
|
const test = fullTagsObj[title];
|
|
405
|
-
if (!test)
|
|
406
|
-
return []; // Title not found
|
|
407
|
-
}
|
|
405
|
+
if (!test) return [];
|
|
408
406
|
|
|
409
407
|
const allTags = [...test.effectiveTestTags, ...test.requiredTestTags];
|
|
410
|
-
const tagsToExclude = Cypress.env('hideSpecTags');
|
|
411
408
|
|
|
412
|
-
|
|
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;
|
|
413
421
|
|
|
414
|
-
|
|
415
|
-
|
|
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
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
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
|
+
});
|
|
416
444
|
}
|
|
417
445
|
|
|
418
446
|
function renderTagPills(tags, container) {
|