Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix e2e docker writing files as root on Linux #1045

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mattrunyon
Copy link
Collaborator

I think this only affects Linux from what I could find online.

Essentially, Docker creates volume directories as root if the directory doesn't exist on the host machine. It also runs and writes files as root, so even if you create the directory ahead of time, the files are still owned by root. This is really annoying if you run say npm run e2e:docker and then npm run e2e:ui to start in headed mode because running outside of Docker can't write to the directories it needs to. You then need to sudo rm -r test-results playwright-report and possibly some snapshot files at times if you change tests.

This should fix all of that and offer a prompt to fix the directories if they aren't owned by you when you run with Docker. After that, snapshots should work smoothly and write all the files as your user instead of root.

@mattrunyon mattrunyon requested a review from mofojed November 26, 2024 21:19
@mattrunyon mattrunyon self-assigned this Nov 26, 2024
@mofojed
Copy link
Member

mofojed commented Nov 27, 2024

Tried running e2e tests and updating snapshots on my Ubuntu machine, seemed to work fine.

@mofojed
Copy link
Member

mofojed commented Nov 28, 2024

On Mac getting some errors when running:

4: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly.
      - [pid=2379][err] [Parent 2379, Main Thread] WARNING: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly.: 'glib warning', file /home/pwuser/firefox/toolkit/xre/nsSigHandlers.cpp:187
      - [pid=2379][err] 
      - [pid=2379][err] (firefox-default:2379): dconf-CRITICAL **: 14:24:42.184: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly.

Seems like this might be related: microsoft/playwright#16491 (comment)

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just removing my approval as there's some issues on Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants