-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c546f2
commit aceffd3
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.git | ||
logs | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
services: | ||
playwright-cucumber: | ||
build: . | ||
container_name: playwright_cucumber_js | ||
environment: | ||
HEADLESS: "true" # Headless mode for Playwright | ||
NODE_ENV: "production" # Optional: Add more environment variables here | ||
volumes: | ||
- .:/repo # Mounts the local project directory to the container | ||
command: npm run test -- --device "Desktop Chrome" --env "qa" --tags "@reg" --report "local" --rerun --headless | ||
# Replace this with your customized execution command | ||
ports: | ||
- "3000:3000" # Expose ports if necessary (e.g., for web applications) | ||
networks: | ||
- playwright-network | ||
|
||
networks: | ||
playwright-network: | ||
driver: bridge | ||
|
||
|
||
# docker-compose up -d for start a container | ||
|
||
#docker-compose ps to verify the container running | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#This Line specifies the base image of the docker container. | ||
#This one will get keep on updated in playwright website gtheyr you can see the latest version | ||
FROM mcr.microsoft.com/playwright:v1.48.1-noble | ||
|
||
|
||
# This step specifies the working directory inside the container | ||
WORKDIR /repo | ||
|
||
# This steps ensure copy the package-lock json from local to /repodirectory in the container. | ||
COPY ["package-lock.json","./"] | ||
|
||
#This sets the ENV Headless variable to true. So, The Automated test will get executed in Headless | ||
ENV HEADLESS=true | ||
|
||
# Manually installing the playwright package in order to install the system dependencies which playwright needs | ||
#First command will make sure same dependency which are mentioned in package-lock.json is getting downloaded and | ||
#not creating new package.-lock.json file. | ||
|
||
#--no-save ->>> makes sure that newly installed dependency not getting saved into package.json/package-lock.jspon file. | ||
|
||
#playwright@$() makes sure that same version of dependency getting installed | ||
|
||
#node -pe >>>>>>>>>>>>> runs a Node.js command in a quick,one-liner format. | ||
|
||
#"require('./package-lock.json').dependencies.playwright.version" >>> this is a JS expression that require the package-lock.json file | ||
#and get the dependecies and playwright object and Retreived the version of the Playwright dependency. | ||
|
||
# general command to execute the all mandatory dependency for playwright. | ||
RUN npm install --no-package-lock --no-save playwright@$(node -pe "require('./package-lock.json').dependencies.playwright.version") && \ | ||
npx playwright install-deps | ||
|
||
|
||
# Install remaining node packages | ||
COPY ["package.json", "./"] | ||
RUN npm install && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . . | ||
|
||
|
||
# Docker command to build image- "docker build -t playwright_cucumber_js ." | ||
#You should be in root directory | ||
|
||
#docker run -it playwright_cucumber_js to start a container | ||
#then you will get into the container shell thetre you can use the regular execution command. |