Sign inSign up

automationjutsu/playwright-pytest

By automationjutsu

β€’Updated about 1 year ago

Python Test Automation Project with playwright-pytest using common dependencies

Image
Languages & frameworks
0

1.0K

automationjutsu/playwright-pytest repository overview

Great point! Since Docker Compose V2 has replaced the old docker-compose command with docker compose, I’ve refined the documentation accordingly. Here’s the final polished version with the latest syntax. πŸš€πŸ³


β πŸ“Œ How to Update and Push the Docker Image

This repository contains a Playwright + Pytest test automation setup with common dependencies.

If you add a new dependency in requirements.txt or modify the code, you need to rebuild and push the updated Docker image to Docker Hub.


β πŸš€ Step-by-Step Guide to Updating and Pushing the Image

1️⃣ Build the new Docker image:

docker compose build

βœ… What each flag does:

  • docker build β†’ Builds a new Docker image.
  • -t automationjutsu/playwright-pytest:latest β†’ Tags (-t) the image with the name automationjutsu/playwright-pytest and the latest tag.
  • . β†’ The dot (.) specifies that the Dockerfile is located in the current directory.

2️⃣ Verify that the image was created successfully:

docker images | grep automationjutsu/playwright-pytest

βœ… Explanation:

  • docker images β†’ Lists all Docker images on your machine.
  • | grep automationjutsu/playwright-pytest β†’ Filters the output to show only the relevant image.

3️⃣ Log in to Docker Hub (if not already logged in):

docker login

βœ… Explanation:

  • This command logs you into your Docker Hub account.
  • If you’re not logged in, Docker will ask for your username and password.

4️⃣ Push the updated image to Docker Hub:

docker push automationjutsu/playwright-pytest:latest

βœ… Explanation:

  • docker push β†’ Uploads the image to Docker Hub.
  • automationjutsu/playwright-pytest:latest β†’ Specifies the image name and tag to push.

⁠🐳 Running the Updated Image in a Container

To test the updated Docker image and verify everything works fine:

docker compose run --rm -it automationjutsu/playwright-pytest:latest

βœ… Explanation:

  • docker run β†’ Starts a new container from the specified image.
  • --rm β†’ Automatically removes the container after it stops (useful for temporary runs).
  • -it β†’ Runs the container in interactive mode (-i keeps input open, -t allocates a terminal).
  • automationjutsu/playwright-pytest:latest β†’ The image name to use.

⁠🎯 If You Use docker compose to Run Tests

If you’re using Docker Compose, update and restart the container with:

docker compose build
docker compose up

βœ… Explanation:

  • docker compose build β†’ Rebuilds the Docker image based on the docker-compose.yml file.
  • docker compose up β†’ Starts the containers defined in docker-compose.yml.
  • --force-recreate (optional) β†’ Ensures the latest image is used, even if the container already exists:
    docker compose up --force-recreate
    

β πŸ” Checking Available Docker Images

To list all Docker images stored on your machine:

docker images

βœ… Explanation:

  • docker images β†’ Displays a list of locally stored Docker images.
  • The output shows:
    • REPOSITORY (image name)
    • TAG (version/tag)
    • IMAGE ID
    • SIZE

To remove old images and free up space:

docker rmi <image_id>

βœ… Explanation:

  • docker rmi <image_id> β†’ Removes an image from the local system.
  • Replace <image_id> with the actual IMAGE ID from docker images.

β πŸ›‘ Stopping and Removing Containers

If a container is running and needs to be stopped:

docker ps  # List running containers
docker stop <container_id>  # Stop a specific container
docker rm <container_id>  # Remove a stopped container

βœ… Explanation:

  • docker ps β†’ Lists all running containers.
  • docker stop <container_id> β†’ Stops a container by its ID.
  • docker rm <container_id> β†’ Removes a stopped container from the system.

β πŸ“Œ Summary of Essential Commands

ActionCommandDescription
Build imagedocker build -t name:tag .Builds a new Docker image from a Dockerfile.
List imagesdocker imagesShows all available images on the local machine.
Run containerdocker run --rm -it name:tagRuns a container interactively and removes it after exit.
Push image to Docker Hubdocker push name:tagUploads the image to Docker Hub.
Remove imagedocker rmi image_idDeletes a Docker image from the local system.
Stop a containerdocker stop container_idStops a running container.
Remove a containerdocker rm container_idDeletes a stopped container.
Build & start with docker composedocker compose build && docker compose upRebuilds and runs containers defined in docker-compose.yml.

πŸ“Œ Done! Now you have a well-documented step-by-step guide inside Docker Hub with the latest Docker Compose commands, making it easy to update and push your Playwright Pytest Docker image. πŸš€πŸ³

Tag summary

Content type

Image

Digest

sha256:2b9d2d3be…

Size

988.6 MB

Last updated

about 1 year ago

docker pull automationjutsu/playwright-pytest