Skip to content

Commit ffe86d2

Browse files
Merge branch 'develop' into issue-4318-empty-array-clear-select
2 parents 84e8ee2 + 496f8f7 commit ffe86d2

File tree

17 files changed

+220
-113
lines changed

17 files changed

+220
-113
lines changed

browser-versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"chrome:beta": "94.0.4606.54",
3-
"chrome:stable": "94.0.4606.54"
2+
"chrome:beta": "95.0.4638.32",
3+
"chrome:stable": "94.0.4606.61"
44
}

cli/types/cypress.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,7 @@ declare namespace Cypress {
29922992
disableTimersAndAnimations: boolean
29932993
padding: Padding
29942994
scale: boolean
2995+
overwrite: boolean
29952996
onBeforeScreenshot: ($el: JQuery) => void
29962997
onAfterScreenshot: ($el: JQuery, props: {
29972998
path: string

packages/driver/cypress/integration/commands/net_stubbing_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ const testFail = (cb, expectedDocsUrl = 'https://on.cypress.io/intercept') => {
1111
})
1212
}
1313

14-
// TODO: Network retries leak between tests, causing flake.
15-
describe('network stubbing', { retries: 2 }, function () {
14+
describe('network stubbing', function () {
1615
const { $, _, sinon, state, Promise } = Cypress
1716

1817
beforeEach(function () {

packages/driver/cypress/integration/commands/screenshot_spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('src/cy/commands/screenshot', () => {
2727
capture: 'viewport',
2828
screenshotOnRunFailure: true,
2929
disableTimersAndAnimations: true,
30+
overwrite: false,
3031
scale: true,
3132
blackout: ['.foo'],
3233
}
@@ -135,6 +136,7 @@ describe('src/cy/commands/screenshot', () => {
135136
isOpen: true,
136137
appOnly: false,
137138
scale: true,
139+
overwrite: false,
138140
waitForCommandSynchronization: true,
139141
disableTimersAndAnimations: true,
140142
blackout: [],
@@ -146,6 +148,7 @@ describe('src/cy/commands/screenshot', () => {
146148
isOpen: false,
147149
appOnly: false,
148150
scale: true,
151+
overwrite: false,
149152
waitForCommandSynchronization: true,
150153
disableTimersAndAnimations: true,
151154
blackout: [],
@@ -276,7 +279,7 @@ describe('src/cy/commands/screenshot', () => {
276279
})
277280
})
278281

279-
it('takes screenshot of hook title with test', () => {})
282+
it('takes screenshot of hook title with test', () => { })
280283
})
281284

282285
context('#screenshot', () => {
@@ -411,6 +414,7 @@ describe('src/cy/commands/screenshot', () => {
411414
isOpen: true,
412415
appOnly: true,
413416
scale: true,
417+
overwrite: false,
414418
waitForCommandSynchronization: false,
415419
disableTimersAndAnimations: true,
416420
blackout: ['.foo'],
@@ -431,6 +435,7 @@ describe('src/cy/commands/screenshot', () => {
431435
isOpen: false,
432436
appOnly: true,
433437
scale: true,
438+
overwrite: false,
434439
waitForCommandSynchronization: false,
435440
disableTimersAndAnimations: true,
436441
blackout: ['.foo'],
@@ -453,6 +458,7 @@ describe('src/cy/commands/screenshot', () => {
453458
isOpen: true,
454459
appOnly: false,
455460
scale: true,
461+
overwrite: false,
456462
waitForCommandSynchronization: true,
457463
disableTimersAndAnimations: true,
458464
blackout: [],
@@ -474,6 +480,7 @@ describe('src/cy/commands/screenshot', () => {
474480
isOpen: true,
475481
appOnly: true,
476482
scale: true,
483+
overwrite: false,
477484
waitForCommandSynchronization: false,
478485
disableTimersAndAnimations: true,
479486
blackout: ['.foo'],

packages/driver/cypress/integration/commands/xhr_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,12 +2407,12 @@ describe('src/cy/commands/xhr', () => {
24072407
it('logs response', () => {
24082408
cy.then(function () {
24092409
cy.wrap(this).its('lastLog').invoke('invoke', 'consoleProps').should((consoleProps) => {
2410-
expect(consoleProps['Response Body']).to.deep.eq({
2410+
expect(consoleProps['Response Body'].trim()).to.deep.eq(JSON.stringify({
24112411
some: 'json',
24122412
foo: {
24132413
bar: 'baz',
24142414
},
2415-
})
2415+
}, null, 2))
24162416
})
24172417
})
24182418
})

packages/driver/cypress/integration/cypress/proxy-logging-spec.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { expect } from 'chai'
2+
13
describe('Proxy Logging', () => {
24
const { _ } = Cypress
35

@@ -43,12 +45,6 @@ describe('Proxy Logging', () => {
4345
}
4446
}
4547

46-
beforeEach(() => {
47-
// block race conditions caused by log update debouncing
48-
// @ts-ignore
49-
Cypress.config('logAttrsDelay', 0)
50-
})
51-
5248
context('request logging', () => {
5349
it('fetch log shows resource type, url, method, and status code and has expected snapshots and consoleProps', (done) => {
5450
fetch('/some-url')
@@ -106,6 +102,43 @@ describe('Proxy Logging', () => {
106102
})
107103
})
108104

105+
// @see https://github.com/cypress-io/cypress/issues/17656
106+
it('xhr log has response body/status code', (done) => {
107+
cy.window()
108+
.then((win) => {
109+
cy.on('log:changed', (log) => {
110+
try {
111+
expect(log.snapshots.map((v) => v.name)).to.deep.eq(['request', 'response'])
112+
expect(log.consoleProps['Response Headers']).to.include({
113+
'x-powered-by': 'Express',
114+
})
115+
116+
expect(log.consoleProps['Response Body']).to.include('Cannot GET /some-url')
117+
expect(log.consoleProps['Response Status Code']).to.eq(404)
118+
119+
expect(log.renderProps).to.include({
120+
indicator: 'bad',
121+
message: 'GET 404 /some-url',
122+
})
123+
124+
expect(Object.keys(log.consoleProps)).to.deep.eq(
125+
['Event', 'Resource Type', 'Method', 'URL', 'Request went to origin?', 'XHR', 'groups', 'Request Headers', 'Response Status Code', 'Response Headers', 'Response Body'],
126+
)
127+
128+
done()
129+
} catch (err) {
130+
// eslint-disable-next-line no-console
131+
console.log('assertion error, retrying', err)
132+
}
133+
})
134+
135+
const xhr = new win.XMLHttpRequest()
136+
137+
xhr.open('GET', '/some-url')
138+
xhr.send()
139+
})
140+
})
141+
109142
it('does not log an unintercepted non-xhr/fetch request', (done) => {
110143
const img = new Image()
111144
const logs: any[] = []

packages/driver/cypress/integration/e2e/uncaught_errors_spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,23 @@ describe('uncaught errors', () => {
175175
}).get('button:first').click()
176176
})
177177

178+
it('does not fail if thrown custom error with readonly name', (done) => {
179+
cy.once('fail', (err) => {
180+
expect(err.name).to.include('CustomError')
181+
expect(err.message).to.include('custom error')
182+
183+
done()
184+
})
185+
186+
cy.then(() => {
187+
throw new class CustomError extends Error {
188+
get name () {
189+
return 'CustomError'
190+
}
191+
}('custom error')
192+
})
193+
})
194+
178195
it('fails test based on an uncaught error after last command and before completing', (done) => {
179196
cy.on('fail', () => {
180197
done()

packages/driver/src/cy/commands/screenshot.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
284284
capture,
285285
padding,
286286
clip,
287+
overwrite,
287288
disableTimersAndAnimations,
288289
onBeforeScreenshot,
289290
onAfterScreenshot,
@@ -313,6 +314,7 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
313314
waitForCommandSynchronization: !isAppOnly(screenshotConfig),
314315
disableTimersAndAnimations,
315316
blackout: getBlackout(screenshotConfig),
317+
overwrite,
316318
}
317319
}
318320

@@ -353,6 +355,7 @@ const takeScreenshot = (Cypress, state, screenshotConfig, options = {}) => {
353355
},
354356
scaled: getShouldScale(screenshotConfig),
355357
blackout: getBlackout(screenshotConfig),
358+
overwrite,
356359
startTime: startTime.toISOString(),
357360
})
358361

@@ -450,7 +453,7 @@ export default function (Commands, Cypress, cy, state, config) {
450453

451454
const isWin = $dom.isWindow(subject)
452455

453-
let screenshotConfig = _.pick(options, 'capture', 'scale', 'disableTimersAndAnimations', 'blackout', 'waitForCommandSynchronization', 'padding', 'clip', 'onBeforeScreenshot', 'onAfterScreenshot')
456+
let screenshotConfig = _.pick(options, 'capture', 'scale', 'disableTimersAndAnimations', 'overwrite', 'blackout', 'waitForCommandSynchronization', 'padding', 'clip', 'onBeforeScreenshot', 'onAfterScreenshot')
454457

455458
screenshotConfig = $Screenshot.validate(screenshotConfig, 'screenshot', options._log)
456459
screenshotConfig = _.extend($Screenshot.getConfig(), screenshotConfig)

packages/driver/src/cypress/command_queue.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,10 @@ export default {
343343

344344
// since this failed this means that a specific command failed
345345
// and we should highlight it in red or insert a new command
346-
if (_.isObject(err)) {
346+
// @ts-ignore
347+
if (_.isObject(err) && !err.name) {
347348
// @ts-ignore
348-
err.name = err.name || 'CypressError'
349+
err.name = 'CypressError'
349350
}
350351

351352
commandRunningFailed(Cypress, state, err)

packages/driver/src/cypress/error_messages.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,11 +1095,7 @@ export default {
10951095
message: stripIndent`\
10961096
${cmd('request')} was invoked with \`{ failOnStatusCode: false, retryOnStatusCodeFailure: true }\`.
10971097
1098-
These options are incompatible with each other.
1099-
1100-
- To retry on non-2xx status codes, pass \`{ failOnStatusCode: true, retryOnStatusCodeFailure: true }\`.
1101-
- To not retry on non-2xx status codes, pass \`{ failOnStatusCode: true, retryOnStatusCodeFailure: true }\`.
1102-
- To fail on non-2xx status codes without retrying (the default behavior), pass \`{ failOnStatusCode: true, retryOnStatusCodeFailure: false }\``,
1098+
\`failOnStatusCode\` must be \`true\` if \`retryOnStatusCodeFailure\` is \`true\`.`,
11031099
docsUrl: 'https://on.cypress.io/request',
11041100
},
11051101
auth_invalid: {

0 commit comments

Comments
 (0)