You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the root directory of a Cypress project is read-only, then Cypress outputs a warning that the folder is not writeable, even when the screenshots and videos folders are located outside of the project and are writable. The warning is:
This folder is not writable: <Location of Cypress project>
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.
Alternatively, if the root directory of the Cypress project is writeable, the cypress directory is read-only, the screenshotsFolder and the videosFolder use default locations and video is enabled, then there is no warning message, only EACCES failure messages when trying to capture video and save screenshots.
So, in summary, the check produces warnings when it shouldn't (false positive), and neglects to warn when it should do (false negative).
The issue is also relevant for Docker usage when Docker is run as a non-root user.
Desired behavior
There should be no warning requiring that the root directory of a Cypress project should be writable if Cypress is configured so that screenshots and videos can be written.
Cypress should check the locations of the screenshotsFolder and the videosFolder (if video is enabled) and only output a warning if these locations are read-only. It should not be a requirement for the root of the Cypress project to be writeable.
In this situation the test directory is mounted using GitHub Actions' 1001runner user. The Cypress Docker image however needs the built-in node user in order to run, and it has no write access to the files of the runner user.
Standalone
mkdir cy-read-only
cd cy-read-only
git init
npm init -y
npm install cypress
npx cypress open
Scaffold a single default E2E test spec. Change spec.cy.js to add a screenshot capture:
First reported on Cypress version: 13.17.0
Continues to be reproducible on version: 14.0.1
Node version
v22.12.0 LTSv22.13.1 LTS
Operating System
Ubuntu 24.04.1 LTS
Debug Logs
The logs show Cypress first warning that it can't capture screenshots and videos, and then contradicting this information by capturing both screenshots and videos to /tmp.
$ npx cypress run
DevTools listening on ws://127.0.0.1:38899/devtools/browser/73418185-d301-4725-aa05-22e0e44837dd
This folder is not writable: /home/mike/github/cy-read-only
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: 13.17.0 │
│ Browser: Electron 118 (headless) │
│ Node Version: v22.12.0 (/home/mike/.nvm/versions/node/v22.12.0/bin/node) │
│ Specs: 1 found (spec.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: spec.cy.js (1 of 1)
template spec
✓ passes (2878ms)
1 passing (4s)
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 1 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: true │
│ Duration: 4 seconds │
│ Spec Ran: spec.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Screenshots)
- /tmp/cypress/screenshots/spec.cy.js/template spec -- passes.png (1000x4885)
(Video)
- Video output: /tmp/cypress/videos/spec.cy.js.mp4
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ spec.cy.js 00:04 1 1 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 00:04 1 1 - - -
Other
No response
The text was updated successfully, but these errors were encountered:
Source code inspection confirms that Cypress indeed is only checking the projectRoot for write access. This means by implication that Cypress incorrectly assumes that screenshotsFolder and videosFolder are using their default location of cypress/screenshots and cypress/videos, although the locations are configurable and are not tied to being within the project root's directory tree.
Current behavior
If the root directory of a Cypress project is read-only, then Cypress outputs a warning that the folder is not writeable, even when the screenshots and videos folders are located outside of the project and are writable. The warning is:
Alternatively, if the root directory of the Cypress project is writeable, the
cypress
directory is read-only, thescreenshotsFolder
and thevideosFolder
use default locations andvideo
is enabled, then there is no warning message, onlyEACCES
failure messages when trying to capture video and save screenshots.So, in summary, the check produces warnings when it shouldn't (false positive), and neglects to warn when it should do (false negative).
The issue is also relevant for Docker usage when Docker is run as a non-root user.
Desired behavior
There should be no warning requiring that the root directory of a Cypress project should be writable if Cypress is configured so that screenshots and videos can be written.
Cypress should check the locations of the
screenshotsFolder
and thevideosFolder
(ifvideo
is enabled) and only output a warning if these locations are read-only. It should not be a requirement for the root of the Cypress project to be writeable.Test code to reproduce
GitHub Actions
Run the following example from https://github.com/cypress-io/cypress-docker-images in a GitHub Actions workflow:
This example is available in https://github.com/cypress-io/cypress-docker-images/actions/workflows/example-tests.yml
In this situation the
test
directory is mounted using GitHub Actions'1001
runner
user. The Cypress Docker image however needs the built-innode
user in order to run, and it has no write access to the files of therunner
user.Standalone
mkdir cy-read-only cd cy-read-only git init npm init -y npm install cypress npx cypress open
Scaffold a single default E2E test spec. Change
spec.cy.js
to add a screenshot capture:Replace
cypress.config.js
with the following to move volatile directories to/tmp
and to enablevideo
:Cypress Version
First reported on Cypress version:
13.17.0
Continues to be reproducible on version:
14.0.1
Node version
v22.12.0
LTSv22.13.1
LTSOperating System
Ubuntu
24.04.1
LTSDebug Logs
The logs show Cypress first warning that it can't capture screenshots and videos, and then contradicting this information by capturing both screenshots and videos to
/tmp
.Other
No response
The text was updated successfully, but these errors were encountered: