Closed zac11 closed 3 years ago
Hi, I was working on this for the last couple of days and finally I've managed to fix this issue - however I still think there is a better way of solving this.
So, when running with pwuser
the permissions issue happens due to with the pwuser
cannot access the videos/
folder and the error message comes.
I modified my Dockerfile
to something like this
FROM mcr.microsoft.com/playwright:focal
USER root
WORKDIR /automation
COPY package.json ./
RUN npm install
COPY . ./
RUN chown -R pwuser /automation
USER pwuser
CMD [ "npm","run","test" ]
And then I was able to run the tests with video enabled. However, this is not the greatest of approaches since it actually does the heavy lifting using the root
user and then just changes ownership at the end.
I your original docker file change copy to also set right owner:
COPY --chown=pwuser:pwuser . ./
See Docker COPY documentation.
Also it doesn't seem to be Playwright-specific issue, it's just rimraf videos/
fails for the copied dir.
Context:
1.13.1
16.0.0
20.10.7
, buildf0df350
Code Snippet
Code that is used to launch Playwright
Dockerfile
Docker-compose
When trying to run tests with this configuration, I am trying to delete the videos folder before test run so that every run has a new videos folder created - I am using
rimraf
to delete the videos directory.In the
scripts
section, I have the following commands -When I run the
npm run test
command, I get anEACCESS
error when using thepwuser
. If I use theroot
user, then the error doesn't come.Is this because the
pwuser
doesn't has access to thewkdir
/automation
? If this is the case, how can I give permission topwuser
for accessing thewkdir
correctly?Error message