I have a docker image
Dockerfile
# Get the base image of Node version 16
FROM node:16
# Get the latest version of Playwright
FROM mcr.microsoft.com/playwright:focal
# Set the work directory for the application
WORKDIR /app
# Set the environment path to node_modules/.bin
ENV PATH /app/node_modules/.bin:$PATH
COPY .. /app/
# Get the needed libraries to run Playwright
RUN apt-get update && apt-get -y install libnss3 libatk-bridge2.0-0 libdrm-dev libxkbcommon-dev libgbm-dev libasound-dev libatspi2.0-0 libxshmfence-dev
# Install the dependencies in Node environment
RUN npm install
CMD [ "npx", "playwright", "test", "--reporter=list" ]
I am not able to view the report generated after running the tests . i tried running npx playwright show-report from CL in vscode and from the container in docker desktop. No luck viewing the report. Any help would be great
This thread is trying to answer question "How can I view the report generated after running tests in a Docker container?"
Related Ask AI answer for "What are the steps to access the HTML report generated by Playwright tests in a Docker container?".
First, ensure Playwright is installed in your Docker container. You can include the installation commands in your Dockerfile or run them manually inside the container.
Next, run your tests inside the Docker container. Use the command npx playwright test
followed by the path to your test files. Don't forget to include any necessary flags or options for running tests in headless mode or with specific browsers.
npx playwright test /path/to/your/test/files
After running the tests, Playwright generates an HTML report with detailed test results. To access this report, extract it from the Docker container and open it in a web browser.
To extract the HTML report from the Docker container, you can:
docker cp
command.docker cp containerId:/path/to/report.html /host/path/to/report.html
Once you have the HTML report file on your host machine, serve it using a local web server. You can do this within a folder where Playwright is installed.
Change into the directory where you extracted the HTML report file and use npx playwright show-report
followed by the name (or path) of the report.
cd /path/to/report
npx playwright show-report report.html
This starts a local web server that serves up the report. Now you can view your test results in detail!
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].