About | Setup | Run validations | Open reports | License | Author
An e-commerce automation demo project.
Based on MedusaJS, a popular open-source Shopify alternative written with JavaScript and TypeScript, that runs on NodeJS.
Validations are written in TypeScript with Playwright, a web automation tool that is leading and redefining the field.
Services are built and run with Docker, the technology that made containerized development and services popular.
-
Free ports
5432
,9000
,7000
, and8080
. -
Install Docker or a compatible container runtime.
💡 Podman should work just fine.
-
Install NodeJS 16.19.0 (LTS in maintenance).
💡RECOMMENDED to use NVM to manage NodeJS versions.
Install and use the NodeJS version set in the
.nvmrc
with NVM.nvm use
-
Install dependencies.
npm install
-
Download browsers used by Playwright:
npx playwright install --with-deps
⚠️ Depending on your operating system and its compatibility with Playwright's dependencies, this step can fail or warn about them being incompatible while still installing them. If installed, they will likely work.💡 If you get an error, or the dependencies do not work, you can run Playwright On a container.
Done! 👍
📦 No browser window will be shown, as containerizing Playwright means that there will be no graphics server to use.
Browsers will still run in headless mode.
Use:
npm run test
This will make use of the docker-compose.yaml file, which describes the necessary services to recreate the containerized development environment, on which the Playwright validations will be executed.
After setting up the environment, the Playwright application will be packaged and run as a service of its own, according to Dockerfile.
⚠️ Only applicable if there were no issues with the setup's step #5.💡 If that was the case, you will need to run Playwright On a container.
Recreate the development environment with:
npm run services:start
It uses the same docker-compose.yaml file as before but excludes the Playwright application so it can be run locally.
Once the services are initialized, run Playwright with:
npm run metal:test
Use:
npm run report
The Anonymous purchase
validations may appear to be flaky as they fail from time to time, when in fact they encounter a known issue in MedusaJS with concurrent requests.
The right way to test concurrent requests is with load tests, which is not what this project nor Playwright does.
Refer to the MedusaJS Issues:
- Issues with many API calls at the same time. #1834
- Got conflict errors while making concurrent order requests. #3206
- "Canceled on identification as a pivot, during conflict out checking" on two concurrent complete order requests #3556
Licensed under MIT's license.
A copy of the project's license is available within it.
MedusaJS Playwright is written by Juan M. Flaherty.
Enjoy! ❤️