cypress-plugin-last-failed 2.0.9 → 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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/toggle.js +28 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-last-failed",
3
- "version": "2.0.9",
3
+ "version": "2.1.0",
4
4
  "description": "Cypress plugin to rerun last failed tests in cypress run and open mode",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "cypress-plugin"
19
19
  ],
20
20
  "devDependencies": {
21
- "@bahmutov/cy-grep": "^2.0.22",
22
- "cypress": "^13.9.0"
21
+ "@bahmutov/cy-grep": "^2.0.37",
22
+ "cypress": "^15.4.0"
23
23
  },
24
24
  "publishConfig": {
25
25
  "registry": "https://registry.npmjs.org/"
package/src/toggle.js CHANGED
@@ -50,23 +50,27 @@ const failedTestToggle = () => {
50
50
  #runFailedControls label {
51
51
  background-color: transparent;
52
52
  padding-top: 5px;
53
+ padding-right: 2px;
53
54
  }
54
55
  #runFailedControls #runFailedTooltip {
55
56
  visibility: hidden;
56
- width: 134px;
57
+ width: 150px;
57
58
  background-color: #f3f4fa;
58
59
  color: #1b1e2e;
59
60
  text-align: center;
60
61
  padding: 5px;
61
62
  border-radius: 3px;
62
63
  position: absolute;
63
- z-index: 1;
64
- top: 27px;
65
- left: 0px;
64
+ z-index: 99999;
65
+ top: 33px;
66
+ right: -2px;
66
67
  height: 28px;
68
+ overflow: visible;
67
69
  }
68
70
  #runFailedControls:hover #runFailedTooltip {
69
71
  visibility: visible;
72
+ z-index: 99999;
73
+ overflow: visible;
70
74
  }
71
75
  #runFailedButton #runFailedLabel {
72
76
  cursor: pointer;
@@ -75,15 +79,20 @@ const failedTestToggle = () => {
75
79
  content: " ";
76
80
  position: absolute;
77
81
  bottom: 100%; /* At the top of the tooltip */
78
- right: 85%;
82
+ left: 89%;
83
+ z-index: 99999;
79
84
  margin-left: -5px;
80
85
  border-width: 5px;
81
86
  border-style: solid;
87
+ overflow: visible;
82
88
  border-color: transparent transparent #f3f4fa transparent;
83
89
  }
84
90
  .reporter:has(#runFailed:checked) .command.command-name-request:has(.command-is-event) {
85
91
  display:none
86
92
  }
93
+ .spec-container {
94
+ overflow: visible !important
95
+ }
87
96
  `;
88
97
  const turnOffRunFailedIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#f59aa9" class="bi bi-filter-circle" viewBox="0 0 16 16">
89
98
  <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
@@ -99,15 +108,27 @@ const failedTestToggle = () => {
99
108
 
100
109
  // append styles
101
110
  if (!hasStyles) {
102
- const reporterEl = top?.document.querySelector('#unified-reporter');
111
+ let reporterEl;
103
112
  const reporterStyleEl = document.createElement('style');
113
+ if (Cypress.version >= '15.0.0') {
114
+ reporterEl = window.top?.document.querySelector('.runnable-header');
115
+ } else {
116
+ reporterEl = window.top?.document.querySelector('#unified-reporter');
117
+ }
104
118
  reporterStyleEl.setAttribute('id', 'runFailedStyle');
105
119
  reporterStyleEl.innerHTML = defaultStyles;
106
120
  reporterEl?.appendChild(reporterStyleEl);
107
121
  }
108
122
 
109
123
  if (!hasToggleButton) {
110
- const header = top?.document.querySelector('#unified-reporter header');
124
+ let header;
125
+ if (Cypress.version >= '15.0.0') {
126
+ // TODO: Cypress v15 GUI provides option for Cypress Studio which pushes the grep toggle button around the UI
127
+ // For simplicity, moving the toggle button to the spec container above the stop button
128
+ header = window.top?.document.querySelector('.runnable-header');
129
+ } else {
130
+ header = window.top?.document.querySelector('#unified-reporter header');
131
+ }
111
132
  const headerToggleDiv = document.createElement('div');
112
133
  const headerToggleSpan = document.createElement('span');
113
134
  const headerToggleTooltip = document.createElement('span');