@bahmutov/cy-grep 3.0.3 → 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.12.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.3",
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.12.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
@@ -299,7 +299,6 @@ function registerCyGrep() {
299
299
  options = {}
300
300
  }
301
301
 
302
- debugger
303
302
  return _itOnly(name, options, callback)
304
303
  }
305
304
 
@@ -315,9 +314,31 @@ function registerCyGrep() {
315
314
  }
316
315
  }
317
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
+
318
332
  function restartTests() {
319
333
  setTimeout(() => {
320
- 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()
321
342
  }, 0)
322
343
  }
323
344
 
@@ -336,8 +357,8 @@ if (!Cypress.grep) {
336
357
  * // and run all tests
337
358
  * Cypress.grep()
338
359
  */
339
- Cypress.grep = function grep(grep, tags, burn) {
340
- setPluginConfigValue('grep', grep)
360
+ Cypress.grep = function grep(grepText, tags, burn) {
361
+ setPluginConfigValue('grep', grepText)
341
362
  setPluginConfigValue('grepTags', tags)
342
363
  setPluginConfigValue('grepBurn', burn)
343
364
  // remove any aliased values
@@ -345,7 +366,7 @@ if (!Cypress.grep) {
345
366
  setPluginConfigValue('grep-burn', null)
346
367
  setPluginConfigValue('burn', null)
347
368
 
348
- debug('set new grep to "%o" restarting tests', { grep, tags, burn })
369
+ debug('set new grep to "%o" restarting tests', { grep: grepText, tags, burn })
349
370
  restartTests()
350
371
  }
351
372
  }