Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions
Jump to navigation
Jump to search
Udemy Playwright: Web Automation Testing From Zero to Hero (view source)
Revision as of 02:56, 13 June 2024
, 13 June→Playwright with Docker Container
m (→Visual Testing) |
|||
Line 2,071: | Line 2,071: | ||
=== Playwright with Docker Container === | === Playwright with Docker Container === | ||
* Make sure [https://www.docker.com/products/docker-desktop/ Docker Desktop] is installed | * Make sure [https://www.docker.com/products/docker-desktop/ Docker Desktop] is installed | ||
<code>docker</code> file allows you to build a docker image | |||
<nowiki> | |||
FROM mcr.microsoft.com/playwright:v1.44.1-jammy | |||
RUN mkdir /app | |||
WORKDIR /app | |||
COPY . /app/ | |||
RUN npm install --force | |||
RUN npx playwright install</nowiki> | |||
Commands | |||
<nowiki> | |||
docker build -t pw-pageobject-test . | |||
docker images | |||
docker run -it pw-pageobject-test</nowiki> | |||
The last command starts the container and you can execute commands such as | |||
<nowiki> | |||
npm run pageObjects-chrome</nowiki> | |||
<code>compose.yaml</code> file allows you to build and execute an image as well as obtain files/folder from a running instance | |||
<nowiki> | |||
services: | |||
playwright-test: | |||
image: playwright-test | |||
build: | |||
context: . | |||
dockerfile: ./dockerfile | |||
command: npm run pageObjects-chrome | |||
volumes: | |||
- ./playwright-report/:/app/playwright-report | |||
- ./test-results/:/app/test-results</nowiki> | |||
Commands | |||
<nowiki> | |||
docker-compose up --build | |||
docker-compose up</nowiki> | |||
Will run (& build) the image in the container, execute the command, and at the end copy the generated files back to the host computer. | |||
=== Github Actions and Argos CI === | === Github Actions and Argos CI === |