mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-20 22:21:23 -06:00
chore: fix flaky tests (net stubbing, websocket, proxy logging, Firefox system tests) (#19159)
This commit is contained in:
@@ -3220,8 +3220,8 @@ describe('network stubbing', function () {
|
||||
$.get('/foo')
|
||||
$.get('/foo')
|
||||
})
|
||||
.wait('@foo.bar', { timeout: 100 })
|
||||
.wait('@foo.bar', { timeout: 100 })
|
||||
.wait('@foo.bar', { timeout: 500 })
|
||||
.wait('@foo.bar', { timeout: 500 })
|
||||
})
|
||||
|
||||
it('can incrementally wait on requests', function () {
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('Proxy Logging', () => {
|
||||
// @see https://github.com/cypress-io/cypress/issues/17656
|
||||
it('xhr log has response body/status code', (done) => {
|
||||
cy.window()
|
||||
.then((win) => {
|
||||
.then({ timeout: 10000 }, (win) => {
|
||||
cy.on('log:changed', (log) => {
|
||||
try {
|
||||
expect(log.snapshots.map((v) => v.name)).to.deep.eq(['request', 'response'])
|
||||
|
||||
@@ -273,14 +273,15 @@ export const STDOUT_DURATION_IN_TABLES_RE = /(\s+?)(\d+ms|\d+:\d+:?\d+)/g
|
||||
const diffRe = /Difference\n-{10}\n([\s\S]*)\n-{19}\nSaved snapshot text/m
|
||||
const expectedAddedVideoSnapshotLines = [
|
||||
'Warning: We failed processing this video.',
|
||||
'This error will not alter the exit code.', '',
|
||||
'This error will not alter the exit code.',
|
||||
'TimeoutError: operation timed out',
|
||||
'[stack trace lines]', '', '',
|
||||
'[stack trace lines]',
|
||||
]
|
||||
const expectedDeletedVideoSnapshotLines = [
|
||||
'(Video)', '',
|
||||
'(Video)',
|
||||
'- Started processing: Compressing to 32 CRF',
|
||||
]
|
||||
const sometimesAddedSpacingLine = ''
|
||||
const sometimesAddedVideoSnapshotLine = '│ Video: false │'
|
||||
const sometimesDeletedVideoSnapshotLine = '│ Video: true │'
|
||||
|
||||
@@ -303,8 +304,8 @@ const isVideoSnapshotError = (err: Error) => {
|
||||
if (line.charAt(0) === '-') deleted.push(line.slice(1).trim())
|
||||
}
|
||||
|
||||
_.pull(added, sometimesAddedVideoSnapshotLine)
|
||||
_.pull(deleted, sometimesDeletedVideoSnapshotLine)
|
||||
_.pull(added, sometimesAddedVideoSnapshotLine, sometimesAddedSpacingLine)
|
||||
_.pull(deleted, sometimesDeletedVideoSnapshotLine, sometimesAddedSpacingLine)
|
||||
|
||||
return _.isEqual(added, expectedAddedVideoSnapshotLines) && _.isEqual(deleted, expectedDeletedVideoSnapshotLines)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('websockets', () => {
|
||||
it('does not crash', () => {
|
||||
cy.visit('http://localhost:3038/foo')
|
||||
cy.log('should not crash on ECONNRESET websocket upgrade')
|
||||
cy.window().then((win) => {
|
||||
cy.window().then({ timeout: 10000 }, (win) => {
|
||||
// see https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
|
||||
return Cypress.Promise.all([
|
||||
shouldCloseUrlWithCode(win, 'ws://localhost:3038/websocket', 1006),
|
||||
|
||||
Reference in New Issue
Block a user