Skip to content

Commit

Permalink
update tests to expect objects
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Jan 28, 2019
1 parent a6219e4 commit 3710de1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/server/test/integration/cypress_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ TYPICAL_BROWSERS = [
}
]

ELECTRON_BROWSER = {
name: "electron"
displayName: "Electron"
version: "59.1.2.3"
path: ""
majorVersion: "59"
}

previousCwd = process.cwd()

snapshotConsoleLogs = (name) ->
Expand Down Expand Up @@ -256,7 +264,7 @@ describe "lib/cypress", ->
it "runs project headlessly and exits with exit code 0", ->
cypress.start(["--run-project=#{@todosPath}"])
.then =>
expect(browsers.open).to.be.calledWithMatch("electron")
expect(browsers.open).to.be.calledWithMatch(ELECTRON_BROWSER)
@expectExitWith(0)

it "runs project headlessly and exits with exit code 10", ->
Expand Down Expand Up @@ -304,21 +312,21 @@ describe "lib/cypress", ->
"--spec=#{relativePath}/tests/test2.coffee"
])
.then =>
expect(browsers.open).to.be.calledWithMatch("electron", {
expect(browsers.open).to.be.calledWithMatch(ELECTRON_BROWSER, {
url: "http://localhost:8888/__/#/tests/integration/test2.coffee"
})
@expectExitWith(0)

it "runs project by specific spec with default configuration", ->
cypress.start(["--run-project=#{@idsPath}", "--spec=#{@idsPath}/cypress/integration/bar.js", "--config", "port=2020"])
.then =>
expect(browsers.open).to.be.calledWithMatch("electron", {url: "http://localhost:2020/__/#/tests/integration/bar.js"})
expect(browsers.open).to.be.calledWithMatch(ELECTRON_BROWSER, {url: "http://localhost:2020/__/#/tests/integration/bar.js"})
@expectExitWith(0)

it "runs project by specific absolute spec and exits with status 0", ->
cypress.start(["--run-project=#{@todosPath}", "--spec=#{@todosPath}/tests/test2.coffee"])
.then =>
expect(browsers.open).to.be.calledWithMatch("electron", {url: "http://localhost:8888/__/#/tests/integration/test2.coffee"})
expect(browsers.open).to.be.calledWithMatch(ELECTRON_BROWSER, {url: "http://localhost:8888/__/#/tests/integration/test2.coffee"})
@expectExitWith(0)

it "scaffolds out integration and example specs if they do not exist when not runMode", ->
Expand Down Expand Up @@ -421,7 +429,7 @@ describe "lib/cypress", ->
it "runs project headlessly and displays gui", ->
cypress.start(["--run-project=#{@todosPath}", "--headed"])
.then =>
expect(browsers.open).to.be.calledWithMatch("electron", {
expect(browsers.open).to.be.calledWithMatch(ELECTRON_BROWSER, {
proxyServer: "http://localhost:8888"
show: true
})
Expand Down Expand Up @@ -781,7 +789,7 @@ describe "lib/cypress", ->
.then =>
args = browserUtils.launch.firstCall.args

expect(args[0]).to.eq("chrome")
expect(args[0]).to.eq(_.find(TYPICAL_BROWSERS, { name: 'chrome' }))

browserArgs = args[2]

Expand Down Expand Up @@ -1073,8 +1081,8 @@ describe "lib/cypress", ->
})

sinon.stub(browsers, "ensureAndGetByName").returns({
version: "59.1.2.3"
displayName: "Electron"
version: ELECTRON_BROWSER.version
displayName: ELECTRON_BROWSER.displayName
})

err = new Error()
Expand Down

0 comments on commit 3710de1

Please sign in to comment.