cypress-plugin-grep-boxes 2.0.0 → 2.1.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 CHANGED
@@ -6,7 +6,7 @@
6
6
  A companion Cypress plugin for <code>cy-grep</code> that allows user to run specific test(s) in <code>open</code> mode.
7
7
  </p>
8
8
 
9
- ![Cypress-plugin-grep-boxes](./assets/cy-grep-boxes-demo.gif)
9
+ ![cy-grep-boxes-demo](https://github.com/user-attachments/assets/5845963d-32a0-49a6-99be-3b81ca7d6f29)
10
10
 
11
11
  ## Features
12
12
 
@@ -18,6 +18,7 @@ A companion Cypress plugin for <code>cy-grep</code> that allows user to run spec
18
18
  - [Installation](#-installation)
19
19
  - [Setup](#-setup)
20
20
  - [Open mode](#-open-mode)
21
+ - [Using cypress-plugin-filter-runnables](#using-cypress-plugin-filter-runnables)
21
22
  - [Use Required Test Tags Instead Of Skipping Tests](#use-required-test-tags-instead-of-skipping-tests)
22
23
  - [disableInitialAutoRun](#disableInitialAutoRun)
23
24
  - [Contributions](#contributions)
@@ -73,7 +74,13 @@ Within each spec in Cypress `open` mode:
73
74
  - You can select any given number of individual test(s) and click the filter toggle located on the reporter above
74
75
  - You can click on any available tag and run only tests in the spec with the respective tag
75
76
 
76
- ![Cypress grep-boxes within UI mode](./assets/grep-boxes-ui.png)
77
+ <img width="295" height="182" alt="grep-boxes-ui" src="https://github.com/user-attachments/assets/fad9ebc9-e417-41aa-9f31-519855113d17" />
78
+
79
+ ### Using cypress-plugin-filter-runnables
80
+
81
+ **NEW** in v2.1.0: If filtering tests using [cypress-plugin-filter-runnables](https://github.com/dennisbergevin/cypress-plugin-filter-runnables), simply click the filter toggle located on the reporter above to only run those tests.
82
+
83
+ No need to check each checkbox of each test you see after filtering by test title!
77
84
 
78
85
  ### Use Required Test Tags Instead Of Skipping Tests
79
86
 
@@ -104,7 +111,7 @@ Cypress Test Runner UI automatically runs available tests once a spec file is op
104
111
 
105
112
  To prevent this behavior to have control of when and which tests to run, add the environment variable `disableInitialAutoRun=true`:
106
113
 
107
- ![disableInitialAutoRun Demo](./assets/disableInitialAutoRun_demo.gif)
114
+ ![disableInitialAutoRun_demo](https://github.com/user-attachments/assets/95fc4807-847b-432e-9b03-dc4fbe9f955a)
108
115
 
109
116
  ```bash
110
117
  # Example via CLI
package/index.js CHANGED
@@ -177,12 +177,37 @@ grepTestToggleElement?.addEventListener('change', (e) => {
177
177
  });
178
178
  });
179
179
 
180
+ // run all tests displayed in the spec if none are checked
181
+ // this enables cohesion with this plugin and cypress-plugin-filter-runnables
182
+ // the display: none is used to hide runnables not matching a filter
183
+ if (tests.length === 0) {
184
+ const checkboxes = [
185
+ ...window.top?.document.querySelectorAll('.grep-test-checkbox'),
186
+ ].filter((box) => {
187
+ const runnable = box.closest('.runnable');
188
+ return runnable && window.getComputedStyle(runnable).display !== 'none';
189
+ });
190
+
191
+ checkboxes.forEach((box) => tests.push(box.value));
192
+ }
193
+
180
194
  Cypress.grep(tests.join(';'));
181
195
 
182
196
  // when checked, grep only selected tests in spec
183
197
  grepTestToggleLabelElement.innerHTML = turnOngrepTestToggleIcon;
184
198
  grepTestToggleTooltipElement.innerHTML = turnOngrepTestToggleDescription;
185
199
  } else {
200
+ // for cypress-plugin-filter-runnables to clear search when grepTestToggle is unchecked
201
+ const searchInput = window.top?.document.querySelector(
202
+ '#test-suite-filter-search'
203
+ );
204
+ const clearBtn = window.top?.document.querySelector(
205
+ '#clear-test-suite-filter-search'
206
+ );
207
+ if (searchInput != '') {
208
+ clearBtn?.click();
209
+ }
210
+
186
211
  if (stopBtn) {
187
212
  stopBtn.click();
188
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Cypress plugin that allows user to run specific tests in open mode.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
Binary file
Binary file