- Build the docker image:
docker build -t smoke-tests .- Replace the necessary values in the command below and run the tests:
docker run -it --net=host smoke-tests <URL> <username> <password>If you want to mount the tests directory to the container, you can use the following command:
docker run -it --net=host -v "$(pwd)/tests":/code/tests smoke-tests <URL> <username> <password>If you want to get the test results and the failure screenshot, you can use the following one:
docker run -it --net=host -v "$(pwd)/test-results:/code/test-results" smoke-tests <URL> <username> <password>You can look at the traces with the online Playwright trace viewer.
You have to have node.js installed on your machine. The minimum version required is 20.
- Install the dependencies:
npm install
npx playwright install # Install Playwright configured browsers & deps- Configure the environment variables:
cp .env.dist .env- Run the tests with a visual interface:
npm run test:ui # With a visual interface
npm run test # Without a visual interface- Create a new test file in the
testsdirectory. - Write your test using the Playwright API.
You can also use the code generator to help you write tests using npm run test:codegen