cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.98k stars 3.18k forks source link

12.17.0 new appdata folder can't be configured #27239

Open CSchulz opened 1 year ago

CSchulz commented 1 year ago

Description

When I start Cypress@12.17.0, I expected existing folders are reused but another unknown folder is used instead.

URL of Issue(s)

None

Steps to replicate

  1. Start Cypress@12.17.0 with an user having a different user path and deny write access on the default profile folder .config.

Browser

No response

Device

Additional Information

The home folder of our jenkins user is /var/lib/jenkins, but for any reason Cypress@12.17.0 tries to use /home/jenkins/.

The configuration page doesn't state any property to configure this folder.

07.07.2023 10:30:42  2023-07-07T08:30:41.077Z cypress:server:cypress from argv [ '/var/lib/jenkins/.cache/cypress/12.17.0/Cypress/Cypress', '--no-sandbox', '--smoke-test', '--ping=329' ] got options { _: [ '/var/lib/jenkins/.cache/cypress/12.17.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 329, invokedFromCli: false, cwd: '/var/lib/jenkins/Cypress-Runner@4', config: {}, pong: 329 }
07.07.2023 10:30:42  2023-07-07T08:30:41.212Z cypress:server:appdata path: /home/jenkins/.config/Cypress/cy/production
07.07.2023 10:30:42  [4003337:0707/103041.239804:WARNING:sandbox_linux.cc(380)] InitializeSandbox() called with multiple threads in process gpu-process.
07.07.2023 10:30:42  
07.07.2023 10:30:42  DevTools listening on ws://127.0.0.1:35447/devtools/browser/c4bd6bc4-931c-432d-97b0-23ea93bdf40e
07.07.2023 10:30:42  [4003182:0707/103041.240888:ERROR:devtools_http_handler.cc(293)] Error writing DevTools active port to file
07.07.2023 10:30:42  [4003337:0707/103041.243644:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
07.07.2023 10:30:42  [4003182:0707/103041.246439:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
07.07.2023 10:30:42  2023-07-07T08:30:41.349Z cypress:server:appdata path: /home/jenkins/.config/Cypress/cy/production
07.07.2023 10:30:42  [OperationalError: ENOTDIR: not a directory, mkdir '/home/jenkins/.config/Cypress/cy/production'] {
07.07.2023 10:30:42    cause: [Error: ENOTDIR: not a directory, mkdir '/home/jenkins/.config/Cypress/cy/production'] {
MikeMcC399 commented 1 year ago

@CSchulz

You can change the cache location. See https://docs.cypress.io/guides/references/advanced-installation#Binary-cache.

Which operating system are you using?

If this is a Linux operating system, the default is ~/.cache/Cypress and it can be changed using CYPRESS_CACHE_FOLDER.

This issue list is actually for documentation issues only.

You might like to connect also to the Cypress technical community on Discord

Discord chat

elylucas commented 1 year ago

Moving to the Cypress repo as this doesn't appear to be an issue with the docs

CSchulz commented 1 year ago

This doesn't work for the appdata folder. We are already using export CYPRESS_CACHE_FOLDER="/var/lib/jenkins/.cache/cypress"

MikeMcC399 commented 1 year ago

@CSchulz

Can you please let us know which operating system you are using?

CSchulz commented 1 year ago
Platform: linux-x64 (Red Hat Linux - 8.8)
Cypress Version: 12.17.0
MikeMcC399 commented 1 year ago

@CSchulz

Thanks for your OS (Red Hat Linux - 8.8)! I confirmed that I can reproduce on Ubuntu 22.04.

The App Data is stored in ~/.config/Cypress/cy/production

which is not influenced by the environment variable CYPRESS_CACHE_FOLDER="/var/lib/jenkins/.cache/cypress".

Only the cache data is stored in /var/lib/jenkins/.cache/cypress

Sorry for my previous misleading comments!

MikeMcC399 commented 1 year ago

@CSchulz

The home folder of our jenkins user is /var/lib/jenkins, but for any reason Cypress@12.17.0 tries to use /home/jenkins/.

Cypress will use ~ to find the home folder.

What does

echo ~

show? Is it /var/lib/jenkins or /home/jenkins?

MikeMcC399 commented 1 year ago

On Ubuntu with export HOME='/var/lib/jenkins'

npx cypress info shows

Application Data: /var/lib/jenkins/.config/cypress/cy/development
Browser Profiles: /var/lib/jenkins/.config/cypress/cy/development/browsers
Binary Caches: /var/lib/jenkins/.cache/Cypress

Cypress Version: 12.17.0 (stable)
System Platform: linux (Ubuntu - 22.04)
CSchulz commented 1 year ago

Yes I can confim the paths are based on the HOME variable.

I would like to suggest that there should be also an environment variable to override this behavior because it could be possible that the app data folder gets too big or similar issues.

lmiller1990 commented 1 year ago

This sounds like a reasonable feature request. I'll label it as such. I am not sure if this is something that is configurable on every OS, though.

Would you be interested in making a PR by any chance?