Skip to content

Commit

Permalink
fix tests after decaffeination
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Jun 5, 2020
1 parent 7805fb8 commit a502af0
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 319 deletions.
28 changes: 14 additions & 14 deletions packages/extension/test/unit/extension_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ describe('Extension', () => {
const result = eol.auto(str)
const expected = eol.auto(`\
(function() {
var HOST, PATH, automation, client, fail, invoke,
slice = [].slice;
var HOST, PATH, automation, client, fail, invoke,
slice = [].slice;
HOST = "http://dev.local:8080";
HOST = "http://dev.local:8080";
PATH = "/__foo";
PATH = "/__foo";
client = io.connect(HOST, {
path: PATH
});
client = io.connect(HOST, {
path: PATH
});
automation = {
getAllCookies: function(filter, fn) {
if (filter == null) {
filter = {};
automation = {
getAllCookies: function(filter, fn) {
if (filter == null) {
filter = {};
}
return chrome.cookies.getAll(filter, fn);
}
return chrome.cookies.getAll(filter, fn);
}
};
};
}).call(this);
\
Expand Down
19 changes: 19 additions & 0 deletions packages/server/__snapshots__/chrome_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exports['lib/browsers/chrome #open uses a custom profilePath if supplied 1'] = `
Can't run because you've entered an invalid browser name.
Browser: 'browserNotGonnaBeFound' was not found on your system or is not supported by Cypress.
Cypress supports the following browsers:
- chrome
- chromium
- edge
- electron
- firefox (Cypress support in beta)
You can also use a custom browser: https://on.cypress.io/customize-browsers
Available browsers found on your system are:
- chrome
- firefox
- electron
`
19 changes: 19 additions & 0 deletions packages/server/__snapshots__/cri-client_spec.ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exports['lib/browsers/cri-client .create #send calls cri.send with command and data 1'] = `
Can't run because you've entered an invalid browser name.
Browser: 'browserNotGonnaBeFound' was not found on your system or is not supported by Cypress.
Cypress supports the following browsers:
- chrome
- chromium
- edge
- electron
- firefox (Cypress support in beta)
You can also use a custom browser: https://on.cypress.io/customize-browsers
Available browsers found on your system are:
- chrome
- firefox
- electron
`
2 changes: 1 addition & 1 deletion packages/server/test/e2e/1_deprecated_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

const beforeBrowserLaunchProject = Fixtures.projectPath('plugin-before-browser-launch-deprecation')

Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/1_firefox_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs-extra'

import e2e from '../support/helpers/e2e'
import Bluebird from 'bluebird'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

const e2ePath = Fixtures.projectPath('e2e')
const outputPath = path.join(e2ePath, 'output.json')
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/1_typescript_support_spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import snapshot from 'snap-shot-it'

import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e typescript', function () {
e2e.setup()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/3_runnable_execution_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e runnable execution', () => {
e2e.setup({
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/3_testConfigOverrides_spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs-extra'
import path from 'path'
import e2e, { expect } from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

const e2ePath = Fixtures.projectPath('e2e')

Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/4_before_browser_launch_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'
import browserUtils from '../../lib/browsers/utils'

const browser = {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/5_cdp_spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mockedEnv from 'mocked-env'
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e cdp', function () {
e2e.setup()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/5_headless_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e headless', function () {
e2e.setup()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/6_non_proxied_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e non-proxied spec', () => {
e2e.setup()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/8_error_ui_spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bodyParser from 'body-parser'
import e2e, { expect } from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

const WEBPACK_PREPROCESSOR_PROJECTS = [
'webpack-preprocessor',
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/e2e/non_root_read_only_fs_spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs'
import * as path from 'path'
import e2e from '../support/helpers/e2e'
import Fixtures from '../support/helpers/fixtures.coffee'
import Fixtures from '../support/helpers/fixtures'

describe('e2e readonly fs', function () {
e2e.setup()
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/support/helpers/e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import helper from '../../spec_helper.coffee'
import helper from '../../spec_helper'
const { expect, root } = helper as {expect: Chai.ExpectStatic, root: string}

require('mocha-banner').register()
Expand Down
70 changes: 35 additions & 35 deletions packages/server/test/unit/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ describe('lib/api', () => {
401
{
"errors": {
"permission": [
"denied"
]
}
"errors": {
"permission": [
"denied"
]
}
}\
`)
})
Expand Down Expand Up @@ -382,11 +382,11 @@ describe('lib/api', () => {
422
{
"errors": {
"runId": [
"is required"
]
}
"errors": {
"runId": [
"is required"
]
}
}\
`)
})
Expand Down Expand Up @@ -493,11 +493,11 @@ describe('lib/api', () => {
422
{
"errors": {
"tests": [
"is required"
]
}
"errors": {
"tests": [
"is required"
]
}
}\
`)
})
Expand Down Expand Up @@ -597,11 +597,11 @@ describe('lib/api', () => {
422
{
"errors": {
"tests": [
"is required"
]
}
"errors": {
"tests": [
"is required"
]
}
}\
`)
})
Expand Down Expand Up @@ -688,11 +688,11 @@ describe('lib/api', () => {
422
{
"errors": {
"tests": [
"is required"
]
}
"errors": {
"tests": [
"is required"
]
}
}\
`)
})
Expand Down Expand Up @@ -894,11 +894,11 @@ describe('lib/api', () => {
422
{
"errors": {
"orgId": [
"is required"
]
}
"errors": {
"orgId": [
"is required"
]
}
}\
`)
})
Expand Down Expand Up @@ -985,11 +985,11 @@ describe('lib/api', () => {
422
{
"errors": {
"access": [
"already requested"
]
}
"errors": {
"access": [
"already requested"
]
}
}\
`)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/server/test/unit/browsers/browsers_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('lib/browsers/index', () => {
})

it('throws when no browser can be found', () => {
expect(browsers.ensureAndGetByNameOrPath('browserNotGonnaBeFound'))
return expect(browsers.ensureAndGetByNameOrPath('browserNotGonnaBeFound'))
.to.be.rejectedWith({ type: 'BROWSER_NOT_FOUND_BY_NAME' })
.then((err) => {
return snapshot(normalizeBrowsers(err.message))
Expand All @@ -64,7 +64,7 @@ describe('lib/browsers/index', () => {
{ name: 'firefox', channel: 'stable' },
])

expect(browsers.ensureAndGetByNameOrPath('canary'))
return expect(browsers.ensureAndGetByNameOrPath('canary'))
.to.be.rejectedWith({ type: 'BROWSER_NOT_FOUND_BY_NAME' })
.then((err) => {
return snapshot(err.message)
Expand Down
8 changes: 4 additions & 4 deletions packages/server/test/unit/browsers/chrome_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe('lib/browsers/chrome', () => {
it('rejects if CDP version check fails', function () {
this.criClient.ensureMinimumProtocolVersion.rejects()

expect(chrome.open('chrome', 'http://', {}, this.automation)).to.be.rejectedWith('Cypress requires at least Chrome 64.')
return expect(chrome.open('chrome', 'http://', {}, this.automation)).to.be.rejectedWith('Cypress requires at least Chrome 64.')
})
})

Expand Down Expand Up @@ -314,7 +314,7 @@ describe('lib/browsers/chrome', () => {
}, {})

if (bool) {
expect(args).to.include(arg)
return expect(args).to.include(arg)
}

expect(args).not.to.include(arg)
Expand All @@ -324,7 +324,7 @@ describe('lib/browsers/chrome', () => {
disabledRootLayerScrolling('66', true)
disabledRootLayerScrolling('67', true)

return disabledRootLayerScrolling('68', false)
disabledRootLayerScrolling('68', false)
})

// https://github.com/cypress-io/cypress/issues/1872
Expand All @@ -337,7 +337,7 @@ describe('lib/browsers/chrome', () => {
}, {})

if (bool) {
expect(args).to.include(arg)
return expect(args).to.include(arg)
}

expect(args).not.to.include(arg)
Expand Down
4 changes: 2 additions & 2 deletions packages/server/test/unit/chrome_policy_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Cypress detected policy settings on your computer that may cause issues.
The following policies were detected that may prevent Cypress from automating Chrome:
> HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome\\ProxyServer
> HKEY_CURRENT_USER\\Software\\Policies\\Google\\Chromium\\ExtensionSettings
> HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome\\ProxyServer
> HKEY_CURRENT_USER\\Software\\Policies\\Google\\Chromium\\ExtensionSettings
For more information, see https://on.cypress.io/bad-browser-policy\
`))
Expand Down
4 changes: 2 additions & 2 deletions packages/server/test/unit/config_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1654,14 +1654,14 @@ describe('lib/config', () => {

const obj = config.setAbsolutePaths({
projectRoot,
supportFile: 'test/unit/config_spec.coffee',
supportFile: 'test/unit/config_spec.js',
})

return config.setSupportFileAndFolder(obj)
.then((result) => {
expect(result).to.eql({
projectRoot,
supportFile: `${projectRoot}/test/unit/config_spec.coffee`,
supportFile: `${projectRoot}/test/unit/config_spec.js`,
supportFolder: `${projectRoot}/test/unit`,
})
})
Expand Down
Loading

0 comments on commit a502af0

Please sign in to comment.