@bahmutov/cy-grep 3.0.4 → 3.0.5

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
@@ -1,4 +1,4 @@
1
- # @bahmutov/cy-grep ![cypress version](https://img.shields.io/badge/cypress-15.13.0-brightgreen)
1
+ # @bahmutov/cy-grep ![cypress version](https://img.shields.io/badge/cypress-15.18.1-brightgreen)
2
2
 
3
3
  > Filter tests using substring or tag
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmutov/cy-grep",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Filter Cypress tests using title or tags",
5
5
  "main": "src/support.js",
6
6
  "scripts": {
@@ -23,11 +23,11 @@
23
23
  "minimatch": "^10.2.4"
24
24
  },
25
25
  "devDependencies": {
26
- "cypress": "15.13.0",
26
+ "cypress": "15.21.1",
27
27
  "cypress-each": "^1.11.0",
28
28
  "cypress-expect": "^3.1.0",
29
29
  "prettier": "^3.8.1",
30
- "semantic-release": "^25.0.3",
30
+ "semantic-release": "^25.0.9",
31
31
  "stop-only": "^3.4.4",
32
32
  "typescript": "^6.0.0"
33
33
  },
package/src/support.js CHANGED
@@ -314,9 +314,31 @@ function registerCyGrep() {
314
314
  }
315
315
  }
316
316
 
317
+ function findReporterContainer() {
318
+ // different versions of Cypress has different reporter structure
319
+ let reporter = window.top.document.querySelector('.reporter .container')
320
+
321
+ if (!reporter) {
322
+ // trying reporter iframe (Cypress 15.21.0)
323
+ const frame = window.top.document.querySelector('#reporter-frame')
324
+ if (frame) {
325
+ reporter = frame.contentDocument.querySelector('.reporter .statsAndControls')
326
+ }
327
+ }
328
+
329
+ return reporter
330
+ }
331
+
317
332
  function restartTests() {
318
333
  setTimeout(() => {
319
- window.top.document.querySelector('.reporter .restart').click()
334
+ const reporterContainer = findReporterContainer()
335
+ if (!reporterContainer) {
336
+ console.warn('Reporter container not found, cannot restart tests')
337
+ return
338
+ }
339
+
340
+ const restartButton = reporterContainer?.querySelector('.restart')
341
+ restartButton?.click()
320
342
  }, 0)
321
343
  }
322
344
 
@@ -335,8 +357,8 @@ if (!Cypress.grep) {
335
357
  * // and run all tests
336
358
  * Cypress.grep()
337
359
  */
338
- Cypress.grep = function grep(grep, tags, burn) {
339
- setPluginConfigValue('grep', grep)
360
+ Cypress.grep = function grep(grepText, tags, burn) {
361
+ setPluginConfigValue('grep', grepText)
340
362
  setPluginConfigValue('grepTags', tags)
341
363
  setPluginConfigValue('grepBurn', burn)
342
364
  // remove any aliased values
@@ -344,7 +366,7 @@ if (!Cypress.grep) {
344
366
  setPluginConfigValue('grep-burn', null)
345
367
  setPluginConfigValue('burn', null)
346
368
 
347
- debug('set new grep to "%o" restarting tests', { grep, tags, burn })
369
+ debug('set new grep to "%o" restarting tests', { grep: grepText, tags, burn })
348
370
  restartTests()
349
371
  }
350
372
  }