chore: fix flaky tests (net stubbing, websocket, proxy logging, Firefox system tests) (#19159)

This commit is contained in:
David Munechika
2021-12-03 11:35:04 -05:00
committed by GitHub
parent 4d35779c8a
commit 11e99fc35a
4 changed files with 10 additions and 9 deletions

View File

@@ -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 () {

View File

@@ -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'])

View File

@@ -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)
}

View File

@@ -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),