driver: make test deps non-global

This commit is contained in:
Chris Breiding
2017-05-25 10:47:57 -04:00
parent e7b0e59236
commit 3bf8ade2b7
47 changed files with 106 additions and 13 deletions
+12 -11
View File
@@ -3,19 +3,20 @@ lolex = require("lolex")
sinon = require("sinon")
sinonChai = require("sinon-chai")
window.$Cypress = $Cypress = require("../../src/main")
$Cypress = require("../../src/main")
$ = $Cypress.$
_ = $Cypress.prototype._
$ = window.$ = $Cypress.$
_ = window._ = $Cypress.prototype._
window.moment = $Cypress.prototype.moment
window.Promise = $Cypress.prototype.Promise
window.Cookies = require("js-cookie")
window.testUtils = {
$Cypress: $Cypress
$: $
_: _
moment: $Cypress.prototype.moment
Promise: $Cypress.prototype.Promise
Cookies: require("js-cookie")
bililiteRange: require("../../vendor/bililiteRange")
}
## TODO: move this as something we can grab
## off of the driver
require("sinon-as-promised")(Promise)
window.bililiteRange = require("../../vendor/bililiteRange")
$Cypress.Chai.use(sinonChai)
uncaught = Mocha.Runner::uncaught
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Checkbox Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _, Promise } = window.testUtils
describe "$Cypress.Cy Clicking Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Focus Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Form Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Miscellaneous Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Scrolling Commands", ->
enterCommandTestingMode("scrolling", {
container: { height: 200 }
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Select Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _, Promise, bililiteRange } = window.testUtils
describe "$Cypress.Cy Text Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Cy Agents Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Aliasing Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Angular Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Assertion Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Cy Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _, Promise } = window.testUtils
describe "$Cypress.Cy Connectors Commands", ->
enterCommandTestingMode()
@@ -260,7 +262,7 @@ describe "$Cypress.Cy Connectors Commands", ->
return $input
.then ($input) ->
expectOriginal(@cy.state("subject")).not.to.be.instanceof @remoteWindow.$
expectOriginal(@cy.state("subject")).to.be.instanceof window.$
expectOriginal(@cy.state("subject")).to.be.instanceof $
it "does not nuke selector properties", ->
@cy
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
describe "$Cypress.Cy Cookie Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
describe "$Cypress.Cy Exec Command", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Cy Files Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Cy Fixtures Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Cy Location Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Misc Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _, Promise, Cookies } = window.testUtils
describe "$Cypress.Cy Navigation Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Querying Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
describe "$Cypress.Cy Request Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
describe "$Cypress.Cy Screenshot Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Traversal Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
describe "$Cypress.Cy Waiting Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Window Commands", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _, Promise } = window.testUtils
# describe "$Cypress.Cy XHR Commands", ->
# enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $ } = window.testUtils
describe "$Cypress.Cy Coordinates Extensions", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Ensure Extensions", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Errors Extensions", ->
before ->
@iframe = $("<iframe />").appendTo $("body")
@@ -1,3 +1,5 @@
{ $ } = window.testUtils
describe "$Cypress.Cy Listeners Extensions", ->
context "iframe load", ->
before ->
@@ -1,3 +1,5 @@
{ $ } = window.testUtils
describe "$Cypress.Cy Snapshot Extension", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress Url:Changed Events", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Chai API", ->
beforeEach ->
@Cypress = $Cypress.create()
@@ -38,4 +40,4 @@ describe "$Cypress.Chai API", ->
it "null outs Cypress.chai", ->
expect(@Cypress.chai).to.be.ok
@Cypress.trigger("stop")
expect(@Cypress.chai).to.be.null
expect(@Cypress.chai).to.be.null
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
## FIXME: Needs re-write to test new interface
describe.skip "$Cypress.Commands API", ->
beforeEach ->
@@ -1,3 +1,5 @@
{ _, Cookies } = window.testUtils
describe "$Cypress.Cookies API", ->
beforeEach ->
@Cypress = $Cypress.create()
@@ -1,3 +1,5 @@
{ $, _, Promise, moment } = window.testUtils
describe "$Cypress.Cy API", ->
context "unit", ->
before ->
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress API", ->
beforeEach ->
@Cypress = $Cypress.create()
@@ -1,3 +1,5 @@
{ $ } = window.testUtils
describe "$Cypress.jQuery Extensions", ->
enterCommandTestingMode()
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.LocalStorage API", ->
before ->
@clear = (remote) =>
@@ -1,3 +1,5 @@
{ $, _, Promise } = window.testUtils
describe "$Cypress.Log API", ->
describe "instances", ->
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
m = window.mocha
describe "$Cypress.Mocha API", ->
@@ -1,3 +1,5 @@
{ _ } = window.testUtils
describe "$Cypress.Runner API", ->
beforeEach ->
@Cypress = $Cypress.create()
@@ -1,3 +1,5 @@
{ $, _ } = window.testUtils
describe "$Cypress.Cy Server API", ->
beforeEach ->
@iframe = $("<iframe />").appendTo $("body")
@@ -1,3 +1,5 @@
{ $ } = window.testUtils
describe "$Cypress.utils API", ->
enterCommandTestingMode()