cypress-plugin-grep-boxes 1.0.4 → 1.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
@@ -18,6 +18,7 @@ A companion Cypress plugin for <code>cy-grep</code> that allows user to run spec
18
18
  - [Setup](#-setup)
19
19
  - [Open mode](#-open-mode)
20
20
  - [Use Required Test Tags Instead Of Skipping Tests](#use-required-test-tags-instead-of-skipping-tests)
21
+ - [disableInitialAutoRun](#disableInitialAutoRun)
21
22
  - [Contributions](#contributions)
22
23
 
23
24
  ---
@@ -90,6 +91,32 @@ To run just those tests with the required tag `@skip` in interactive mode:
90
91
  npx cypress open --env grepTags=@skip
91
92
  ```
92
93
 
94
+ ## disableInitialAutoRun
95
+
96
+ Cypress Test Runner UI automatically runs available tests once a spec file is open.
97
+
98
+ To prevent this behavior to have control of when and which tests to run, add the environment variable `disableInitialAutoRun=true`:
99
+
100
+ ![disableInitialAutoRun Demo](./assets/disableInitialAutoRun_demo.gif)
101
+
102
+ ```bash
103
+ # Example via CLI
104
+ npx cypress open --env disableInitialAutoRun=true
105
+ ```
106
+
107
+ **Tip:** you can set this environment variable in the [config file](https://docs.cypress.io/guides/references/configuration) file to enable it by default and skip using the environment variable:
108
+
109
+ ```js
110
+ // config file
111
+ {
112
+ "e2e": {
113
+ "env": {
114
+ "disableInitialAutoRun": true
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
93
120
  ## Contributions
94
121
 
95
122
  Feel free to open a pull request or drop any feature request or bug in the [issues](https://github.com/dennisbergevin/cypress-plugin-grep-boxes/issues).
package/index.js CHANGED
@@ -291,6 +291,22 @@ if (Cypress.config('isInteractive')) {
291
291
  });
292
292
  }
293
293
 
294
+ if (Cypress.config('isInteractive')) {
295
+ if (
296
+ // if the grep test toggle is not checked, do not run tests
297
+ Cypress.env('disableInitialAutoRun') &&
298
+ window.top?.document.querySelectorAll('#grepTestToggle:checked').length ===
299
+ 0
300
+ ) {
301
+ const sidebarSpecLinkPage = window.top?.document.querySelector(
302
+ '[data-cy="sidebar-link-specs-page"]'
303
+ );
304
+
305
+ sidebarSpecLinkPage.setAttribute('data-url', window.top?.document.URL);
306
+ Cypress.runner.stop();
307
+ }
308
+ }
309
+
294
310
  Cypress.on('test:before:run', () => {
295
311
  if (
296
312
  // if the grep test toggle is checked, do not show checkboxes on each runnable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "1.0.4",
3
+ "version": "1.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": [
@@ -9,8 +9,8 @@
9
9
  "cypress-plugin"
10
10
  ],
11
11
  "devDependencies": {
12
- "@bahmutov/cy-grep": "^1.9.17",
13
- "cypress": "^13.10.0"
12
+ "@bahmutov/cy-grep": "^2.0.22",
13
+ "cypress": "^14.3.0"
14
14
  },
15
15
  "publishConfig": {
16
16
  "registry": "https://registry.npmjs.org/"