This repository contains E2E tests for the open-supply-hub project.
Please go through the following steps to run the project locally.
-
First, ensure that you have the latest version of Node.js installed on your machine.
-
Then install Playwright by running the following command:
npx playwright install
-
For local development environment you need to run:
npm i
-
In the root directory create a file called
.env, with the following variables (replace the values with actual values):
BASE_URL=https://test.os-hub.net
USER_EMAIL={email}
USER_PASSWORD={password}
AUTH_TOKEN={token}
USER_ADMIN_EMAIL={admin_email}
USER_ADMIN_PASSWORD={admin_password}
USER_API_EMAIL={api_email}
USER_API_PASSWORD={api_password}
ENVIRONMENT={environment}
VERSION_TAG={version_tag}-
In order to run the tests:
npm run test -
Tags (embedded in test titles; filter with Playwright’s
--grep):@smokev1/@smokev2— two smoke test suites that support running tests for both the old (v1) and new (v2) location page UI. They differ only in the location detail page after a search: v1 asserts the legacy/facilities/page, while v2 asserts the new/production-locations/page. To choose which suite to run, check theenable_production_location_pageswitch in the Django admin panel: run@smokev2when it is enabled, and@smokev1when it is disabled.@regression— regression scenarios that can be executed during regression testing in a pre-production environment to reduce testing time and increase test coverage
Examples:
# Smoke v1. Run it when enable_production_location_page is off npx playwright test --grep "@smokev1" # Smoke v2. Run it when enable_production_location_page is on npx playwright test --grep "@smokev2" # Regression npx playwright test --grep "@regression" # Full suite (smoke + regression + everything else) npm run test
This project includes Docker configuration for easy setup and consistent testing environments.
- Docker installed on your machine
- Docker Compose installed
-
Clone the repository and navigate to the project directory
-
Create environment file (copy from the example):
cp .env.example .env
Then edit
.envwith your actual test credentials. -
Build and run tests:
# Build the Docker image docker compose build # Run container for tests docker compose up # Run all tests docker compose exec e2e-tests npm run test # Run smoke by tag (same as locally) docker compose exec e2e-tests npx playwright test --grep "@smokev1" docker compose exec e2e-tests npx playwright test --grep "@smokev2" docker compose exec e2e-tests npx playwright test --grep "@regression"
-
Access test reports:
- After tests complete, open your browser and go to:
http://localhost:9323 - Or open the HTML report directly:
open playwright-report/index.html
- After tests complete, open your browser and go to: