Skip to content

Commit

Permalink
Fixes flaky test in rerun_spec.coffee. (#5546)
Browse files Browse the repository at this point in the history
* decaffeinate: Rename rerun_spec.coffee from .coffee to .js

* decaffeinate: Convert rerun_spec.coffee to JS

* decaffeinate: Run post-processing cleanups on rerun_spec.coffee

* Fixed eslint errors and removed excessive returns.

* Fixed indentation.
  • Loading branch information
sainthkh authored and jennifer-shehane committed Oct 31, 2019
1 parent 232c004 commit 93446a2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
39 changes: 0 additions & 39 deletions packages/driver/test/cypress/integration/e2e/rerun_spec.coffee

This file was deleted.

46 changes: 46 additions & 0 deletions packages/driver/test/cypress/integration/e2e/rerun_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// NOTE: we could clean up this test a lot
// by probably using preserve:run:state event
// or by using localstorage

// store these on our outer top window
// so they are globally preserved
if (window.top.hasRunOnce == null) {
window.top.hasRunOnce = false
}

if (window.top.previousHash == null) {
window.top.previousHash = window.top.location.hash
}

const isTextTerminal = Cypress.config('isTextTerminal')

describe('rerun state bugs', () => {
// NOTE: there's probably other ways to cause a re-run
// event more programatically (like firing it through Cypress)
// but we get the hashchange coverage for free on this.
it('stores viewport globally and does not hang on re-runs', () => {
cy.viewport(500, 500).then(() => {
if (!window.top.hasRunOnce) {
// turn off mocha events for a second
Cypress.config('isTextTerminal', false)

// 1st time around
window.top.hasRunOnce = true

// cause a rerun event to occur
// by changing the hash
let { hash } = window.top.location

window.top.location.hash = `${hash}?rerun`
} else {
if (window.top.location.hash === window.top.previousHash) {
// 3rd time around
// let the mocha end events fire if they're supposed to
Cypress.config('isTextTerminal', isTextTerminal)
}

window.top.location.hash = window.top.previousHash
}
})
})
})

4 comments on commit 93446a2

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 93446a2 Oct 31, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/linux-x64/circle-develop-93446a25f183f37808221eeaa15d31d05f748a17-179359/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.1/circle-develop-93446a25f183f37808221eeaa15d31d05f748a17-179345/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 93446a2 Oct 31, 2019

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/win32-ia32/appveyor-develop-93446a25f183f37808221eeaa15d31d05f748a17-28521112/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.1/win32-ia32/appveyor-develop-93446a25f183f37808221eeaa15d31d05f748a17-28521112/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 93446a2 Oct 31, 2019

Choose a reason for hiding this comment

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

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

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/win32-x64/appveyor-develop-93446a25f183f37808221eeaa15d31d05f748a17-28521112/cypress.zip
npm install https://cdn.cypress.io/beta/binary/3.5.1/win32-x64/appveyor-develop-93446a25f183f37808221eeaa15d31d05f748a17-28521112/cypress.zip

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 93446a2 Oct 31, 2019

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.5.1/darwin-x64/circle-develop-93446a25f183f37808221eeaa15d31d05f748a17-179375/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.5.1/circle-develop-93446a25f183f37808221eeaa15d31d05f748a17-179355/cypress.tgz

Please sign in to comment.