forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4_controllers_spec.js
40 lines (33 loc) · 1.24 KB
/
4_controllers_spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const fs = require('fs-extra')
const path = require('path')
const e2e = require('../support/helpers/e2e').default
const Fixtures = require('../support/helpers/fixtures')
const nonExistentSpec = Fixtures.projectPath('non-existent-spec')
const e2eProject = Fixtures.projectPath('e2e')
describe('e2e plugins', () => {
e2e.setup()
it('fails when spec does not exist', function () {
return e2e.exec(this, {
spec: 'spec.js',
project: nonExistentSpec,
sanitizeScreenshotDimensions: true,
snapshot: true,
expectedExitCode: 1,
})
})
it('handles specs with $, &, and + in file name', function () {
const relativeSpecPath = path.join('dir&1%', '%dir2&', 's%p+ec&.js')
const specPath = path.join(e2eProject, 'cypress', 'integration', relativeSpecPath)
return fs.outputFile(specPath, 'it(\'passes\', () => {})')
.then(() => {
return e2e.exec(this, {
spec: specPath,
sanitizeScreenshotDimensions: true,
})
}).then(({ stdout }) => {
expect(stdout).to.include(`1 found (${relativeSpecPath})`)
expect(stdout).to.include(`Running: ${relativeSpecPath}`)
expect(stdout).to.include(`Finished processing: /XXX/XXX/XXX/cypress/videos/${relativeSpecPath}.mp4`)
})
})
})