Files
Backend_automation/README.md
Rediet 8a34ceaa09 first commit
Playwright API test suite for payment/cashier endpoints, with
per-environment config (dev/staging/prod) loaded via dotenv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 15:13:34 +03:00

2.9 KiB

NeoPaaS E2E API Tests

End-to-end API test suite for the NeoPaaS platform. Tests all 14 core endpoints in a complete transaction flow (login → purchase → lookups → menu → reset → refund).

Prerequisites

  • Node.js 18+ installed
  • A NeoPaaS account (merchant credentials) for the environment you want to test

Setup

From this folder, install dependencies and the Playwright browser:

npm install
npx playwright install chromium

Environments

The suite ships with config files for each environment. Open the one you want and update the credentials/terminal as needed:

File Environment API URL
.env Default https://www.babinnovations.com
.env.dev Development https://devpro.babinnovations.com
.env.staging Staging https://devpro.babinnovations.com
.env.prod Production https://www.babinnovations.com

Each file holds the API URL, login credentials, terminal ID, and test amount:

API_BASE_URL=https://www.babinnovations.com
API_USERNAME=your-email@example.com
API_PASSWORD=your-password
TERMINAL_ID=1560127620231203
TEST_AMOUNT=400

Tip: copy .env.example to create your own env file if you need a custom target.

Running the tests

Pick the environment you want to run against:

npm test             # uses .env  (default)
npm run test:dev     # uses .env.dev
npm run test:staging # uses .env.staging
npm run test:prod    # uses .env.prod

View the HTML report after a run:

npm run report

When the test starts, it prints which env file was loaded and the API URL so you always know where it's pointing:

🌍 Loaded environment config: .env.dev (API: https://devpro.babinnovations.com)

Endpoints covered

  1. Login
  2. Purchase
  3. Get Transaction by Latest
  4. Get Transaction by Reference
  5. Get Transaction by ID
  6. Get Transaction by UUID
  7. Get Transactions by Date Range
  8. Get Transaction Timeline by ID
  9. Get Transactions Timeline by Date Range
  10. Enable Menu
  11. Disable Menu
  12. Reconcile by Mada ID
  13. Terminal Reset
  14. Refund

Project structure

.
├── src/
│   ├── api/client.ts             # API client (all endpoint methods)
│   ├── config/env.ts             # Loads the selected .env file
│   ├── fixtures/api.fixture.ts   # Playwright fixture providing apiClient
│   └── tests/api/
│       └── all-endpoints.spec.ts # The full 14-endpoint flow
├── .env / .env.dev / .env.staging / .env.prod
├── playwright.config.ts
└── package.json

Troubleshooting

  • Wrong environment? Check the 🌍 Loaded environment config: line printed at the start of the run.
  • Auth fails? Make sure the username/password in the chosen .env file are valid for that environment.
  • Browser missing? Run npx playwright install chromium.