Skip to content

Repository files navigation

Open Supply Hub e2e Tests

This repository contains E2E tests for the open-supply-hub project.

Getting Started

Option 1: Local Development

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 the enable_production_location_page switch in the Django admin panel: run @smokev2 when it is enabled, and @smokev1 when 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

Option 2: Docker Setup (Recommended)

This project includes Docker configuration for easy setup and consistent testing environments.

Prerequisites

Quick Start with Docker

  1. Clone the repository and navigate to the project directory

  2. Create environment file (copy from the example):

    cp .env.example .env

    Then edit .env with your actual test credentials.

  3. 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"
  4. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages