This project contains automated tests for the CXMeter application using Playwright.
- Clone the repository
- Install dependencies:
npm install
- Install Playwright browsers:
npx playwright install
Use the following npm scripts to run tests:
-
Run all tests (default environment: stage):
npm run test
-
Run tests in development environment:
npm run test:dev
-
Run tests in staging environment:
npm run test:stage
-
Run tests for a specific project in a specific environment:
TEST_ENV=<env> npm run test:<project-name>
Replace
<env>
with eitherdev
orstage
, and<project-name>
with the name of the project you want to run (e.g., chromium, api-tests).Examples:
TEST_ENV=dev npm run test:chromium TEST_ENV=stage npm run test:api-tests
src/
├── API/
│ ├── client/
│ │ └── ApiClient.ts
│ └── constants/
│ └── apiConstants.ts
├── APIHelpers/
│ └── apiHelpers.ts
├── assertions/
│ ├── apiAssertions.ts
│ └── webAssertions.ts
├── core/
│ └── logger/
│ └── Listener.ts
├── pages/
│ ├── interactions/
│ │ ├── LoginInteractions.ts
│ │ └── DashboardInteractions.ts
│ └── locators/
│ ├── LoginLocators.ts
│ └── DashboardLocators.ts
└── tests/
├── apiTests/
│ └── login.ts
├── e2e/
│ ├── login.spec.ts
│ └── dashboard.spec.ts
└── setup/
└── login.setup.ts
playwright.config.ts
package.json
src/API/
: Contains API-related codeclient/
: API client implementationconstants/
: API route constants
src/APIHelpers/
: Helper functions for API operationssrc/assertions/
: Custom assertion utilitiessrc/core/
: Core utilities like custom reportersrc/pages/
: Page Object Model componentsinteractions/
: Page interaction methodslocators/
: Element locators for pages
src/tests/
: Test filesapiTests/
: API-specific testse2e/
: End-to-end test filessetup/
: Test setup files
playwright.config.ts
: Playwright configurationpackage.json
: Project dependencies and scripts
Test results are generated in multiple formats:
-
Console Output: Real-time test results are displayed in the console during test execution.
-
HTML Report:
- Location:
./test-results/report
- To view: Open
index.html
in this directory after test execution
- Location:
-
JSON Results:
- File:
./test-results/results/results.json
- Contains detailed test execution data in JSON format
- File:
-
Custom Logging:
- Implemented via
./src/core/logger/Listener.ts
- Provides additional logging capabilities as defined in the custom reporter
- Implemented via
To generate reports:
- Run tests using any of the test commands (e.g.,
npm run test
) - Reports will be automatically generated in the specified locations