({
},
},
state: new State(),
- windowUtil: {
- specFile: sinon.stub().returns('some-spec.js'),
+ util: {
+ absoluteSpecPath: sinon.stub().returns('/path/to/int/some-spec.js'),
},
})
@@ -52,7 +52,7 @@ describe('
', () => {
const props = createProps()
props.config.integrationFolder = 'path/to/int'
const component = shallow(
)
- expect(component.find(Reporter)).to.have.prop('specPath', 'path/to/int/some-spec.js')
+ expect(component.find(Reporter)).to.have.prop('specPath', '/path/to/int/some-spec.js')
})
it('renders the
with the autoScrollingEnabled flag', () => {
diff --git a/packages/runner/src/app/container.jsx b/packages/runner/src/app/container.jsx
index 101b9b1f724f..a63e63b80448 100644
--- a/packages/runner/src/app/container.jsx
+++ b/packages/runner/src/app/container.jsx
@@ -5,7 +5,7 @@ import React, { Component } from 'react'
import automation from '../lib/automation'
import eventManager from '../lib/event-manager'
import State from '../lib/state'
-import windowUtil from '../lib/window-util'
+import util from '../lib/util'
import App from './app'
import AutomationDisconnected from '../errors/automation-disconnected'
@@ -35,7 +35,7 @@ class Container extends Component {
return this._automationDisconnected()
case automation.CONNECTED:
default:
- return this.props.windowUtil.hasSpecFile() ? this._app() : this._noSpec()
+ return this.props.util.hasSpecFile() ? this._app() : this._noSpec()
}
}
@@ -64,7 +64,7 @@ class Container extends Component {
}
_checkSpecFile = () => {
- if (this.props.windowUtil.hasSpecFile()) {
+ if (this.props.util.hasSpecFile()) {
this.forceUpdate()
}
}
@@ -85,7 +85,7 @@ class Container extends Component {
Container.defaultProps = {
eventManager,
- windowUtil,
+ util,
}
Container.propTypes = {
diff --git a/packages/runner/src/app/container.spec.jsx b/packages/runner/src/app/container.spec.jsx
index 31096345696c..31ad3be2cbae 100644
--- a/packages/runner/src/app/container.spec.jsx
+++ b/packages/runner/src/app/container.spec.jsx
@@ -30,7 +30,7 @@ const createProps = () => ({
},
},
state: new State(),
- windowUtil: {
+ util: {
hasSpecFile: sinon.stub(),
},
})
@@ -115,7 +115,7 @@ describe('
', () => {
beforeEach(() => {
props = createProps()
props.state.automation = automation.CONNECTED
- props.windowUtil.hasSpecFile.returns(false)
+ props.util.hasSpecFile.returns(false)
component = shallow(
)
})
@@ -128,7 +128,7 @@ describe('
', () => {
})
it('renders the app when hash changes with and has a spec file', () => {
- props.windowUtil.hasSpecFile.returns(true)
+ props.util.hasSpecFile.returns(true)
component.find(NoSpec).prop('onHashChange')()
component.update()
expect(component.find(App)).to.exist
@@ -142,7 +142,7 @@ describe('
', () => {
beforeEach(() => {
props = createProps()
props.state.automation = automation.CONNECTED
- props.windowUtil.hasSpecFile.returns(true)
+ props.util.hasSpecFile.returns(true)
component = shallow(
)
})
diff --git a/packages/runner/src/iframe/iframes.jsx b/packages/runner/src/iframe/iframes.jsx
index 606c1b46962f..ba29785a0db2 100644
--- a/packages/runner/src/iframe/iframes.jsx
+++ b/packages/runner/src/iframe/iframes.jsx
@@ -13,7 +13,7 @@ import eventManager from '../lib/event-manager'
import IframeModel from './iframe-model'
import logger from '../lib/logger'
import selectorPlaygroundModel from '../selector-playground/selector-playground-model'
-import windowUtil from '../lib/window-util'
+import util from '../lib/util'
@observer
export default class Iframes extends Component {
@@ -44,8 +44,6 @@ export default class Iframes extends Component {
}
componentDidMount () {
- const specPath = windowUtil.specPath()
-
this.autIframe = new AutIframe(this.props.config)
this.props.eventManager.on('visit:failed', this.autIframe.showVisitFailure)
@@ -56,7 +54,7 @@ export default class Iframes extends Component {
// TODO: need to take headless mode into account
// may need to not display reporter if more than 200 tests
this.props.eventManager.on('restart', () => {
- this._run(this.props.config, specPath)
+ this._run(this.props.config)
})
this.props.eventManager.on('print:selector:elements:to:console', this._printSelectorElementsToConsole)
@@ -69,7 +67,7 @@ export default class Iframes extends Component {
this.autIframe.toggleSelectorHighlight(selectorPlaygroundModel.isShowingHighlight)
}))
- this.props.eventManager.start(this.props.config, specPath)
+ this.props.eventManager.start(this.props.config)
this.iframeModel = new IframeModel({
state: this.props.state,
@@ -93,14 +91,16 @@ export default class Iframes extends Component {
),
})
this.iframeModel.listen()
- this._run(this.props.config, specPath)
+ this._run(this.props.config)
}
@action _setScriptError = (err) => {
this.props.state.scriptError = err
}
- _run = (config, specPath) => {
+ _run = (config) => {
+ const specPath = util.specPath()
+
this.props.eventManager.notifyRunningSpec(specPath)
logger.clearLog()
this._setScriptError(null)
diff --git a/packages/runner/src/lib/window-util.js b/packages/runner/src/lib/util.js
similarity index 61%
rename from packages/runner/src/lib/window-util.js
rename to packages/runner/src/lib/util.js
index 5f31f8e8b796..582c3dbb4f57 100644
--- a/packages/runner/src/lib/window-util.js
+++ b/packages/runner/src/lib/util.js
@@ -1,3 +1,5 @@
+import path from 'path'
+
export default {
hasSpecFile () {
return !!location.hash
@@ -15,4 +17,9 @@ export default {
return ''
}
},
+
+ absoluteSpecPath (config) {
+ const relativeSpecPath = path.relative('integration', this.specPath())
+ return path.join(config.integrationFolder, relativeSpecPath)
+ },
}
diff --git a/packages/server/__snapshots__/async_timeouts_spec.coffee b/packages/server/__snapshots__/async_timeouts_spec.coffee
index 3b2c73637707..2dd5c580d4e0 100644
--- a/packages/server/__snapshots__/async_timeouts_spec.coffee
+++ b/packages/server/__snapshots__/async_timeouts_spec.coffee
@@ -47,7 +47,7 @@ exports['e2e async timeouts failing1 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/async -- bar fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/async_timeouts_spec.coffee/async -- bar fails (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/caught_uncaught_hook_errors_spec.coffee b/packages/server/__snapshots__/caught_uncaught_hook_errors_spec.coffee
index 1dee59caa18a..2a3868913431 100644
--- a/packages/server/__snapshots__/caught_uncaught_hook_errors_spec.coffee
+++ b/packages/server/__snapshots__/caught_uncaught_hook_errors_spec.coffee
@@ -89,9 +89,9 @@ Because this error occurred during a 'before all' hook we are skipping the remai
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1a -- t2a -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s3a -- t8a -- before all hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s4a -- t10a -- before all hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_caught_error_failing_spec.coffee/s1a -- t2a -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_caught_error_failing_spec.coffee/s3a -- t8a -- before all hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_caught_error_failing_spec.coffee/s4a -- t10a -- before all hook (failed).png (1280x720)
(Video)
@@ -178,7 +178,7 @@ Because this error occurred during a 'before each' hook we are skipping the rema
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1b -- t2b -- before each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_uncaught_error_failing_spec.coffee/s1b -- t2b -- before each hook (failed).png (1280x720)
(Video)
@@ -257,7 +257,7 @@ Because this error occurred during a 'before each' hook we are skipping all of t
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/t1c -- before each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_uncaught_root_error_failing_spec.coffee/t1c -- before each hook (failed).png (1280x720)
(Video)
@@ -342,7 +342,7 @@ Because this error occurred during a 'before each' hook we are skipping the rema
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/uncaught hook error should continue to fire all mocha events -- s1 -- does not run -- before each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/hook_uncaught_error_events_failing_spec.coffee/uncaught hook error should continue to fire all mocha events -- s1 -- does not run -- before each hook (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/commands_outside_of_test_spec.coffee b/packages/server/__snapshots__/commands_outside_of_test_spec.coffee
index eb08265ea26c..3cc6444dc9bb 100644
--- a/packages/server/__snapshots__/commands_outside_of_test_spec.coffee
+++ b/packages/server/__snapshots__/commands_outside_of_test_spec.coffee
@@ -67,7 +67,7 @@ We dynamically generated a new test to display this failure.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/An uncaught error was detected outside of a test.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/commands_outside_of_test_spec.coffee/An uncaught error was detected outside of a test (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/config_spec.coffee b/packages/server/__snapshots__/config_spec.coffee
index e9de6addb319..3e9a77db984d 100644
--- a/packages/server/__snapshots__/config_spec.coffee
+++ b/packages/server/__snapshots__/config_spec.coffee
@@ -16,20 +16,22 @@ exports['e2e config passes 1'] = `
Running: config_passing_spec.coffee... (1 of 1)
- Cypress.config()
- ✓ has Cypress.version set to a string
- ✓ has os platform
- ✓ has os architecture
+ Cypress static methods + props
+ ✓ .version
+ ✓ .platform
+ ✓ .arch
+ ✓ .browser
+ ✓ .spec
- 3 passing
+ 5 passing
(Results)
┌──────────────────────────────────────────┐
- │ Tests: 3 │
- │ Passing: 3 │
+ │ Tests: 5 │
+ │ Passing: 5 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
@@ -53,9 +55,9 @@ exports['e2e config passes 1'] = `
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
- │ ✔ config_passing_spec.coffee XX:XX 3 3 - - - │
+ │ ✔ config_passing_spec.coffee XX:XX 5 5 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
- All specs passed! XX:XX 3 3 - - -
+ All specs passed! XX:XX 5 5 - - -
`
@@ -121,7 +123,7 @@ exports['e2e config fails 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/config -- times out looking for a missing element.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/config_failing_spec.coffee/config -- times out looking for a missing element (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/domain_spec.coffee b/packages/server/__snapshots__/domain_spec.coffee
index 3025219446e3..bba1366e2b62 100644
--- a/packages/server/__snapshots__/domain_spec.coffee
+++ b/packages/server/__snapshots__/domain_spec.coffee
@@ -6,14 +6,53 @@ exports['e2e domain passing 1'] = `
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 1.2.3 │
│ Browser: FooBrowser 88 │
- │ Specs: 1 found (domain_spec.coffee) │
- │ Searched: cypress/integration/domain_spec.coffee │
+ │ Specs: 2 found (domain_2_spec.coffee, domain_spec.coffee) │
+ │ Searched: cypress/integration/domain* │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
- Running: domain_spec.coffee... (1 of 1)
+ Running: domain_2_spec.coffee... (1 of 2)
+
+
+ localhost
+ ✓ can visit
+
+ com.au
+ ✓ can visit
+
+ herokuapp.com
+ ✓ can visit
+
+
+ 3 passing
+
+
+ (Results)
+
+ ┌────────────────────────────────────┐
+ │ Tests: 3 │
+ │ Passing: 3 │
+ │ Failing: 0 │
+ │ Pending: 0 │
+ │ Skipped: 0 │
+ │ Screenshots: 0 │
+ │ Video: true │
+ │ Duration: X seconds │
+ │ Spec Ran: domain_2_spec.coffee │
+ └────────────────────────────────────┘
+
+
+ (Video)
+
+ - Started processing: Compressing to 32 CRF
+ - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)
+
+
+────────────────────────────────────────────────────────────────────────────────────────────────────
+
+ Running: domain_spec.coffee... (2 of 2)
localhost
@@ -57,9 +96,11 @@ exports['e2e domain passing 1'] = `
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
+ │ ✔ domain_2_spec.coffee XX:XX 3 3 - - - │
+ ├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ domain_spec.coffee XX:XX 3 3 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
- All specs passed! XX:XX 3 3 - - -
+ All specs passed! XX:XX 6 6 - - -
`
diff --git a/packages/server/__snapshots__/form_submissions_spec.coffee b/packages/server/__snapshots__/form_submissions_spec.coffee
index 69a8f93f16f7..ed00800d5208 100644
--- a/packages/server/__snapshots__/form_submissions_spec.coffee
+++ b/packages/server/__snapshots__/form_submissions_spec.coffee
@@ -121,7 +121,7 @@ exports['e2e form submissions failing 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/form submission fails -- fails without an explicit wait when an element is immediately found.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/form_submission_failing_spec.coffee/form submission fails -- fails without an explicit wait when an element is immediately found (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/issue_149_spec.coffee b/packages/server/__snapshots__/issue_149_spec.coffee
index f523d701529b..fe09a0100ef2 100644
--- a/packages/server/__snapshots__/issue_149_spec.coffee
+++ b/packages/server/__snapshots__/issue_149_spec.coffee
@@ -46,7 +46,7 @@ exports['e2e issue 149 failing 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/issue_149_spec.coffee/fails (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/issue_173_spec.coffee b/packages/server/__snapshots__/issue_173_spec.coffee
index dd4c36d125b7..5f5c8abd9c06 100644
--- a/packages/server/__snapshots__/issue_173_spec.coffee
+++ b/packages/server/__snapshots__/issue_173_spec.coffee
@@ -59,7 +59,7 @@ exports['e2e issue 173 failing 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/issue_173_spec.coffee/fails (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/issue_674_spec.coffee b/packages/server/__snapshots__/issue_674_spec.coffee
index 425dff41404d..59feafb41d16 100644
--- a/packages/server/__snapshots__/issue_674_spec.coffee
+++ b/packages/server/__snapshots__/issue_674_spec.coffee
@@ -56,8 +56,8 @@ Because this error occurred during a 'after each' hook we are skipping the remai
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/issue 674 -- doesnt hang when both beforeEach and afterEach fail -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/issue 674 -- doesnt hang when both beforeEach and afterEach fail -- after each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/issue_674_spec.coffee/issue 674 -- doesnt hang when both beforeEach and afterEach fail -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/issue_674_spec.coffee/issue 674 -- doesnt hang when both beforeEach and afterEach fail -- after each hook (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/js_error_handling_spec.coffee b/packages/server/__snapshots__/js_error_handling_spec.coffee
index 514559f743ed..556e0ef4862f 100644
--- a/packages/server/__snapshots__/js_error_handling_spec.coffee
+++ b/packages/server/__snapshots__/js_error_handling_spec.coffee
@@ -117,11 +117,11 @@ https://on.cypress.io/uncaught-exception-from-application
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1 -- without an afterEach hook -- t1.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1 -- without an afterEach hook -- t2.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1 -- with an afterEach hook -- t4.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1 -- with an afterEach hook -- t5.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/s1 -- cross origin script errors -- explains where script errored.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/js_error_handling_failing_spec.coffee/s1 -- without an afterEach hook -- t1 (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/js_error_handling_failing_spec.coffee/s1 -- without an afterEach hook -- t2 (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/js_error_handling_failing_spec.coffee/s1 -- with an afterEach hook -- t4 (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/js_error_handling_failing_spec.coffee/s1 -- with an afterEach hook -- t5 (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/js_error_handling_failing_spec.coffee/s1 -- cross origin script errors -- explains where script errored (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/promises_spec.coffee b/packages/server/__snapshots__/promises_spec.coffee
index 641acfba1a4c..abea3afa3001 100644
--- a/packages/server/__snapshots__/promises_spec.coffee
+++ b/packages/server/__snapshots__/promises_spec.coffee
@@ -51,8 +51,8 @@ exports['e2e promises failing1 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/catches regular promise errors.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/catches promise errors and calls done with err even when async.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/promises_spec.coffee/catches regular promise errors (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/promises_spec.coffee/catches promise errors and calls done with err even when async (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/record_spec.coffee b/packages/server/__snapshots__/record_spec.coffee
index a0737cfb281d..3bde44f027a7 100644
--- a/packages/server/__snapshots__/record_spec.coffee
+++ b/packages/server/__snapshots__/record_spec.coffee
@@ -95,7 +95,7 @@ Because this error occurred during a 'before each' hook we are skipping the rema
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/record fails -- fails 1 -- before each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_fail_spec.coffee/record fails -- fails 1 -- before each hook (failed).png (1280x720)
(Video)
@@ -106,7 +106,7 @@ Because this error occurred during a 'before each' hook we are skipping the rema
(Uploading Results)
- - Done Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/record fails -- fails 1 -- before each hook.png
+ - Done Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/record_fail_spec.coffee/record fails -- fails 1 -- before each hook (failed).png
- Done Uploading (2/2) /foo/bar/.projects/e2e/cypress/videos/abc123.mp4
────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -140,12 +140,12 @@ Because this error occurred during a 'before each' hook we are skipping the rema
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Uploading Results)
- - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png
+ - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png
────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -192,7 +192,7 @@ We dynamically generated a new test to display this failure.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/An uncaught error was detected outside of a test.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_uncaught_spec.coffee/An uncaught error was detected outside of a test (failed).png (1280x720)
(Video)
@@ -203,7 +203,7 @@ We dynamically generated a new test to display this failure.
(Uploading Results)
- - Done Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/An uncaught error was detected outside of a test.png
+ - Done Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/record_uncaught_spec.coffee/An uncaught error was detected outside of a test (failed).png
- Done Uploading (2/2) /foo/bar/.projects/e2e/cypress/videos/abc123.mp4
====================================================================================================
@@ -305,7 +305,7 @@ StatusCodeError: 500 - "Internal Server Error"
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
====================================================================================================
@@ -373,7 +373,7 @@ StatusCodeError: 500 - "Internal Server Error"
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
====================================================================================================
@@ -439,7 +439,7 @@ exports['e2e record api interaction errors update instance does not update insta
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Uploading Results)
@@ -515,12 +515,12 @@ exports['e2e record api interaction errors update instance stdout warns but proc
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Uploading Results)
- - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png
+ - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png
Warning: We encountered an error talking to our servers.
This run will not be recorded.
@@ -640,12 +640,12 @@ exports['e2e record video recording does not upload when not enabled 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Uploading Results)
- - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png
+ - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png
====================================================================================================
@@ -710,7 +710,7 @@ exports['e2e record api interaction errors uploading assets warns but proceeds 1
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Video)
@@ -721,7 +721,7 @@ exports['e2e record api interaction errors uploading assets warns but proceeds 1
(Uploading Results)
- - Failed Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png
+ - Failed Uploading (1/2) /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png
- Failed Uploading (2/2) /foo/bar/.projects/e2e/cypress/videos/abc123.mp4
====================================================================================================
@@ -807,7 +807,7 @@ This error will not alter the exit code.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/yay it passes.png (202x1002)
+ - /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
====================================================================================================
diff --git a/packages/server/__snapshots__/reporters_spec.coffee b/packages/server/__snapshots__/reporters_spec.coffee
index f9bcae584283..ef2524e8d612 100644
--- a/packages/server/__snapshots__/reporters_spec.coffee
+++ b/packages/server/__snapshots__/reporters_spec.coffee
@@ -267,9 +267,9 @@ Because this error occurred during a 'after all' hook we are skipping the remain
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- afterEach hooks -- runs this -- after each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- after hooks -- fails on this -- after all hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- afterEach hooks -- runs this -- after each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- after hooks -- fails on this -- after all hook (failed).png (1280x720)
(Video)
@@ -438,9 +438,9 @@ Because this error occurred during a 'after all' hook we are skipping the remain
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- afterEach hooks -- runs this -- after each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- after hooks -- fails on this -- after all hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- afterEach hooks -- runs this -- after each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- after hooks -- fails on this -- after all hook (failed).png (1280x720)
(Video)
@@ -609,9 +609,9 @@ Because this error occurred during a 'after all' hook we are skipping the remain
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- afterEach hooks -- runs this -- after each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- after hooks -- fails on this -- after all hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- afterEach hooks -- runs this -- after each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- after hooks -- fails on this -- after all hook (failed).png (1280x720)
(Video)
@@ -678,3 +678,4 @@ Error: this reporter threw an error
Learn more at stack trace line
`
+
diff --git a/packages/server/__snapshots__/request_spec.coffee b/packages/server/__snapshots__/request_spec.coffee
index f8f87ac29412..f10566fffe1c 100644
--- a/packages/server/__snapshots__/request_spec.coffee
+++ b/packages/server/__snapshots__/request_spec.coffee
@@ -174,7 +174,7 @@ RequestError: Error: connect ECONNREFUSED 127.0.0.1:16795
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when network connection cannot be established -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/request_http_network_error_failing_spec.coffee/when network connection cannot be established -- fails (failed).png (1280x720)
(Video)
@@ -295,7 +295,7 @@ Body: Service Unavailable
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when status code isnt 2xx or 3xx -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/request_status_code_failing_spec.coffee/when status code isnt 2xx or 3xx -- fails (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/return_value_spec.coffee b/packages/server/__snapshots__/return_value_spec.coffee
index 8d2ad78fae35..4e88f46b9c97 100644
--- a/packages/server/__snapshots__/return_value_spec.coffee
+++ b/packages/server/__snapshots__/return_value_spec.coffee
@@ -110,8 +110,8 @@ https://on.cypress.io/returning-value-and-commands-in-custom-command
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/errors when invoking commands and return a different value.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/errors when invoking commands in custom command and returning differnet value.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/return_value_spec.coffee/errors when invoking commands and return a different value (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/return_value_spec.coffee/errors when invoking commands in custom command and returning differnet value (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/screenshot_app_capture_spec.coffee b/packages/server/__snapshots__/screenshot_app_capture_spec.coffee
deleted file mode 100644
index b86d14174ce1..000000000000
--- a/packages/server/__snapshots__/screenshot_app_capture_spec.coffee
+++ /dev/null
@@ -1,112 +0,0 @@
-exports['e2e screenshot app capture passes 1'] = `
-====================================================================================================
-
- (Run Starting)
-
- ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
- │ Cypress: 1.2.3 │
- │ Browser: FooBrowser 88 │
- │ Specs: 1 found (screenshot_app_capture_spec.coffee) │
- │ Searched: cypress/integration/screenshot_app_capture_spec.coffee │
- └────────────────────────────────────────────────────────────────────────────────────────────────┘
-
-
-────────────────────────────────────────────────────────────────────────────────────────────────────
-
- Running: screenshot_app_capture_spec.coffee... (1 of 1)
-
-
- ✓ takes consistent app captures
-
- 1 passing
-
-
- (Results)
-
- ┌──────────────────────────────────────────────────┐
- │ Tests: 1 │
- │ Passing: 1 │
- │ Failing: 0 │
- │ Pending: 0 │
- │ Skipped: 0 │
- │ Screenshots: 51 │
- │ Video: true │
- │ Duration: X seconds │
- │ Spec Ran: screenshot_app_capture_spec.coffee │
- └──────────────────────────────────────────────────┘
-
-
- (Screenshots)
-
- - /foo/bar/.projects/e2e/cypress/screenshots/app-original.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-compare.png (1000x660)
-
-
- (Video)
-
- - Started processing: Compressing to 32 CRF
- - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)
-
-
-====================================================================================================
-
- (Run Finished)
-
-
- Spec Tests Passing Failing Pending Skipped
- ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
- │ ✔ screenshot_app_capture_spec.coffee XX:XX 1 1 - - - │
- └────────────────────────────────────────────────────────────────────────────────────────────────┘
- All specs passed! XX:XX 1 1 - - -
-
-`
-
diff --git a/packages/server/__snapshots__/screenshot_element_capture_spec.coffee b/packages/server/__snapshots__/screenshot_element_capture_spec.coffee
index ed6c7f0e1630..13c3a989f565 100644
--- a/packages/server/__snapshots__/screenshot_element_capture_spec.coffee
+++ b/packages/server/__snapshots__/screenshot_element_capture_spec.coffee
@@ -38,17 +38,17 @@ exports['e2e screenshot element capture passes 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-original.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-compare.png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-original.png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare.png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (1).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (2).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (3).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (4).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (5).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (6).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (7).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (8).png (560x302)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_element_capture_spec.coffee/element-compare (9).png (560x302)
(Video)
diff --git a/packages/server/__snapshots__/screenshot_fullpage_capture_spec.coffee b/packages/server/__snapshots__/screenshot_fullpage_capture_spec.coffee
index 78cd3d41a35d..0db4644f590d 100644
--- a/packages/server/__snapshots__/screenshot_fullpage_capture_spec.coffee
+++ b/packages/server/__snapshots__/screenshot_fullpage_capture_spec.coffee
@@ -38,17 +38,17 @@ exports['e2e screenshot fullPage capture passes 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-original.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-compare.png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-original.png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare.png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (1).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (2).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (3).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (4).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (5).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (6).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (7).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (8).png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_fullpage_capture_spec.coffee/fullPage-compare (9).png (600x500)
(Video)
diff --git a/packages/server/__snapshots__/screenshot_nested_file_spec.coffee b/packages/server/__snapshots__/screenshot_nested_file_spec.coffee
new file mode 100644
index 000000000000..1c87db7188cc
--- /dev/null
+++ b/packages/server/__snapshots__/screenshot_nested_file_spec.coffee
@@ -0,0 +1,62 @@
+exports['e2e screenshot in nested spec passes 1'] = `
+====================================================================================================
+
+ (Run Starting)
+
+ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
+ │ Cypress: 1.2.3 │
+ │ Browser: FooBrowser 88 │
+ │ Specs: 1 found (nested-1/nested-2/screenshot_nested_file_spec.coffee) │
+ │ Searched: cypress/integration/nested-1/nested-2/screenshot_nested_file_spec.coffee │
+ └────────────────────────────────────────────────────────────────────────────────────────────────┘
+
+
+────────────────────────────────────────────────────────────────────────────────────────────────────
+
+ Running: nested-1/nested-2/screenshot_nested_file_spec.coffee... (1 of 1)
+
+
+ ✓ nests the file based on spec path
+
+ 1 passing
+
+
+ (Results)
+
+ ┌────────────────────────────────────────────────────────────────────┐
+ │ Tests: 1 │
+ │ Passing: 1 │
+ │ Failing: 0 │
+ │ Pending: 0 │
+ │ Skipped: 0 │
+ │ Screenshots: 1 │
+ │ Video: true │
+ │ Duration: X seconds │
+ │ Spec Ran: nested-1/nested-2/screenshot_nested_file_spec.coffee │
+ └────────────────────────────────────────────────────────────────────┘
+
+
+ (Screenshots)
+
+ - /foo/bar/.projects/e2e/cypress/screenshots/nested-1/nested-2/screenshot_nested_file_spec.coffee/nests the file based on spec path.png (1280x720)
+
+
+ (Video)
+
+ - Started processing: Compressing to 32 CRF
+ - Finished processing: /foo/bar/.projects/e2e/cypress/videos/nested-1/nested-2/abc123.mp4 (X seconds)
+
+
+====================================================================================================
+
+ (Run Finished)
+
+
+ Spec Tests Passing Failing Pending Skipped
+ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
+ │ ✔ nested-1/nested-2/screenshot_nested_… XX:XX 1 1 - - - │
+ └────────────────────────────────────────────────────────────────────────────────────────────────┘
+ All specs passed! XX:XX 1 1 - - -
+
+`
+
diff --git a/packages/server/__snapshots__/screenshot_viewport_capture_spec.coffee b/packages/server/__snapshots__/screenshot_viewport_capture_spec.coffee
new file mode 100644
index 000000000000..709ef634ddc8
--- /dev/null
+++ b/packages/server/__snapshots__/screenshot_viewport_capture_spec.coffee
@@ -0,0 +1,87 @@
+exports['e2e screenshot viewport capture passes 1'] = `
+====================================================================================================
+
+ (Run Starting)
+
+ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
+ │ Cypress: 1.2.3 │
+ │ Browser: FooBrowser 88 │
+ │ Specs: 1 found (screenshot_viewport_capture_spec.coffee) │
+ │ Searched: cypress/integration/screenshot_viewport_capture_spec.coffee │
+ └────────────────────────────────────────────────────────────────────────────────────────────────┘
+
+
+────────────────────────────────────────────────────────────────────────────────────────────────────
+
+ Running: screenshot_viewport_capture_spec.coffee... (1 of 1)
+
+
+ ✓ takes consistent viewport captures
+
+ 1 passing
+
+
+ (Results)
+
+ ┌───────────────────────────────────────────────────────┐
+ │ Tests: 1 │
+ │ Passing: 1 │
+ │ Failing: 0 │
+ │ Pending: 0 │
+ │ Skipped: 0 │
+ │ Screenshots: 26 │
+ │ Video: true │
+ │ Duration: X seconds │
+ │ Spec Ran: screenshot_viewport_capture_spec.coffee │
+ └───────────────────────────────────────────────────────┘
+
+
+ (Screenshots)
+
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-original.png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare.png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (1).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (2).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (3).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (4).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (5).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (6).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (7).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (8).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (9).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (10).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (11).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (12).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (13).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (14).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (15).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (16).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (17).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (18).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (19).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (20).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (21).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (22).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (23).png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshot_viewport_capture_spec.coffee/viewport-compare (24).png (1000x660)
+
+
+ (Video)
+
+ - Started processing: Compressing to 32 CRF
+ - Finished processing: /foo/bar/.projects/e2e/cypress/videos/abc123.mp4 (X seconds)
+
+
+====================================================================================================
+
+ (Run Finished)
+
+
+ Spec Tests Passing Failing Pending Skipped
+ ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
+ │ ✔ screenshot_viewport_capture_spec.cof… XX:XX 1 1 - - - │
+ └────────────────────────────────────────────────────────────────────────────────────────────────┘
+ All specs passed! XX:XX 1 1 - - -
+
+`
+
diff --git a/packages/server/__snapshots__/screenshots_spec.coffee b/packages/server/__snapshots__/screenshots_spec.coffee
index 5e09b01bc779..c3353aaf9dfb 100644
--- a/packages/server/__snapshots__/screenshots_spec.coffee
+++ b/packages/server/__snapshots__/screenshots_spec.coffee
@@ -27,38 +27,44 @@ exports['e2e screenshots passes 1'] = `
✓ accepts screenshot after multiple tries if somehow app has pixels that match helper pixels
✓ can capture element screenshots
✓ retries each screenshot for up to XX:XX
+ ✓ ensures unique paths for non-named screenshots
+ 2) ensures unique paths when there's a non-named screenshot and a failure
clipping
✓ can clip app screenshots
✓ can clip runner screenshots
✓ can clip fullPage screenshots
✓ can clip element screenshots
before hooks
- 2) "before all" hook for "empty test 1"
+ 3) "before all" hook for "empty test 1"
each hooks
- 3) "before each" hook for "empty test 2"
- 4) "after each" hook for "empty test 2"
+ 4) "before each" hook for "empty test 2"
+ 5) "after each" hook for "empty test 2"
- 13 passing
- 4 failing
+ 14 passing
+ 5 failing
1) taking screenshots generates pngs on failure:
Error: fail whale
at stack trace line
- 2) taking screenshots before hooks "before all" hook for "empty test 1":
+ 2) taking screenshots ensures unique paths when there's a non-named screenshot and a failure:
+ Error: failing on purpose
+ at stack trace line
+
+ 3) taking screenshots before hooks "before all" hook for "empty test 1":
Error: before hook failing
Because this error occurred during a 'before all' hook we are skipping the remaining tests in the current suite: 'before hooks'
at stack trace line
- 3) taking screenshots each hooks "before each" hook for "empty test 2":
+ 4) taking screenshots each hooks "before each" hook for "empty test 2":
Error: before each hook failed
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'each hooks'
at stack trace line
- 4) taking screenshots each hooks "after each" hook for "empty test 2":
+ 5) taking screenshots each hooks "after each" hook for "empty test 2":
Error: after each hook failed
Because this error occurred during a 'after each' hook we are skipping the remaining tests in the current suite: 'each hooks'
@@ -70,12 +76,12 @@ Because this error occurred during a 'after each' hook we are skipping the remai
(Results)
┌───────────────────────────────────────┐
- │ Tests: 16 │
- │ Passing: 13 │
- │ Failing: 3 │
+ │ Tests: 18 │
+ │ Passing: 14 │
+ │ Failing: 4 │
│ Pending: 0 │
│ Skipped: 0 │
- │ Screenshots: 18 │
+ │ Screenshots: 23 │
│ Video: true │
│ Duration: X seconds │
│ Spec Ran: screenshots_spec.coffee │
@@ -84,24 +90,29 @@ Because this error occurred during a 'after each' hook we are skipping the remai
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/black.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/red.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/foobarbaz.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/taking screenshots -- generates pngs on failure.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/color-check.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/crop-check.png (600x400)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-same.png (600x500)
- - /foo/bar/.projects/e2e/cypress/screenshots/pathological.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/element.png (400x300)
- - /foo/bar/.projects/e2e/cypress/screenshots/taking screenshots -- retries each screenshot for up to XX:XX.png (400x1316)
- - /foo/bar/.projects/e2e/cypress/screenshots/app-clip.png (100x50)
- - /foo/bar/.projects/e2e/cypress/screenshots/runner-clip.png (120x60)
- - /foo/bar/.projects/e2e/cypress/screenshots/fullPage-clip.png (140x70)
- - /foo/bar/.projects/e2e/cypress/screenshots/element-clip.png (160x80)
- - /foo/bar/.projects/e2e/cypress/screenshots/taking screenshots -- before hooks -- empty test 1 -- before all hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/taking screenshots -- each hooks -- empty test 2 -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/taking screenshots -- each hooks -- empty test 2 -- after each hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/black.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/red.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/foo/bar/baz.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- generates pngs on failure (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/color-check.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/crop-check.png (600x400)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/fullPage.png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/fullPage-same.png (600x500)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/pathological.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/element.png (400x300)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- retries each screenshot for up to XX:XX.png (400x1316)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots (1).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots (2).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths when theres a non-named screenshot and a failure.png (1000x660)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths when theres a non-named screenshot and a failure (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/app-clip.png (100x50)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/runner-clip.png (120x60)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/fullPage-clip.png (140x70)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/element-clip.png (160x80)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- before hooks -- empty test 1 -- before all hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- each hooks -- empty test 2 -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/screenshots_spec.coffee/taking screenshots -- each hooks -- empty test 2 -- after each hook (failed).png (1280x720)
(Video)
@@ -117,9 +128,9 @@ Because this error occurred during a 'after each' hook we are skipping the remai
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
- │ ✖ screenshots_spec.coffee XX:XX 16 13 3 - - │
+ │ ✖ screenshots_spec.coffee XX:XX 18 14 4 - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
- 1 of 1 failed (100%) XX:XX 16 13 3 - -
+ 1 of 1 failed (100%) XX:XX 18 14 4 - -
`
diff --git a/packages/server/__snapshots__/spec_isolation_spec.coffee b/packages/server/__snapshots__/spec_isolation_spec.coffee
index ad4b3d460774..2519db703d25 100644
--- a/packages/server/__snapshots__/spec_isolation_spec.coffee
+++ b/packages/server/__snapshots__/spec_isolation_spec.coffee
@@ -211,7 +211,7 @@ exports['e2e spec_isolation failing 1'] = {
"name": null,
"testId": "r4",
"takenAt": "2018-02-01T20:14:19.323Z",
- "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook.png",
+ "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- beforeEach hooks -- never gets here -- before each hook (failed).png",
"height": 720,
"width": 1280
},
@@ -220,7 +220,7 @@ exports['e2e spec_isolation failing 1'] = {
"name": null,
"testId": "r8",
"takenAt": "2018-02-01T20:14:19.323Z",
- "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- afterEach hooks -- runs this -- after each hook.png",
+ "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- afterEach hooks -- runs this -- after each hook (failed).png",
"height": 720,
"width": 1280
},
@@ -229,14 +229,14 @@ exports['e2e spec_isolation failing 1'] = {
"name": null,
"testId": "r12",
"takenAt": "2018-02-01T20:14:19.323Z",
- "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple failing hook spec -- after hooks -- fails on this -- after all hook.png",
+ "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_hook_spec.coffee/simple failing hook spec -- after hooks -- fails on this -- after all hook (failed).png",
"height": 720,
"width": 1280
}
],
"spec": {
"name": "simple_failing_hook_spec.coffee",
- "path": "cypress/integration/simple_failing_hook_spec.coffee",
+ "relative": "cypress/integration/simple_failing_hook_spec.coffee",
"absolute": "/foo/bar/.projects/e2e/cypress/integration/simple_failing_hook_spec.coffee"
},
"shouldUploadVideo": true
@@ -319,7 +319,7 @@ exports['e2e spec_isolation failing 1'] = {
"name": null,
"testId": "r3",
"takenAt": "2018-02-01T20:14:19.323Z",
- "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple failing spec -- fails1.png",
+ "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_spec.coffee/simple failing spec -- fails1 (failed).png",
"height": 720,
"width": 1280
},
@@ -328,14 +328,14 @@ exports['e2e spec_isolation failing 1'] = {
"name": null,
"testId": "r4",
"takenAt": "2018-02-01T20:14:19.323Z",
- "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple failing spec -- fails2.png",
+ "path": "/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_spec.coffee/simple failing spec -- fails2 (failed).png",
"height": 720,
"width": 1280
}
],
"spec": {
"name": "simple_failing_spec.coffee",
- "path": "cypress/integration/simple_failing_spec.coffee",
+ "relative": "cypress/integration/simple_failing_spec.coffee",
"absolute": "/foo/bar/.projects/e2e/cypress/integration/simple_failing_spec.coffee"
},
"shouldUploadVideo": true
@@ -526,7 +526,7 @@ exports['e2e spec_isolation failing 1'] = {
"screenshots": [],
"spec": {
"name": "simple_hooks_spec.coffee",
- "path": "cypress/integration/simple_hooks_spec.coffee",
+ "relative": "cypress/integration/simple_hooks_spec.coffee",
"absolute": "/foo/bar/.projects/e2e/cypress/integration/simple_hooks_spec.coffee"
},
"shouldUploadVideo": true
@@ -600,7 +600,7 @@ exports['e2e spec_isolation failing 1'] = {
"screenshots": [],
"spec": {
"name": "simple_passing_spec.coffee",
- "path": "cypress/integration/simple_passing_spec.coffee",
+ "relative": "cypress/integration/simple_passing_spec.coffee",
"absolute": "/foo/bar/.projects/e2e/cypress/integration/simple_passing_spec.coffee"
},
"shouldUploadVideo": true
@@ -614,4 +614,3 @@ exports['e2e spec_isolation failing 1'] = {
"cypressVersion": "9.9.9",
"config": {}
}
-
diff --git a/packages/server/__snapshots__/stdout_spec.coffee b/packages/server/__snapshots__/stdout_spec.coffee
index dbfe030baf91..5f686848edcf 100644
--- a/packages/server/__snapshots__/stdout_spec.coffee
+++ b/packages/server/__snapshots__/stdout_spec.coffee
@@ -111,9 +111,9 @@ The internal Cypress web server responded with:
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- fails.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- failing hook -- is failing -- before each hook.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- passing hook -- is failing.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec.coffee/stdout_failing_spec -- fails (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec.coffee/stdout_failing_spec -- failing hook -- is failing -- before each hook (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec.coffee/stdout_failing_spec -- passing hook -- is failing (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/task_not_registered_spec.coffee b/packages/server/__snapshots__/task_not_registered_spec.coffee
index cc3752d67c7f..e77ed3a0ba8a 100644
--- a/packages/server/__snapshots__/task_not_registered_spec.coffee
+++ b/packages/server/__snapshots__/task_not_registered_spec.coffee
@@ -64,7 +64,7 @@ https://on.cypress.io/api/task
(Screenshots)
- - /foo/bar/.projects/task-not-registered/cypress/screenshots/fails because the task event is not registered in plugins file.png (1280x720)
+ - /foo/bar/.projects/task-not-registered/cypress/screenshots/task_not_registered_spec.coffee/fails because the task event is not registered in plugins file (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/task_spec.coffee b/packages/server/__snapshots__/task_spec.coffee
index f3df491297a0..6c8167938154 100644
--- a/packages/server/__snapshots__/task_spec.coffee
+++ b/packages/server/__snapshots__/task_spec.coffee
@@ -105,8 +105,8 @@ https://on.cypress.io/api/task
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/throws when task returns undefined.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/includes stack trace in error.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/task_spec.coffee/throws when task returns undefined (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/task_spec.coffee/includes stack trace in error (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/uncaught_spec_errors_spec.coffee b/packages/server/__snapshots__/uncaught_spec_errors_spec.coffee
index a75f7755a659..05a2a24165a0 100644
--- a/packages/server/__snapshots__/uncaught_spec_errors_spec.coffee
+++ b/packages/server/__snapshots__/uncaught_spec_errors_spec.coffee
@@ -56,7 +56,7 @@ We dynamically generated a new test to display this failure.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/An uncaught error was detected outside of a test.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_synchronous_before_tests_parsed.coffee/An uncaught error was detected outside of a test (failed).png (1280x720)
(Video)
@@ -137,7 +137,7 @@ We dynamically generated a new test to display this failure.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/An uncaught error was detected outside of a test.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_synchronous_during_hook_spec.coffee/An uncaught error was detected outside of a test (failed).png (1280x720)
(Video)
@@ -212,7 +212,7 @@ When Cypress detects uncaught errors originating from your test code it will aut
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- bar.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_during_test_spec.coffee/foo -- bar (failed).png (1280x720)
(Video)
@@ -292,7 +292,7 @@ Because this error occurred during a 'before all' hook we are skipping the remai
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- does not run -- before all hook.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/uncaught_during_hook_spec.coffee/foo -- does not run -- before all hook (failed).png (1280x720)
(Video)
@@ -382,10 +382,10 @@ exports['e2e uncaught errors failing5 1'] = `
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- baz fails.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- bar fails.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- quux fails.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/foo -- quux2 fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/caught_async_sync_test_spec.coffee/foo -- baz fails (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/caught_async_sync_test_spec.coffee/foo -- bar fails (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/caught_async_sync_test_spec.coffee/foo -- quux fails (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/caught_async_sync_test_spec.coffee/foo -- quux2 fails (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/uncaught_support_file_spec.coffee b/packages/server/__snapshots__/uncaught_support_file_spec.coffee
index 63c205069ee6..fb8f69166a9d 100644
--- a/packages/server/__snapshots__/uncaught_support_file_spec.coffee
+++ b/packages/server/__snapshots__/uncaught_support_file_spec.coffee
@@ -55,7 +55,7 @@ We dynamically generated a new test to display this failure.
(Screenshots)
- - /foo/bar/.projects/uncaught-support-file/cypress/screenshots/An uncaught error was detected outside of a test.png (1280x720)
+ - /foo/bar/.projects/uncaught-support-file/cypress/screenshots/spec.coffee/An uncaught error was detected outside of a test (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/visit_spec.coffee b/packages/server/__snapshots__/visit_spec.coffee
index 9b53b9bbed6e..2a4956fa36c9 100644
--- a/packages/server/__snapshots__/visit_spec.coffee
+++ b/packages/server/__snapshots__/visit_spec.coffee
@@ -159,7 +159,7 @@ Error: connect ECONNREFUSED 127.0.0.1:16795
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when network connection cannot be established -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_http_network_error_failing_spec.coffee/when network connection cannot be established -- fails (failed).png (1280x720)
(Video)
@@ -254,7 +254,7 @@ If you do not want status codes to cause failures pass the option: 'failOnStatus
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when server response is 500 -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_http_500_response_failing_spec.coffee/when server response is 500 -- fails (failed).png (1280x720)
(Video)
@@ -349,7 +349,7 @@ The internal Cypress web server responded with:
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when file server response is 404 -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_file_404_response_failing_spec.coffee/when file server response is 404 -- fails (failed).png (1280x720)
(Video)
@@ -446,7 +446,7 @@ cy.request() will automatically get and set cookies and enable you to parse resp
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when content type is plaintext -- fails.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_non_html_content_type_failing_spec.coffee/when content type is plaintext -- fails (failed).png (1280x720)
(Video)
@@ -568,8 +568,8 @@ When this 'load' event occurs, Cypress will continue running commands.
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/when visit times out -- fails timeout exceeds pageLoadTimeout.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/when visit times out -- fails timeout exceeds timeout option.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_http_timeout_failing_spec.coffee/when visit times out -- fails timeout exceeds pageLoadTimeout (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/visit_http_timeout_failing_spec.coffee/when visit times out -- fails timeout exceeds timeout option (failed).png (1280x720)
(Video)
diff --git a/packages/server/__snapshots__/web_security_spec.coffee b/packages/server/__snapshots__/web_security_spec.coffee
index 11ea3ce05620..66d939c0231c 100644
--- a/packages/server/__snapshots__/web_security_spec.coffee
+++ b/packages/server/__snapshots__/web_security_spec.coffee
@@ -141,9 +141,9 @@ https://on.cypress.io/cross-origin-violation
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/web security -- fails when clicking a to another origin.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/web security -- fails when submitted a form and being redirected to another origin.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/web security -- fails when using a javascript redirect to another origin.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/web_security_spec.coffee/web security -- fails when clicking a to another origin (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/web_security_spec.coffee/web security -- fails when submitted a form and being redirected to another origin (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/web_security_spec.coffee/web security -- fails when using a javascript redirect to another origin (failed).png (1280x720)
(Video)
diff --git a/packages/server/lib/browsers/index.coffee b/packages/server/lib/browsers/index.coffee
index 786ceb3661af..52af97fa0f14 100644
--- a/packages/server/lib/browsers/index.coffee
+++ b/packages/server/lib/browsers/index.coffee
@@ -76,10 +76,6 @@ module.exports = {
if not browser = getBrowser(name)
return throwBrowserNotFound(name, options.browsers)
- ## set the current browser object on options
- ## so we can pass it down
- options.browser = find(name, options.browsers)
-
if not url = options.url
throw new Error("options.url must be provided when opening a browser. You passed:", options)
diff --git a/packages/server/lib/controllers/runner.coffee b/packages/server/lib/controllers/runner.coffee
index b0f18f86d752..ecb0ce771919 100644
--- a/packages/server/lib/controllers/runner.coffee
+++ b/packages/server/lib/controllers/runner.coffee
@@ -1,24 +1,32 @@
_ = require("lodash")
send = require("send")
os = require("os")
-debug = require("debug")("cypress:server")
+debug = require("debug")("cypress:server:runner")
runner = require("@packages/runner")
pkg = require("@packages/root")
module.exports = {
- serve: (req, res, config, getRemoteState) ->
+ serve: (req, res, options = {}) ->
+ { config, getRemoteState, project } = options
+
+ { spec, browser } = project.getCurrentSpecAndBrowser()
+
config = _.clone(config)
config.remote = getRemoteState()
config.version = pkg.version
config.platform = os.platform()
config.arch = os.arch()
- debug("config version %s platform %s arch %s",
- config.version, config.platform, config.arch)
+ config.spec = spec
+ config.browser = browser
+
+ debug("serving runner index.html with config %o",
+ _.pick(config, "version", "platform", "arch", "projectName")
+ )
- res.render runner.getPathToIndex(), {
+ res.render(runner.getPathToIndex(), {
config: JSON.stringify(config)
projectName: config.projectName
- }
+ })
handle: (req, res) ->
pathToFile = runner.getPathToDist(req.params[0])
diff --git a/packages/server/lib/modes/record.coffee b/packages/server/lib/modes/record.coffee
index 6e0a6eab0260..05e3df2edbab 100644
--- a/packages/server/lib/modes/record.coffee
+++ b/packages/server/lib/modes/record.coffee
@@ -60,8 +60,8 @@ throwIfNoProjectId = (projectId) ->
if not projectId
errors.throw("CANNOT_RECORD_NO_PROJECT_ID")
-getSpecPath = (spec) ->
- _.get(spec, "path")
+getSpecRelativePath = (spec) ->
+ _.get(spec, "relative")
uploadArtifacts = (options = {}) ->
{ video, screenshots, videoUploadUrl, shouldUploadVideo, screenshotUploadUrls } = options
@@ -189,7 +189,7 @@ createRun = (options = {}) ->
if specPattern
specPattern = specPattern.join(",")
- specs = _.map(specs, getSpecPath)
+ specs = _.map(specs, getSpecRelativePath)
api.createRun({
specPattern
@@ -236,7 +236,7 @@ createRun = (options = {}) ->
createInstance = (options = {}) ->
{ runId, groupId, machineId, platform, spec } = options
- spec = getSpecPath(spec)
+ spec = getSpecRelativePath(spec)
api.createInstance({
spec
diff --git a/packages/server/lib/modes/run.coffee b/packages/server/lib/modes/run.coffee
index d65adf9e8d9d..48f06dfe7bbf 100644
--- a/packages/server/lib/modes/run.coffee
+++ b/packages/server/lib/modes/run.coffee
@@ -511,7 +511,7 @@ module.exports = {
browserOpts.projectRoot = options.projectRoot
- openProject.launch(browserName, spec.absolute, browserOpts)
+ openProject.launch(browserName, spec, browserOpts)
listenForProjectEnd: (project, headed, exit) ->
new Promise (resolve) ->
diff --git a/packages/server/lib/open_project.coffee b/packages/server/lib/open_project.coffee
index cd1e5431dfb4..3ab67b8bffac 100644
--- a/packages/server/lib/open_project.coffee
+++ b/packages/server/lib/open_project.coffee
@@ -1,11 +1,11 @@
_ = require("lodash")
+debug = require("debug")("cypress:server:openproject")
Promise = require("bluebird")
files = require("./controllers/files")
config = require("./config")
Project = require("./project")
browsers = require("./browsers")
-specsUtil = require('./util/specs')
-log = require('debug')("cypress:server:project")
+specsUtil = require("./util/specs")
preprocessor = require("./plugins/preprocessor")
create = ->
@@ -42,12 +42,13 @@ create = ->
getProject: -> openProject
launch: (browserName, spec, options = {}) ->
- log("launching browser %s spec %s", browserName, spec)
+ debug("resetting project state, preparing to launch browser")
+
## reset to reset server and socket state because
## of potential domain changes, request buffers, etc
@reset()
.then ->
- openProject.getSpecUrl(spec)
+ openProject.getSpecUrl(spec.absolute)
.then (url) ->
openProject.getConfig()
.then (cfg) ->
@@ -60,6 +61,12 @@ create = ->
options.url = url
+ ## set the current browser object on options
+ ## so we can pass it down
+ options.browser = browsers.find(browserName, options.browsers)
+
+ openProject.setCurrentSpecAndBrowser(spec, options.browser)
+
automation = openProject.getAutomation()
## use automation middleware if its
@@ -67,16 +74,28 @@ create = ->
if am = options.automationMiddleware
automation.use(am)
+ automation.use({
+ onBeforeRequest: (message, data) ->
+ if message is "take:screenshot"
+ data.specName = spec.name
+ data
+ })
+
onBrowserClose = options.onBrowserClose
options.onBrowserClose = ->
- if spec
- preprocessor.removeFile(spec, cfg)
+ if spec and spec.absolute
+ preprocessor.removeFile(spec.absolute, cfg)
if onBrowserClose
onBrowserClose()
do relaunchBrowser = ->
- log "launching project in browser #{browserName}"
+ debug(
+ "launching browser: %s, spec: %s",
+ browserName,
+ spec.relative
+ )
+
browsers.open(browserName, options, automation)
getSpecChanges: (options = {}) ->
@@ -137,7 +156,8 @@ create = ->
return null
close: ->
- log "closing opened project"
+ debug("closing opened project")
+
@clearSpecInterval()
@closeOpenProjectAndBrowsers()
@@ -159,7 +179,8 @@ create = ->
## open the project and return
## the config for the project instance
- log("opening project %s", path)
+ debug("opening project %s", path)
+
openProject.open(options)
.return(@)
}
diff --git a/packages/server/lib/plugins/preprocessor.coffee b/packages/server/lib/plugins/preprocessor.coffee
index ff01922d6825..6d07c25a2ae9 100644
--- a/packages/server/lib/plugins/preprocessor.coffee
+++ b/packages/server/lib/plugins/preprocessor.coffee
@@ -1,18 +1,13 @@
_ = require("lodash")
EE = require("events")
path = require("path")
-log = require("debug")("cypress:server:preprocessor")
+debug = require("debug")("cypress:server:preprocessor")
Promise = require("bluebird")
-
appData = require("../util/app_data")
cwd = require("../cwd")
plugins = require("../plugins")
savedState = require("../util/saved_state")
-PrettyError = require("pretty-error")
-pe = new PrettyError()
-pe.skipNodeFiles()
-
errorMessage = (err = {}) ->
(err.stack ? err.annotated ? err.message ? err.toString())
## strip out stack noise from parser like
@@ -21,7 +16,8 @@ errorMessage = (err = {}) ->
.replace(/From previous event:\n?/g, "")
clientSideError = (err) ->
- console.log(pe.render(err))
+ console.log(err.stack)
+
err = errorMessage(err)
## \n doesn't come through properly so preserve it so the
## runner can do the right thing
@@ -47,51 +43,62 @@ fileObjects = {}
fileProcessors = {}
setDefaultPreprocessor = ->
- log("set default preprocessor")
+ debug("set default preprocessor")
browserify = require("@cypress/browserify-preprocessor")
plugins.register("file:preprocessor", browserify())
plugins.registerHandler (ipc) ->
ipc.on "preprocessor:rerun", (filePath) ->
- log("ipc preprocessor:rerun event")
+ debug("ipc preprocessor:rerun event")
baseEmitter.emit("file:updated", filePath)
baseEmitter.on "close", (filePath) ->
- log("base emitter plugin close event")
+ debug("base emitter plugin close event")
ipc.send("preprocessor:close", filePath)
module.exports = {
errorMessage
+
clientSideError
+
emitter: baseEmitter
- getFile: (filePath, config, options = {}) ->
- filePath = path.join(config.projectRoot, filePath)
+ getFile: (filePath, config) ->
+ filePath = path.resolve(config.projectRoot, filePath)
- log("getFile #{filePath}")
+ debug("getFile #{filePath}")
if not fileObject = fileObjects[filePath]
+ ## we should be watching the file if we are NOT
+ ## in a text terminal aka cypress run
+ ## TODO: rename this to config.isRunMode
+ ## vs config.isInterativeMode
+ shouldWatch = not config.isTextTerminal
+
baseFilePath = filePath
- .replace(config.projectRoot, "")
- .replace(config.integrationFolder, "")
+ .replace(config.projectRoot, "")
+ .replace(config.integrationFolder, "")
+
fileObject = fileObjects[filePath] = _.extend(new EE(), {
- filePath: filePath
+ filePath,
+ shouldWatch,
outputPath: getOutputPath(config, baseFilePath)
- shouldWatch: not config.isTextTerminal
})
+
fileObject.on "rerun", ->
- log("file object rerun event")
+ debug("file object rerun event")
baseEmitter.emit("file:updated", filePath)
+
baseEmitter.once "close", ->
- log("base emitter native close event")
+ debug("base emitter native close event")
fileObject.emit("close")
if not plugins.has("file:preprocessor")
setDefaultPreprocessor(config)
if config.isTextTerminal and fileProcessor = fileProcessors[filePath]
- log("headless and already processed")
+ debug("headless and already processed")
return fileProcessor
preprocessor = fileProcessors[filePath] = Promise.try ->
@@ -100,23 +107,25 @@ module.exports = {
return preprocessor
removeFile: (filePath, config) ->
- filePath = path.join(config.projectRoot, filePath)
+ filePath = path.resolve(config.projectRoot, filePath)
return if not fileProcessors[filePath]
- log("removeFile #{filePath}")
+ debug("removeFile #{filePath}")
+
baseEmitter.emit("close", filePath)
+
if fileObject = fileObjects[filePath]
fileObject.emit("close")
+
delete fileObjects[filePath]
delete fileProcessors[filePath]
close: ->
- log("close preprocessor")
+ debug("close preprocessor")
fileObjects = {}
fileProcessors = {}
baseEmitter.emit("close")
baseEmitter.removeAllListeners()
-
}
diff --git a/packages/server/lib/project.coffee b/packages/server/lib/project.coffee
index a1fb9b87f613..f3d00ede058f 100644
--- a/packages/server/lib/project.coffee
+++ b/packages/server/lib/project.coffee
@@ -39,15 +39,19 @@ class Project extends EE
if not projectRoot
throw new Error("Instantiating lib/project requires a projectRoot!")
+
if not check.unemptyString(projectRoot)
throw new Error("Expected project root path, not #{projectRoot}")
@projectRoot = path.resolve(projectRoot)
@watchers = Watchers()
- @server = null
@cfg = null
+ @spec = null
+ @browser = null
+ @server = null
@memoryCheck = null
@automation = null
+
debug("Project created %s", @projectRoot)
open: (options = {}) ->
@@ -146,6 +150,8 @@ class Project extends EE
reset: ->
debug("resetting project instance %s", @projectRoot)
+ @spec = @browser = null
+
Promise.try =>
@automation?.reset()
@server?.reset()
@@ -156,7 +162,7 @@ class Project extends EE
if @memoryCheck
clearInterval(@memoryCheck)
- @cfg = null
+ @cfg = @spec = @browser = null
Promise.join(
@server?.close(),
@@ -281,6 +287,13 @@ class Project extends EE
changeToUrl: (url) ->
@server.changeToUrl(url)
+ setCurrentSpecAndBrowser: (spec, browser) ->
+ @spec = spec
+ @browser = browser
+
+ getCurrentSpecAndBrowser: ->
+ _.pick(@, "spec", "browser")
+
setBrowsers: (browsers = []) ->
@getConfig()
.then (cfg) ->
@@ -337,21 +350,21 @@ class Project extends EE
cfg.state = state
cfg
- getSpecUrl: (spec) ->
+ getSpecUrl: (absoluteSpecPath) ->
@getConfig()
.then (cfg) =>
- ## if we dont have a spec or its __all
- if not spec or (spec is "__all")
+ ## if we dont have a absoluteSpecPath or its __all
+ if not absoluteSpecPath or (absoluteSpecPath is "__all")
@normalizeSpecUrl(cfg.browserUrl, "/__all")
else
## TODO:
## to handle both unit + integration tests we need
- ## to figure out (based on the config) where this spec
+ ## to figure out (based on the config) where this absoluteSpecPath
## lives. does it live in the integrationFolder or
## the unit folder?
## once we determine that we can then prefix it correctly
## with either integration or unit
- prefixedPath = @getPrefixedPathToSpec(cfg, spec)
+ prefixedPath = @getPrefixedPathToSpec(cfg, absoluteSpecPath)
@normalizeSpecUrl(cfg.browserUrl, prefixedPath)
getPrefixedPathToSpec: (cfg, pathToSpec, type = "integration") ->
diff --git a/packages/server/lib/routes.coffee b/packages/server/lib/routes.coffee
index c0a016e3bb5c..2ca1d9255dcc 100644
--- a/packages/server/lib/routes.coffee
+++ b/packages/server/lib/routes.coffee
@@ -64,9 +64,15 @@ module.exports = (app, config, request, getRemoteState, project) ->
## and any other __cypress namespaced files so that the runner does
## not have to be aware of anything
la(check.unemptyString(config.clientRoute), "missing client route in config", config)
+
app.get config.clientRoute, (req, res) ->
debug("Serving Cypress front-end by requested URL:", req.url)
- runner.serve(req, res, config, getRemoteState)
+
+ runner.serve(req, res, {
+ config,
+ project,
+ getRemoteState,
+ })
app.all "*", (req, res, next) ->
proxy.handle(req, res, config, getRemoteState, request)
diff --git a/packages/server/lib/screenshots.coffee b/packages/server/lib/screenshots.coffee
index e1827b8efe72..9e26f7cfc403 100644
--- a/packages/server/lib/screenshots.coffee
+++ b/packages/server/lib/screenshots.coffee
@@ -10,9 +10,11 @@ colorString = require("color-string")
debug = require("debug")("cypress:server:screenshot")
fs = require("./util/fs")
glob = require("./util/glob")
+pathHelpers = require("./util/path_helpers")
RUNNABLE_SEPARATOR = " -- "
-invalidCharsRe = /[^0-9a-zA-Z-_\s]/g
+pathSeparatorRe = /[\\\/]/g
+invalidCharsRe = /[^0-9a-zA-Z-_\s\(\)]/g
## internal id incrementor
__ID__ = null
@@ -24,6 +26,9 @@ __ID__ = null
Jimp.prototype.getBuffer = Promise.promisify(Jimp.prototype.getBuffer)
+replaceInvalidChars = (str) ->
+ str.replace(invalidCharsRe, "")
+
## when debugging logs automatically prefix the
## screenshot id to the debug logs for easier association
debug = _.wrap debug, (fn, str, args...) ->
@@ -228,9 +233,41 @@ getDimensions = (details) ->
else
_.pick(details.image.bitmap, "width", "height")
+ensureUniquePath = (takenPaths, withoutExt, extension) ->
+ fullPath = "#{withoutExt}.#{extension}"
+ num = 0
+ while _.includes(takenPaths, fullPath)
+ fullPath = "#{withoutExt} (#{++num}).#{extension}"
+ return fullPath
+
+getPath = (data, ext, screenshotsFolder) ->
+ specNames = (data.specName or "")
+ .split(pathSeparatorRe)
+
+ if data.name
+ names = data.name.split(pathSeparatorRe).map(replaceInvalidChars)
+ else
+ names = [data.titles.map(replaceInvalidChars).join(RUNNABLE_SEPARATOR)]
+
+ ## append (failed) to the last name
+ if data.testFailure
+ index = names.length - 1
+ names[index] = names[index] + " (failed)"
+
+ withoutExt = path.join(screenshotsFolder, specNames..., names...)
+
+ ensureUniquePath(data.takenPaths, withoutExt, ext)
+
+getPathToScreenshot = (data, details, screenshotsFolder) ->
+ ext = mime.extension(getType(details))
+
+ getPath(data, ext, screenshotsFolder)
+
module.exports = {
crop
+ getPath
+
clearMultipartState
copy: (src, dest) ->
@@ -305,13 +342,7 @@ module.exports = {
return { image, pixelRatio, multipart, takenAt }
save: (data, details, screenshotsFolder) ->
- type = getType(details)
-
- name = data.name ? data.titles.join(RUNNABLE_SEPARATOR)
- name = name.replace(invalidCharsRe, "")
- name = [name, mime.extension(type)].join(".")
-
- pathToScreenshot = path.join(screenshotsFolder, name)
+ pathToScreenshot = getPathToScreenshot(data, details, screenshotsFolder)
debug("save", pathToScreenshot)
@@ -330,6 +361,9 @@ module.exports = {
dimensions
multipart
pixelRatio
+ name: data.name
+ specName: data.specName
+ testFailure: data.testFailure
size: bytes(size, {unitSeparator: " "})
path: pathToScreenshot
}
diff --git a/packages/server/lib/socket.coffee b/packages/server/lib/socket.coffee
index 29311be92d93..5c335d34e584 100644
--- a/packages/server/lib/socket.coffee
+++ b/packages/server/lib/socket.coffee
@@ -67,6 +67,8 @@ class Socket
.catch ->
log("could not find test file that changed: #{filePath}")
+ ## TODO: clean this up by sending the spec object instead of
+ ## the url path
watchTestFileByPath: (config, originalFilePath, options) ->
## files are always sent as integration/foo_spec.js
## need to take into account integrationFolder may be different so
@@ -90,7 +92,7 @@ class Socket
@testFilePath = filePath
log("will watch test file path #{filePath}")
- preprocessor.getFile(filePath, config, options)
+ preprocessor.getFile(filePath, config)
## ignore errors b/c we're just setting up the watching. errors
## are handled by the spec controller
.catch ->
diff --git a/packages/server/lib/util/path_helpers.coffee b/packages/server/lib/util/path_helpers.coffee
index 06518b1ddb16..fd069386d740 100644
--- a/packages/server/lib/util/path_helpers.coffee
+++ b/packages/server/lib/util/path_helpers.coffee
@@ -31,23 +31,35 @@ getRealFolderPath = (folder) ->
fs.realpathAsync(folder)
+getRelativePathToSpec = (spec) ->
+ switch
+ ## if our file is an integration test
+ ## then figure out the absolute path
+ ## to it
+ when isIntegrationTestRe.test(spec)
+ ## strip off the integration part
+ path.relative("integration", spec)
+ else
+ spec
+
module.exports = {
checkIfResolveChangedRootFolder
getRealFolderPath
+ getRelativePathToSpec
+
getAbsolutePathToSpec: (spec, config) ->
switch
## if our file is an integration test
## then figure out the absolute path
## to it
when isIntegrationTestRe.test(spec)
- ## strip off the integration part
- spec = path.relative("integration", spec)
+ spec = getRelativePathToSpec(spec)
## now simply join this with our integrationFolder
## which makes it an absolute path
- spec = path.join(config.integrationFolder, spec)
+ path.join(config.integrationFolder, spec)
# ## commented out until we implement unit testing
# when isUnitTestRe.test(spec)
@@ -57,7 +69,7 @@ module.exports = {
# ## now simply resolve this with our unitFolder
# ## which makes it an absolute path
- # spec = path.resolve(config.unitFolder, spec)
+ # path.join(config.unitFolder, spec)
else
spec
diff --git a/packages/server/lib/util/specs.coffee b/packages/server/lib/util/specs.coffee
index 06f65d6fd3b4..fe0dc1613265 100644
--- a/packages/server/lib/util/specs.coffee
+++ b/packages/server/lib/util/specs.coffee
@@ -74,7 +74,7 @@ find = (config, specPattern) ->
{
name: relativePathFromIntegrationFolder(file)
- path: relativePathFromProjectRoot(file)
+ relative: relativePathFromProjectRoot(file)
absolute: file
}
diff --git a/packages/server/package.json b/packages/server/package.json
index 6f0fc93f0f1e..9b4ef33edb58 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -142,7 +142,6 @@
"p-queue": "^1.0.0",
"parse-domain": "2.0.0",
"pluralize": "^3.0.0",
- "pretty-error": "^2.1.0",
"progress": "^1.1.8",
"pumpify": "^1.4.0",
"ramda": "^0.24.0",
diff --git a/packages/server/test/e2e/domain_spec.coffee b/packages/server/test/e2e/domain_spec.coffee
index 01f388041073..da27b01ef614 100644
--- a/packages/server/test/e2e/domain_spec.coffee
+++ b/packages/server/test/e2e/domain_spec.coffee
@@ -14,8 +14,11 @@ describe "e2e domain", ->
})
it "passing", ->
+ ## run both domain specs back to back to ensure
+ ## that the internal server + project state is
+ ## reset each time we spawn the browser
e2e.exec(@, {
- spec: "domain_spec.coffee"
+ spec: "domain*"
config: "hosts={#{HOSTS}}"
snapshot: true
expectedExitCode: 0
diff --git a/packages/server/test/e2e/screenshot_nested_file_spec.coffee b/packages/server/test/e2e/screenshot_nested_file_spec.coffee
new file mode 100644
index 000000000000..0f1b010dfe06
--- /dev/null
+++ b/packages/server/test/e2e/screenshot_nested_file_spec.coffee
@@ -0,0 +1,11 @@
+e2e = require("../support/helpers/e2e")
+
+describe "e2e screenshot in nested spec", ->
+ e2e.setup()
+
+ it "passes", ->
+ e2e.exec(@, {
+ spec: "nested-1/nested-2/screenshot_nested_file_spec.coffee"
+ expectedExitCode: 0
+ snapshot: true
+ })
diff --git a/packages/server/test/e2e/screenshot_app_capture_spec.coffee b/packages/server/test/e2e/screenshot_viewport_capture_spec.coffee
similarity index 76%
rename from packages/server/test/e2e/screenshot_app_capture_spec.coffee
rename to packages/server/test/e2e/screenshot_viewport_capture_spec.coffee
index a640b1ac5dde..966d770e8b73 100644
--- a/packages/server/test/e2e/screenshot_app_capture_spec.coffee
+++ b/packages/server/test/e2e/screenshot_viewport_capture_spec.coffee
@@ -1,11 +1,11 @@
e2e = require("../support/helpers/e2e")
onServer = (app) ->
- app.get "/app", e2e.sendHtml("""
+ app.get "/viewport", e2e.sendHtml("""
Redacted
""")
-describe "e2e screenshot app capture", ->
+describe "e2e screenshot viewport capture", ->
e2e.setup({
servers: {
port: 3322
@@ -18,7 +18,7 @@ describe "e2e screenshot app capture", ->
## captures (namely that the runner UI is hidden)
e2e.exec(@, {
- spec: "screenshot_app_capture_spec.coffee"
+ spec: "screenshot_viewport_capture_spec.coffee"
expectedExitCode: 0
snapshot: true
})
diff --git a/packages/server/test/e2e/screenshots_spec.coffee b/packages/server/test/e2e/screenshots_spec.coffee
index 0db8bd117faa..9301d161a3e6 100644
--- a/packages/server/test/e2e/screenshots_spec.coffee
+++ b/packages/server/test/e2e/screenshots_spec.coffee
@@ -63,17 +63,23 @@ describe "e2e screenshots", ->
e2e.exec(@, {
spec: "screenshots_spec.coffee"
- expectedExitCode: 3
+ expectedExitCode: 4
snapshot: true
+ timeout: 180000
})
.then ->
- screenshot1 = path.join(e2ePath, "cypress", "screenshots", "black.png")
- screenshot2 = path.join(e2ePath, "cypress", "screenshots", "red.png")
- screenshot3 = path.join(e2ePath, "cypress", "screenshots", "foobarbaz.png")
- screenshot4 = path.join(e2ePath, "cypress", "screenshots", "taking screenshots -- generates pngs on failure.png")
- screenshot5 = path.join(e2ePath, "cypress", "screenshots", "taking screenshots -- before hooks -- empty test 1 -- before all hook.png")
- screenshot6 = path.join(e2ePath, "cypress", "screenshots", "taking screenshots -- each hooks -- empty test 2 -- before each hook.png")
- screenshot7 = path.join(e2ePath, "cypress", "screenshots", "taking screenshots -- each hooks -- empty test 2 -- after each hook.png")
+ screenshot = (paths...) ->
+ path.join(e2ePath, "cypress", "screenshots", "screenshots_spec.coffee", paths...)
+
+ screenshot1 = screenshot("black.png")
+ screenshot2 = screenshot("red.png")
+ screenshot3 = screenshot("foo", "bar", "baz.png")
+ screenshot4 = screenshot("taking screenshots -- generates pngs on failure (failed).png")
+ screenshot5 = screenshot("taking screenshots -- before hooks -- empty test 1 -- before all hook (failed).png")
+ screenshot6 = screenshot("taking screenshots -- each hooks -- empty test 2 -- before each hook (failed).png")
+ screenshot7 = screenshot("taking screenshots -- each hooks -- empty test 2 -- after each hook (failed).png")
+ screenshot8 = screenshot("taking screenshots -- ensures unique paths when theres a non-named screenshot and a failure.png")
+ screenshot9 = screenshot("taking screenshots -- ensures unique paths when theres a non-named screenshot and a failure (failed).png")
Promise.all([
fs.statAsync(screenshot1).get("size")
@@ -83,6 +89,8 @@ describe "e2e screenshots", ->
fs.statAsync(screenshot5).get("size")
fs.statAsync(screenshot6).get("size")
fs.statAsync(screenshot7).get("size")
+ fs.statAsync(screenshot8).get("size")
+ fs.statAsync(screenshot9).get("size")
])
.then (sizes) ->
## make sure all of the values are unique
diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee
index 0168f8b7edd7..eeadcc8df155 100644
--- a/packages/server/test/integration/http_requests_spec.coffee
+++ b/packages/server/test/integration/http_requests_spec.coffee
@@ -16,13 +16,14 @@ httpsServer = require("#{root}../https-proxy/test/helpers/https_server")
pkg = require("@packages/root")
config = require("#{root}lib/config")
Server = require("#{root}lib/server")
+Project = require("#{root}lib/project")
Watchers = require("#{root}lib/watchers")
errors = require("#{root}lib/errors")
files = require("#{root}lib/controllers/files")
preprocessor = require("#{root}lib/plugins/preprocessor")
-CacheBuster = require("#{root}lib/util/cache_buster")
fs = require("#{root}lib/util/fs")
glob = require("#{root}lib/util/glob")
+CacheBuster = require("#{root}lib/util/cache_buster")
Fixtures = require("#{root}test/support/helpers/fixtures")
## force supertest-session to use supertest-as-promised, hah
@@ -89,6 +90,8 @@ describe "Routes", ->
rp(options)
open = =>
+ project = Project("/path/to/project")
+
Promise.all([
## open our https server
httpsServer.start(8443),
@@ -96,7 +99,7 @@ describe "Routes", ->
## and open our cypress server
@server = Server(Watchers())
- @server.open(cfg)
+ @server.open(cfg, project)
.spread (port) =>
if initialUrl
@server._onDomainSet(initialUrl)
@@ -286,7 +289,6 @@ describe "Routes", ->
it "returns base json file path objects of only tests", ->
## this should omit any _fixture files, _support files and javascripts
-
glob(path.join(Fixtures.projectPath("todos"), "tests", "_fixtures", "**", "*"))
.then (files) =>
## make sure there are fixtures in here!
@@ -310,21 +312,21 @@ describe "Routes", ->
## remove the absolute path key
body.integration = _.map body.integration, (obj) ->
- _.pick(obj, "name", "path")
+ _.pick(obj, "name", "relative")
expect(res.body).to.deep.eq({
integration: [
{
name: "sub/sub_test.coffee"
- path: "tests/sub/sub_test.coffee"
+ relative: "tests/sub/sub_test.coffee"
}
{
name: "test1.js"
- path: "tests/test1.js"
+ relative: "tests/test1.js"
}
{
name: "test2.coffee"
- path: "tests/test2.coffee"
+ relative: "tests/test2.coffee"
}
]
})
@@ -348,33 +350,33 @@ describe "Routes", ->
## remove the absolute path key
body.integration = _.map body.integration, (obj) ->
- _.pick(obj, "name", "path")
+ _.pick(obj, "name", "relative")
expect(body).to.deep.eq({
integration: [
{
name: "bar.js"
- path: "cypress/integration/bar.js"
+ relative: "cypress/integration/bar.js"
}
{
name: "baz.js"
- path: "cypress/integration/baz.js"
+ relative: "cypress/integration/baz.js"
}
{
name: "dom.jsx"
- path: "cypress/integration/dom.jsx"
+ relative: "cypress/integration/dom.jsx"
}
{
name: "foo.coffee"
- path: "cypress/integration/foo.coffee"
+ relative: "cypress/integration/foo.coffee"
}
{
name: "nested/tmp.js"
- path: "cypress/integration/nested/tmp.js"
+ relative: "cypress/integration/nested/tmp.js"
}
{
name: "noop.coffee"
- path: "cypress/integration/noop.coffee"
+ relative: "cypress/integration/noop.coffee"
}
]
})
@@ -400,21 +402,21 @@ describe "Routes", ->
## remove the absolute path key
body.integration = _.map body.integration, (obj) ->
- _.pick(obj, "name", "path")
+ _.pick(obj, "name", "relative")
expect(body).to.deep.eq({
integration: [
{
name: "baz.js"
- path: "cypress/integration/baz.js"
+ relative: "cypress/integration/baz.js"
}
{
name: "dom.jsx"
- path: "cypress/integration/dom.jsx"
+ relative: "cypress/integration/dom.jsx"
}
{
name: "noop.coffee"
- path: "cypress/integration/noop.coffee"
+ relative: "cypress/integration/noop.coffee"
}
]
})
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_failing_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_failing_spec.coffee
index 8e8fc5fdd9ab..4f52150a642a 100644
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_failing_spec.coffee
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_failing_spec.coffee
@@ -5,11 +5,11 @@ describe "config", ->
## this test to bomb
it "times out looking for a missing element", ->
append = (id) ->
- el = Cypress.$("
#{id}")
+ $el = Cypress.$("#{id}")
setTimeout ->
## append the element after 2000ms
- Cypress.$("body").append(el)
+ Cypress.$("body").append($el)
, 2000
cy
@@ -27,4 +27,4 @@ describe "config", ->
.then ->
append("bar")
- .get("#bar") ## this should fail
\ No newline at end of file
+ .get("#bar") ## this should fail
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_passing_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_passing_spec.coffee
index d8db665c9fee..b098bfc0a9bc 100644
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_passing_spec.coffee
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/config_passing_spec.coffee
@@ -1,10 +1,28 @@
-describe "Cypress.config()", ->
- it "has Cypress.version set to a string", ->
+describe "Cypress static methods + props", ->
+ it ".version", ->
expect(Cypress.version).to.be.a("string")
- it "has os platform", ->
+ it ".platform", ->
expect(Cypress.platform).to.be.a("string")
expect(Cypress.platform).to.be.oneOf(["darwin", "linux", "win32"])
- it "has os architecture", ->
+ it ".arch", ->
expect(Cypress.arch).to.be.a("string")
+
+ it ".browser", ->
+ { browser } = Cypress
+
+ expect(browser).to.be.an("object")
+ expect(browser.name).to.be.oneOf(["electron", "chrome", "canary", "chromium"])
+ expect(browser.displayName).to.be.oneOf(["Electron", "Chrome", "Canary", "Chromium"])
+ expect(browser.version).to.be.a("string")
+ expect(browser.majorVersion).to.be.a("string")
+ expect(browser.path).to.be.a("string")
+
+ it ".spec", ->
+ { spec } = Cypress
+
+ expect(spec).to.be.an("object")
+ expect(spec.name).to.eq("config_passing_spec.coffee")
+ expect(spec.relative).to.eq("cypress/integration/config_passing_spec.coffee")
+ expect(spec.absolute.indexOf("cypress/integration/config_passing_spec.coffee")).to.be.gt(0)
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/domain_2_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/domain_2_spec.coffee
new file mode 100644
index 000000000000..9fb9aefd9ae3
--- /dev/null
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/domain_2_spec.coffee
@@ -0,0 +1,12 @@
+describe "localhost", ->
+ it "can visit", ->
+ cy.visit("http://app.localhost:4848")
+
+describe "com.au", ->
+ it "can visit", ->
+ cy.visit("http://foo.bar.baz.com.au:4848")
+
+describe "herokuapp.com", ->
+ it "can visit", ->
+ cy.visit("https://cypress-example.herokuapp.com")
+ cy.contains("Getting Started with Node on Heroku")
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/nested-1/nested-2/screenshot_nested_file_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/nested-1/nested-2/screenshot_nested_file_spec.coffee
new file mode 100644
index 000000000000..843447f0edaa
--- /dev/null
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/nested-1/nested-2/screenshot_nested_file_spec.coffee
@@ -0,0 +1,3 @@
+it "nests the file based on spec path", ->
+ cy.screenshot({ capture: "runner" })
+ cy.readFile("cypress/screenshots/nested-1/nested-2/screenshot_nested_file_spec.coffee/nests the file based on spec path.png", 'base64')
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_app_capture_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_app_capture_spec.coffee
deleted file mode 100644
index 88771dc034f4..000000000000
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_app_capture_spec.coffee
+++ /dev/null
@@ -1,18 +0,0 @@
-{ devicePixelRatio } = window
-
-it "takes consistent app captures", ->
- options = { capture: "viewport", blackout: [".black-me-out"] }
-
- cy
- .visit('http://localhost:3322/app')
- .screenshot("app-original", options)
- .then ->
- ## take 50 screenshots and check that they're all the same
- ## to ensure the Cypress UI is consistently hidden
- fn = ->
- cy.screenshot("app-compare", options)
- cy.task("compare:screenshots", { a: 'app-original', b: 'app-compare', blackout: true, devicePixelRatio })
-
- Cypress._.times(50, fn)
-
- return
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_element_capture_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_element_capture_spec.coffee
index 5d9a2f683e28..fa6c0d3e1169 100644
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_element_capture_spec.coffee
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_element_capture_spec.coffee
@@ -3,7 +3,7 @@
it "takes consistent element captures", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/element')
+ .visit("http://localhost:3322/element")
.get(".capture-me")
.screenshot("element-original")
.then ->
@@ -11,7 +11,10 @@ it "takes consistent element captures", ->
## to ensure element screenshots are consistent
fn = (index) ->
cy.get(".capture-me").screenshot("element-compare")
- cy.task("compare:screenshots", { a: 'element-original', b: 'element-compare', devicePixelRatio })
+ cy.task("compare:screenshots", {
+ a: "screenshot_element_capture_spec.coffee/element-original",
+ b: "screenshot_element_capture_spec.coffee/element-compare", devicePixelRatio
+ })
Cypress._.times(10, fn)
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_fullpage_capture_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_fullpage_capture_spec.coffee
index 81e56ac9b6a3..6daeafcf19c1 100644
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_fullpage_capture_spec.coffee
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_fullpage_capture_spec.coffee
@@ -5,14 +5,19 @@ it "takes consistent fullPage captures", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/fullPage')
+ .visit("http://localhost:3322/fullPage")
.screenshot("fullPage-original", options)
.then ->
## take 10 screenshots and check that they're all the same
## to ensure fullPage screenshots are consistent
fn = (index) ->
cy.screenshot("fullPage-compare", options)
- cy.task("compare:screenshots", { a: 'fullPage-original', b: 'fullPage-compare', blackout: true, devicePixelRatio })
+ cy.task("compare:screenshots", {
+ a: "screenshot_fullpage_capture_spec.coffee/fullPage-original",
+ b: "screenshot_fullpage_capture_spec.coffee/fullPage-compare",
+ blackout: true,
+ devicePixelRatio
+ })
Cypress._.times(10, fn)
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_viewport_capture_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_viewport_capture_spec.coffee
new file mode 100644
index 000000000000..9c70adf23cc2
--- /dev/null
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshot_viewport_capture_spec.coffee
@@ -0,0 +1,23 @@
+{ devicePixelRatio } = window
+
+it "takes consistent viewport captures", ->
+ options = { capture: "viewport", blackout: [".black-me-out"] }
+
+ cy
+ .visit("http://localhost:3322/viewport")
+ .screenshot("viewport-original", options)
+ .then ->
+ ## take 25 screenshots and check that they're all the same
+ ## to ensure the Cypress UI is consistently hidden
+ fn = ->
+ cy.screenshot("viewport-compare", options)
+ cy.task("compare:screenshots", {
+ a: "screenshot_viewport_capture_spec.coffee/viewport-original",
+ b: "screenshot_viewport_capture_spec.coffee/viewport-compare",
+ blackout: true,
+ devicePixelRatio
+ })
+
+ Cypress._.times(25, fn)
+
+ return
diff --git a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshots_spec.coffee b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshots_spec.coffee
index de8a9de263aa..203bf4760c16 100644
--- a/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshots_spec.coffee
+++ b/packages/server/test/support/fixtures/projects/e2e/cypress/integration/screenshots_spec.coffee
@@ -3,20 +3,20 @@
describe "taking screenshots", ->
it "manually generates pngs", ->
cy
- .visit('http://localhost:3322/color/black')
+ .visit("http://localhost:3322/color/black")
.screenshot("black", { capture: "runner" })
.wait(1500)
- .visit('http://localhost:3322/color/red')
+ .visit("http://localhost:3322/color/red")
.screenshot("red", { capture: "runner" })
it "can nest screenshots in folders", ->
cy
- .visit('http://localhost:3322/color/white')
+ .visit("http://localhost:3322/color/white")
.screenshot("foo/bar/baz", { capture: "runner" })
it "generates pngs on failure", ->
cy
- .visit('http://localhost:3322/color/yellow')
+ .visit("http://localhost:3322/color/yellow")
.wait(1500)
.then ->
## failure 1
@@ -33,54 +33,74 @@ describe "taking screenshots", ->
devicePixelRatio
coords: [1, 0]
color: [255, 255, 255] ## white
- name: "color-check"
+ name: "screenshots_spec.coffee/color-check"
})
.task("ensure:pixel:color", {
devicePixelRatio
coords: [0, 1]
color: [255, 255, 255] ## white
- name: "color-check"
+ name: "screenshots_spec.coffee/color-check"
})
it "crops app captures to just app size", ->
cy
.viewport(600, 400)
- .visit('http://localhost:3322/color/yellow')
+ .visit("http://localhost:3322/color/yellow")
.screenshot("crop-check", { capture: "viewport" })
- .task("check:screenshot:size", { name: 'crop-check.png', width: 600, height: 400, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/crop-check.png",
+ width: 600,
+ height: 400,
+ devicePixelRatio
+ })
it "can capture fullPage screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/fullPage')
+ .visit("http://localhost:3322/fullPage")
.screenshot("fullPage", { capture: "fullPage" })
- .task("check:screenshot:size", { name: 'fullPage.png', width: 600, height: 500, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/fullPage.png",
+ width: 600,
+ height: 500,
+ devicePixelRatio
+ })
it "accepts subsequent same captures after multiple tries", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/fullPage-same')
+ .visit("http://localhost:3322/fullPage-same")
.screenshot("fullPage-same", { capture: "fullPage" })
- .task("check:screenshot:size", { name: 'fullPage-same.png', width: 600, height: 500, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/fullPage-same.png",
+ width: 600,
+ height: 500,
+ devicePixelRatio
+ })
it "accepts screenshot after multiple tries if somehow app has pixels that match helper pixels", ->
cy
.viewport(1280, 720)
- .visit('http://localhost:3322/pathological')
+ .visit("http://localhost:3322/pathological")
.screenshot("pathological", { capture: "viewport" })
it "can capture element screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/element')
+ .visit("http://localhost:3322/element")
.get(".element")
.screenshot("element")
- .task("check:screenshot:size", { name: 'element.png', width: 400, height: 300, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/element.png",
+ width: 400,
+ height: 300,
+ devicePixelRatio
+ })
it "retries each screenshot for up to 1500ms", ->
cy
.viewport(400, 400)
- .visit('http://localhost:3322/identical')
+ .visit("http://localhost:3322/identical")
.screenshot({
onAfterScreenshot: ($el, results) ->
{ duration } = results
@@ -97,35 +117,67 @@ describe "taking screenshots", ->
expect(duration).to.be.within(total, total + padding)
})
+ it "ensures unique paths for non-named screenshots", ->
+ cy.screenshot({ capture: "runner" })
+ cy.screenshot({ capture: "runner" })
+ cy.screenshot({ capture: "runner" })
+ cy.readFile("cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots.png", "base64")
+ cy.readFile("cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots (1).png", "base64")
+ cy.readFile("cypress/screenshots/screenshots_spec.coffee/taking screenshots -- ensures unique paths for non-named screenshots (2).png", "base64")
+
+ it "ensures unique paths when there's a non-named screenshot and a failure", ->
+ cy.screenshot({ capture: "viewport" }).then ->
+ throw new Error("failing on purpose")
+
describe "clipping", ->
it "can clip app screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/color/yellow')
+ .visit("http://localhost:3322/color/yellow")
.screenshot("app-clip", { capture: "viewport", clip: { x: 10, y: 10, width: 100, height: 50 }})
- .task("check:screenshot:size", { name: 'app-clip.png', width: 100, height: 50, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/app-clip.png",
+ width: 100,
+ height: 50,
+ devicePixelRatio
+ })
it "can clip runner screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/color/yellow')
+ .visit("http://localhost:3322/color/yellow")
.screenshot("runner-clip", { capture: "runner", clip: { x: 15, y: 15, width: 120, height: 60 }})
- .task("check:screenshot:size", { name: 'runner-clip.png', width: 120, height: 60, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/runner-clip.png",
+ width: 120,
+ height: 60,
+ devicePixelRatio
+ })
it "can clip fullPage screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/fullPage')
+ .visit("http://localhost:3322/fullPage")
.screenshot("fullPage-clip", { capture: "fullPage", clip: { x: 20, y: 20, width: 140, height: 70 }})
- .task("check:screenshot:size", { name: 'fullPage-clip.png', width: 140, height: 70, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/fullPage-clip.png",
+ width: 140,
+ height: 70,
+ devicePixelRatio
+ })
it "can clip element screenshots", ->
cy
.viewport(600, 200)
- .visit('http://localhost:3322/element')
+ .visit("http://localhost:3322/element")
.get(".element")
.screenshot("element-clip", { clip: { x: 25, y: 25, width: 160, height: 80 }})
- .task("check:screenshot:size", { name: 'element-clip.png', width: 160, height: 80, devicePixelRatio })
+ .task("check:screenshot:size", {
+ name: "screenshots_spec.coffee/element-clip.png",
+ width: 160,
+ height: 80,
+ devicePixelRatio
+ })
context "before hooks", ->
before ->
diff --git a/packages/server/test/support/fixtures/server/expected_stdout_failures_outro.txt b/packages/server/test/support/fixtures/server/expected_stdout_failures_outro.txt
index 6d6476e2c654..bdd0b698ffd7 100644
--- a/packages/server/test/support/fixtures/server/expected_stdout_failures_outro.txt
+++ b/packages/server/test/support/fixtures/server/expected_stdout_failures_outro.txt
@@ -12,9 +12,9 @@
(Screenshots)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- fails.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- failing hook -- is failing.png (1280x720)
- - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- passing hook -- is failing.png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- fails (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- failing hook -- is failing (failed).png (1280x720)
+ - /foo/bar/.projects/e2e/cypress/screenshots/stdout_failing_spec -- passing hook -- is failing (failed).png (1280x720)
(Video)
diff --git a/packages/server/test/support/helpers/e2e.coffee b/packages/server/test/support/helpers/e2e.coffee
index 847daaaa5f1f..2554576d7d1d 100644
--- a/packages/server/test/support/helpers/e2e.coffee
+++ b/packages/server/test/support/helpers/e2e.coffee
@@ -48,7 +48,7 @@ replaceBrowserName = (str, p1, p2, p3, p4) ->
replaceDurationSeconds = (str, p1, p2, p3, p4) ->
## get the padding for the existing duration
- lengthOfExistingDuration = _.sum([p2.length, p3.length, p4.length])
+ lengthOfExistingDuration = _.sum([p2?.length or 0, p3.length, p4.length])
p1 + _.padEnd("X seconds", lengthOfExistingDuration)
@@ -65,13 +65,13 @@ normalizeStdout = (str) ->
.join("/foo/bar/.projects")
.replace(availableBrowsersRe, "$1browser1, browser2, browser3")
.replace(browserNameVersionRe, replaceBrowserName)
- .replace(/\s\(\d+m?s\)/g, "") ## numbers in parenths
+ .replace(/\s\(\d+([ms]|ms)\)/g, "") ## numbers in parenths
.replace(/(\s+?)(\d+ms|\d+:\d+:?\d+)/g, replaceDurationInTables) ## durations in tables
.replace(/(coffee|js)-\d{3}/g, "$1-456")
.replace(/(.+)(\/.+\.mp4)/g, "$1/abc123.mp4") ## replace dynamic video names
.replace(/(Cypress\:\s+)(\d\.\d\.\d)/g, "$1" + "1.2.3") ## replace Cypress: 2.1.0
- .replace(/(Duration\:\s+)(\d+)(\sseconds?)(\s+)/g, replaceDurationSeconds)
- .replace(/\(\d+ seconds?\)/g, "(X seconds)")
+ .replace(/(Duration\:\s+)(\d+\sminutes?,\s+)?(\d+\sseconds?)(\s+)/g, replaceDurationSeconds)
+ .replace(/\((\d+ minutes?,\s+)?\d+ seconds?\)/g, "(X seconds)")
.replace(/\r/g, "")
.replace("/\(\d{2,4}x\d{2,4}\)/g", "(YYYYxZZZZ)") ## screenshot dimensions
.split("\n")
@@ -335,7 +335,7 @@ module.exports = {
.defaults({
## prevent any Compression progress
## messages from showing up
- VIDEO_COMPRESSION_THROTTLE: 20000
+ VIDEO_COMPRESSION_THROTTLE: 120000
## don't fail our own tests running from forked PR's
CYPRESS_INTERNAL_E2E_TESTS: "1"
diff --git a/packages/server/test/unit/modes/record_spec.coffee b/packages/server/test/unit/modes/record_spec.coffee
index bdd51fe52a50..7c4718d7031f 100644
--- a/packages/server/test/unit/modes/record_spec.coffee
+++ b/packages/server/test/unit/modes/record_spec.coffee
@@ -62,8 +62,8 @@ describe "lib/modes/record", ->
context ".createRunAndRecordSpecs", ->
specs = [
- { path: "path/to/spec/a" },
- { path: "path/to/spec/b" }
+ { relative: "path/to/spec/a" },
+ { relative: "path/to/spec/b" }
]
beforeEach ->
@@ -187,7 +187,7 @@ describe "lib/modes/record", ->
groupId: "group-123"
machineId: "machine-123"
platform: {}
- spec: { path: "cypress/integration/app_spec.coffee" }
+ spec: { relative: "cypress/integration/app_spec.coffee" }
})
.then ->
expect(api.createInstance).to.be.calledWith({
@@ -211,7 +211,7 @@ describe "lib/modes/record", ->
groupId: "group-123"
machineId: "machine-123"
platform: {}
- spec: { path: "cypress/integration/app_spec.coffee" }
+ spec: { relative: "cypress/integration/app_spec.coffee" }
})
.then (ret) ->
expect(ret).to.be.null
diff --git a/packages/server/test/unit/modes/run_spec.coffee b/packages/server/test/unit/modes/run_spec.coffee
index d34eb80109be..f7b52448bddc 100644
--- a/packages/server/test/unit/modes/run_spec.coffee
+++ b/packages/server/test/unit/modes/run_spec.coffee
@@ -138,20 +138,22 @@ describe "lib/modes/run", ->
it "can launch electron", ->
screenshots = []
+ spec = {
+ absolute: "/path/to/spec"
+ }
+
runMode.launchBrowser({
+ spec
browserName: "electron"
project: @projectInstance
write: "write"
gui: null
screenshots: screenshots
- spec: {
- absolute: "/path/to/spec"
- }
})
expect(runMode.getElectronProps).to.be.calledWith(false, @projectInstance, "write")
- expect(@launch).to.be.calledWithMatch("electron", "/path/to/spec", {foo: "bar"})
+ expect(@launch).to.be.calledWithMatch("electron", spec, {foo: "bar"})
browserOpts = @launch.firstCall.args[2]
@@ -165,16 +167,18 @@ describe "lib/modes/run", ->
expect(screenshots).to.deep.eq([{a: "a"}])
it "can launch chrome", ->
+ spec = {
+ absolute: "/path/to/spec"
+ }
+
runMode.launchBrowser({
+ spec
browserName: "chrome"
- spec: {
- absolute: "/path/to/spec"
- }
})
expect(runMode.getElectronProps).not.to.be.called
- expect(@launch).to.be.calledWithMatch("chrome", "/path/to/spec", {})
+ expect(@launch).to.be.calledWithMatch("chrome", spec, {})
context ".postProcessRecording", ->
beforeEach ->
@@ -586,7 +590,11 @@ describe "lib/modes/run", ->
.then ->
expect(openProject.launch).to.be.calledWithMatch(
"electron",
- "path/to/spec.js",
+ {
+ name: "foo_spec.js"
+ path: "cypress/integration/foo_spec.js"
+ absolute: "/path/to/spec.js"
+ },
{
show: true
}
diff --git a/packages/server/test/unit/open_project_spec.coffee b/packages/server/test/unit/open_project_spec.coffee
index 98a637ec944b..3efbd763d424 100644
--- a/packages/server/test/unit/open_project_spec.coffee
+++ b/packages/server/test/unit/open_project_spec.coffee
@@ -9,6 +9,7 @@ describe "lib/open_project", ->
beforeEach ->
@automation = {
reset: sinon.stub()
+ use: sinon.stub()
}
sinon.stub(browsers, "get").resolves()
@@ -23,14 +24,19 @@ describe "lib/open_project", ->
openProject.create("/project/root")
context "#launch", ->
+ beforeEach ->
+ @spec = {
+ absolute: "path/to/spec"
+ }
+
it "tells preprocessor to remove file on browser close", ->
- openProject.launch("chrome", "path/to/spec")
+ openProject.launch("chrome", @spec)
.then ->
browsers.open.lastCall.args[1].onBrowserClose()
expect(preprocessor.removeFile).to.be.calledWith("path/to/spec")
it "does not tell preprocessor to remove file if no spec", ->
- openProject.launch("chrome")
+ openProject.launch("chrome", {})
.then ->
browsers.open.lastCall.args[1].onBrowserClose()
expect(preprocessor.removeFile).not.to.be.called
@@ -38,12 +44,12 @@ describe "lib/open_project", ->
it "runs original onBrowserClose callback on browser close", ->
onBrowserClose = sinon.stub()
options = { onBrowserClose }
- openProject.launch("chrome", "path/to/spec", options)
+ openProject.launch("chrome", @spec, options)
.then ->
browsers.open.lastCall.args[1].onBrowserClose()
expect(onBrowserClose).to.be.called
it "calls project.reset on launch", ->
- openProject.launch("chrome")
+ openProject.launch("chrome", @spec)
.then ->
expect(Project.prototype.reset).to.be.called
diff --git a/packages/server/test/unit/plugins/preprocessor_spec.coffee b/packages/server/test/unit/plugins/preprocessor_spec.coffee
index 2a25cf30cf1a..a5d83657a6b5 100644
--- a/packages/server/test/unit/plugins/preprocessor_spec.coffee
+++ b/packages/server/test/unit/plugins/preprocessor_spec.coffee
@@ -15,7 +15,7 @@ describe "lib/plugins/preprocessor", ->
Fixtures.scaffold()
@todosPath = Fixtures.projectPath("todos")
- @filePath = "/path/to/test.coffee"
+ @filePath = "path/to/test.coffee"
@fullFilePath = path.join(@todosPath, @filePath)
@integrationFolder = '/integration-path/'
diff --git a/packages/server/test/unit/screenshots_spec.coffee b/packages/server/test/unit/screenshots_spec.coffee
index cf01e3a4b378..63242d4caa93 100644
--- a/packages/server/test/unit/screenshots_spec.coffee
+++ b/packages/server/test/unit/screenshots_spec.coffee
@@ -295,9 +295,9 @@ describe "lib/screenshots", ->
takenAt: "taken:at:date"
}
- screenshots.save({name: "foo/tweet"}, details, @config.screenshotsFolder)
+ screenshots.save({name: "foo bar\\baz%/my-$screenshot"}, details, @config.screenshotsFolder)
.then (result) =>
- expectedPath = path.normalize(@config.screenshotsFolder + "/footweet.png")
+ expectedPath = path.join(@config.screenshotsFolder, "foo bar", "baz", "my-screenshot.png")
actualPath = path.normalize(result.path)
expect(actualPath).to.eq(expectedPath)
@@ -314,17 +314,35 @@ describe "lib/screenshots", ->
multipart: false
pixelRatio: 1
buffer: dataUriToBuffer(image)
+ takenAt: "1234-date"
}
+
dimensions = sizeOf(details.buffer)
- screenshots.save({name: "bar/tweet"}, details, @config.screenshotsFolder)
+ screenshots.save(
+ { name: "with-buffer", specName: "foo.spec.js", testFailure: false },
+ details,
+ @config.screenshotsFolder
+ )
.then (result) =>
- expectedPath = path.normalize(@config.screenshotsFolder + "/bartweet.png")
+ expectedPath = path.join(
+ @config.screenshotsFolder, "foo.spec.js", "with-buffer.png"
+ )
+
actualPath = path.normalize(result.path)
-
- expect(result.multipart).to.be.false
- expect(result.pixelRatio).to.equal(1)
- expect(actualPath).to.eq(expectedPath)
- expect(result.dimensions).to.eql(dimensions)
+
+ expect(result).to.deep.eq({
+ dimensions
+ name: "with-buffer"
+ multipart: false
+ pixelRatio: 1
+ path: path.normalize(result.path)
+ size: "279 B"
+ specName: "foo.spec.js"
+ testFailure: false
+ takenAt: "1234-date"
+ })
+
+ expect(expectedPath).to.eq(actualPath)
fs.statAsync(expectedPath)
@@ -337,6 +355,51 @@ describe "lib/screenshots", ->
screenshots.copy("foo", "bar")
+ context ".getPath", ->
+ it "concats spec name, screenshotsFolder, and name", ->
+ p = screenshots.getPath({
+ specName: "examples$/user/list.js"
+ titles: ["bar", "baz"]
+ name: "quux/lorem*"
+ }, "png", "path/to/screenshots")
+
+ expect(p).to.eq(
+ "path/to/screenshots/examples$/user/list.js/quux/lorem.png"
+ )
+
+ p2 = screenshots.getPath({
+ specName: "examples$/user/list.js"
+ titles: ["bar", "baz"]
+ name: "quux*"
+ takenPaths: ["path/to/screenshots/examples$/user/list.js/quux.png"]
+ }, "png", "path/to/screenshots")
+
+ expect(p2).to.eq(
+ "path/to/screenshots/examples$/user/list.js/quux (1).png"
+ )
+
+ it "concats spec name, screenshotsFolder, and titles", ->
+ p = screenshots.getPath({
+ specName: "examples$/user/list.js"
+ titles: ["bar", "baz^"]
+ takenPaths: ["a"]
+ testFailure: true
+ }, "png", "path/to/screenshots")
+
+ expect(p).to.eq(
+ "path/to/screenshots/examples$/user/list.js/bar -- baz (failed).png"
+ )
+
+ p2 = screenshots.getPath({
+ specName: "examples$/user/list.js"
+ titles: ["bar", "baz^"]
+ takenPaths: ["path/to/screenshots/examples$/user/list.js/bar -- baz.png"]
+ }, "png", "path/to/screenshots")
+
+ expect(p2).to.eq(
+ "path/to/screenshots/examples$/user/list.js/bar -- baz (1).png"
+ )
+
describe "lib/automation/screenshot", ->
beforeEach ->
@image = {}