Skip to content

Commit

Permalink
chore: fix flaky tests (net stubbing, websocket, proxy logging, Firef…
Browse files Browse the repository at this point in the history
…ox system tests) (#19159)
  • Loading branch information
davidmunechika authored Dec 3, 2021
1 parent 4d35779 commit 11e99fc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
11 changes: 6 additions & 5 deletions system-tests/lib/system-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 │'

Expand All @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

3 comments on commit 11e99fc

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 11e99fc Dec 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.1/circle-develop-11e99fc35a4cf1fe43abed07cd3f7fb2441fa461/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 11e99fc Dec 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.1/circle-develop-11e99fc35a4cf1fe43abed07cd3f7fb2441fa461/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 11e99fc Dec 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.1/circle-develop-11e99fc35a4cf1fe43abed07cd3f7fb2441fa461/cypress.tgz

Please sign in to comment.