Skip to content

Commit

Permalink
driver: refactor log to use DI, attach as Cypress.log, simplify log i…
Browse files Browse the repository at this point in the history
…nterface, inject snapshot instance
  • Loading branch information
brian-mann committed Jul 11, 2017
1 parent ce84672 commit 2c8b9af
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 359 deletions.
2 changes: 1 addition & 1 deletion packages/driver/src/cy/asserts.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ create = (state) ->
if error
error.onFail = (err) ->

$Log.command obj
Cypress.log(obj)

return null
}
Expand Down
20 changes: 10 additions & 10 deletions packages/driver/src/cypress.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,11 @@ class $Cypress
## at this point
onSpecWindow: (specWindow) ->
## create cy and expose globally
@cy = window.cy = $Cy.create(specWindow, Cypress, @config)

@mocha = $Mocha.create(specWindow, Cypress)
@runner = $Runner.create(@mocha, Cypress)

## TODO: fix this
# @log = $Log.create(@, cy)
@cy = window.cy = $Cy.create(specWindow, @, @config)
@snapshot = $Snapshot.create(@cy)
@mocha = $Mocha.create(specWindow, @)
@runner = $Runner.create(@mocha, @)
@log = $Log.create(@, @cy, @config, @snapshot)

## wire up command create to cy
@Commands = $Commands.create(Cypress, @cy, @config)
Expand Down Expand Up @@ -319,6 +316,12 @@ class $Cypress
when "command:enqueue"
"asdf"

when "log"
"asdf"

when "log:state:changed"
"asdf"

automation: (eventName, args...) ->
## wrap action in promise
new Promise (resolve, reject) =>
Expand Down Expand Up @@ -403,9 +406,6 @@ class $Cypress
@extend = (obj) ->
_.extend @prototype, obj

## TODO: make these return object and do $Cypress.extend() here
require("./cypress/snapshot")($Cypress)

## attach these to the prototype
## instead of $Cypress
$Cypress.$ = $
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/cypress/cy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ privateProps = {

# { visit, get, find } = cy

create = (specWindow, Cypress, config) ->
create = (specWindow, Cypress, config, log) ->
state = $SetterGetter.create({})

xhrs = $Xhrs.create(state)
Expand Down
Loading

0 comments on commit 2c8b9af

Please sign in to comment.