-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change replaces the error with a warning when cypress is executing tests in a readonly fs.
- Loading branch information
Fabian Wiles
authored and
Daniel Muller
committed
May 9, 2020
1 parent
d284269
commit 8f6d58d
Showing
5 changed files
with
248 additions
and
1 deletion.
There are no files selected for viewing
169 changes: 169 additions & 0 deletions
169
packages/server/__snapshots__/8_read_only_fs_spec.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
exports['e2e project dir access / warns when unable to write to dir'] = ` | ||
Folder /foo/bar/.projects/e2e is not writable. | ||
Writing to this directory is required by Cypress in order to store screenshots and videos. | ||
Enable write permissions to this directory to ensure screenshots and videos are stored. | ||
If you don't require screenshots or videos to be stored you can safely ignore this warning. | ||
==================================================================================================== | ||
(Run Starting) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (simple_spec.coffee) │ | ||
│ Searched: cypress/integration/simple_spec.coffee │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
Running: simple_spec.coffee (1 of 1) | ||
✓ is true | ||
1 passing | ||
(Results) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 1 │ | ||
│ Passing: 1 │ | ||
│ Failing: 0 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: simple_spec.coffee │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
Warning: We failed to record the video. | ||
This error will not alter the exit code. | ||
Error: ffmpeg exited with code 1: /foo/bar/.projects/e2e/cypress/videos/simple_spec.coffee.mp4: Permission denied | ||
[stack trace lines] | ||
Warning: We failed processing this video. | ||
This error will not alter the exit code. | ||
Error: ffmpeg exited with code 1: /foo/bar/.projects/e2e/cypress/videos/simple_spec.coffee.mp4: Permission denied | ||
[stack trace lines] | ||
==================================================================================================== | ||
(Run Finished) | ||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✔ simple_spec.coffee XX:XX 1 1 - - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✔ All specs passed! XX:XX 1 1 - - - | ||
` | ||
|
||
exports['e2e project dir access / warns when unable to write a screenshot to disk'] = ` | ||
Folder /foo/bar/.projects/e2e is not writable. | ||
Writing to this directory is required by Cypress in order to store screenshots and videos. | ||
Enable write permissions to this directory to ensure screenshots and videos are stored. | ||
If you don't require screenshots or videos to be stored you can safely ignore this warning. | ||
==================================================================================================== | ||
(Run Starting) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (simple_failing_spec.coffee) │ | ||
│ Searched: cypress/integration/simple_failing_spec.coffee │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
Running: simple_failing_spec.coffee (1 of 1) | ||
simple failing spec | ||
1) fails1 | ||
2) fails2 | ||
0 passing | ||
2 failing | ||
1) simple failing spec | ||
fails1: | ||
Error: EACCES: permission denied, mkdir '/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_spec.coffee' | ||
2) simple failing spec | ||
fails2: | ||
Error: EACCES: permission denied, mkdir '/foo/bar/.projects/e2e/cypress/screenshots/simple_failing_spec.coffee' | ||
(Results) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 2 │ | ||
│ Passing: 0 │ | ||
│ Failing: 2 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: simple_failing_spec.coffee │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
Warning: We failed to record the video. | ||
This error will not alter the exit code. | ||
Error: ffmpeg exited with code 1: /foo/bar/.projects/e2e/cypress/videos/simple_failing_spec.coffee.mp4: Permission denied | ||
[stack trace lines] | ||
Warning: We failed processing this video. | ||
This error will not alter the exit code. | ||
Error: ffmpeg exited with code 1: /foo/bar/.projects/e2e/cypress/videos/simple_failing_spec.coffee.mp4: Permission denied | ||
[stack trace lines] | ||
==================================================================================================== | ||
(Run Finished) | ||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✖ simple_failing_spec.coffee XX:XX 2 - 2 - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✖ 1 of 1 failed (100%) XX:XX 2 - 2 - - | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const e2e = require('../support/helpers/e2e') | ||
const Fixtures = require('../support/helpers/fixtures') | ||
const path = require('path') | ||
import * as fs from 'fs' | ||
|
||
describe('e2e project dir access', function () { | ||
e2e.setup() | ||
|
||
const projectPath = Fixtures.projectPath('e2e') // copied from `test/support/fixtures/projects/e2e` | ||
|
||
const chmodr = (p: string, mode: number) => { | ||
const stats = fs.statSync(p) | ||
|
||
fs.chmodSync(p, mode) | ||
if (stats.isDirectory()) { | ||
fs.readdirSync(p).forEach((child) => { | ||
chmodr(path.join(p, child), mode) | ||
}) | ||
} | ||
} | ||
|
||
const onRun = (exec) => { | ||
// Manually create these directories to prevent cypress crashing. | ||
fs.mkdirSync(path.join(projectPath, 'cypress', 'videos')) | ||
fs.mkdirSync(path.join(projectPath, 'cypress', 'screenshots')) | ||
|
||
chmodr(projectPath, 0o500) | ||
|
||
// test that we setup the folder structure correctly | ||
let err: any | ||
|
||
try { | ||
fs.accessSync(projectPath, fs.constants.W_OK) | ||
} catch (e) { | ||
err = e | ||
} | ||
expect(err).to.include({ code: 'EACCES' }) | ||
|
||
return exec().finally(() => { | ||
chmodr(projectPath, 0o777) | ||
}) | ||
} | ||
|
||
e2e.it('warns when unable to write to dir', { | ||
project: projectPath, | ||
browser: 'chrome', | ||
expectedExitCode: 0, | ||
spec: 'simple_spec.coffee', | ||
snapshot: true, | ||
onRun, | ||
}) | ||
|
||
e2e.it('warns when unable to write a screenshot to disk', { | ||
project: projectPath, | ||
browser: 'chrome', | ||
expectedExitCode: 2, | ||
spec: 'simple_failing_spec.coffee', | ||
snapshot: true, | ||
onRun, | ||
}) | ||
}) |
5 changes: 5 additions & 0 deletions
5
packages/server/test/support/fixtures/projects/e2e/cypress/integration/readonly_fs_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('simple specs', () => { | ||
it('should pass', () => { | ||
|
||
}) | ||
}) |