cypress-plugin-last-failed 4.0.0 → 4.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/package.json +3 -3
- package/src/toggle.js +3 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-plugin-last-failed",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.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
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"cypress-plugin"
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@bahmutov/cy-grep": "^3.0.
|
|
21
|
-
"cypress": "^15.21.
|
|
20
|
+
"@bahmutov/cy-grep": "^3.0.5",
|
|
21
|
+
"cypress": "^15.21.1"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"registry": "https://registry.npmjs.org/"
|
package/src/toggle.js
CHANGED
|
@@ -23,22 +23,9 @@ const grepFailed = () => {
|
|
|
23
23
|
} else {
|
|
24
24
|
console.log('running only the failed tests');
|
|
25
25
|
const grepTitles = failedTestTitles.join('; ');
|
|
26
|
-
const stopBtn = window.top?.document
|
|
27
|
-
.querySelector('iframe')
|
|
28
|
-
?.contentDocument?.querySelector('.statsAndControls .stop');
|
|
29
|
-
// TODO: The cy-grep package has not been updated to handle the new Cypress runner UI iframe
|
|
30
|
-
// Remove this restartBtn handling once that package has been updated
|
|
31
|
-
const restartBtn = window.top?.document
|
|
32
|
-
.querySelector('iframe')
|
|
33
|
-
?.contentDocument?.querySelector('.statsAndControls .restart');
|
|
34
26
|
|
|
35
27
|
// @ts-ignore
|
|
36
28
|
Cypress.grep(grepTitles);
|
|
37
|
-
if (stopBtn) {
|
|
38
|
-
stopBtn.click();
|
|
39
|
-
} else {
|
|
40
|
-
restartBtn.click();
|
|
41
|
-
}
|
|
42
29
|
}
|
|
43
30
|
};
|
|
44
31
|
|
|
@@ -128,15 +115,9 @@ const failedTestToggle = () => {
|
|
|
128
115
|
if (!hasStyles) {
|
|
129
116
|
let reporterEl;
|
|
130
117
|
const reporterStyleEl = document.createElement('style');
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
?.contentDocument?.querySelector('.runnable-header');
|
|
135
|
-
} else {
|
|
136
|
-
reporterEl = window.top?.document
|
|
137
|
-
.querySelector('iframe')
|
|
138
|
-
?.contentDocument?.querySelector('#unified-reporter');
|
|
139
|
-
}
|
|
118
|
+
reporterEl = window.top?.document
|
|
119
|
+
.querySelector('iframe')
|
|
120
|
+
?.contentDocument?.querySelector('.runnable-header');
|
|
140
121
|
reporterStyleEl.setAttribute('id', 'runFailedStyle');
|
|
141
122
|
reporterStyleEl.innerHTML = defaultStyles;
|
|
142
123
|
reporterEl?.appendChild(reporterStyleEl);
|
|
@@ -190,17 +171,9 @@ const failedTestToggle = () => {
|
|
|
190
171
|
const stopBtn = window.top.document
|
|
191
172
|
.querySelector('iframe')
|
|
192
173
|
?.contentDocument?.querySelector('.reporter .stop');
|
|
193
|
-
// TODO: The cy-grep package has not been updated to handle the new Cypress runner UI iframe
|
|
194
|
-
// Remove this restartBtn handling once that package has been updated
|
|
195
|
-
const restartBtn = window.top?.document
|
|
196
|
-
.querySelector('iframe')
|
|
197
|
-
?.contentDocument?.querySelector('.statsAndControls .restart');
|
|
198
|
-
|
|
199
174
|
if (e.target.checked) {
|
|
200
175
|
if (stopBtn) {
|
|
201
176
|
stopBtn.click();
|
|
202
|
-
} else {
|
|
203
|
-
restartBtn.click();
|
|
204
177
|
}
|
|
205
178
|
// when checked, grep only failed tests in spec
|
|
206
179
|
grepFailed();
|
|
@@ -213,11 +186,6 @@ const failedTestToggle = () => {
|
|
|
213
186
|
}
|
|
214
187
|
// when unchecked, ungrep and show all tests in spec
|
|
215
188
|
Cypress.grep();
|
|
216
|
-
// TODO: The cy-grep package has not been updated to handle the new Cypress runner UI iframe
|
|
217
|
-
// Remove this restartBtn handling once that package has been updated
|
|
218
|
-
if (restartBtn) {
|
|
219
|
-
restartBtn.click();
|
|
220
|
-
}
|
|
221
189
|
runFailedLabelElement.innerHTML = turnOffRunFailedIcon;
|
|
222
190
|
runFailedTooltipElement.innerHTML = turnOffRunFailedDescription;
|
|
223
191
|
}
|