Skip to content

jmflaherty/medusajs-playwright

Repository files navigation

Medusa Playwright

Docker

MedusaJS Playwright

Security Rating Maintainability Rating Code Smells Quality Gate Status

An e-commerce automation demo project.

🙋 About

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.

⚙️ Setup

  1. Free ports 5432, 9000, 7000, and 8080.

  2. Install Docker or a compatible container runtime.

    💡 Podman should work just fine.

  3. 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
  4. Install dependencies.

    npm install
  5. 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! 👍

✅ Run validations

🐋 On a container

📦 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.

🦾 On metal

⚠️ 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

📋 Open reports

Use:

npm run report

😦 Known issues

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:

⚖️ License

Licensed under MIT's license.

A copy of the project's license is available within it.

👨🏻‍💻 Author

MedusaJS Playwright is written by Juan M. Flaherty.

GitHub | LinkedIn

Enjoy! ❤️

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published