-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes flaky test in rerun_spec.coffee. (#5546)
* 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
1 parent
232c004
commit 93446a2
Showing
2 changed files
with
46 additions
and
39 deletions.
There are no files selected for viewing
39 changes: 0 additions & 39 deletions
39
packages/driver/test/cypress/integration/e2e/rerun_spec.coffee
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
packages/driver/test/cypress/integration/e2e/rerun_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
}) | ||
}) | ||
}) |
93446a2
There was a problem hiding this comment.
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.93446a2
There was a problem hiding this comment.
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.93446a2
There was a problem hiding this comment.
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.93446a2
There was a problem hiding this comment.
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.