Skip to content

EugeneBeletsky/21-vek-by

Repository files navigation

21vek.by Test Automation

Playwright Tests

End-to-end UI and API test automation framework for 21vek.by built with Playwright and TypeScript.


Table of Contents


Tech Stack

Tool Purpose
Playwright Browser automation & API testing
TypeScript Type-safe test development
Allure Test reporting with rich UI
ESLint Code linting
Prettier Code formatting
Docker Containerized test execution
GitHub Actions CI pipeline
Jenkins CI/CD pipeline

Project Structure

21-vek/
├── .github/workflows/       # GitHub Actions CI workflow
├── api/                      # API request helpers
├── fixtures/                 # Playwright test fixtures (UI & API)
├── pages/                    # Page Object Model
│   ├── BasePage.ts
│   ├── components/           # Shared base components
│   └── home/                 # Home page & its components
│       ├── HomePage.ts
│       └── components/       # Header, Modals, Search, Cart, etc.
├── tests/
│   ├── api/                  # API tests (auth, catalog, cart)
│   └── ui/                   # UI tests (login, logout, purchase, search)
├── utils/                    # Utilities (config, login, session)
├── Dockerfile                # Docker image for headless execution
├── Jenkinsfile               # Jenkins pipeline definition
├── playwright.config.ts      # Playwright configuration
└── package.json

Getting Started

Prerequisites

  • Node.js >= 20 LTS
  • npm >= 9
  • Java JDK/JRE >= 11 (required for Allure CLI)

Installation

npm ci
npx playwright install --with-deps

Environment Setup

Copy the example environment file and fill in your credentials:

cp .env.example .env

.env.example contents:

BASE_URL=https://www.21vek.by
LOGIN_EMAIL=your_email@example.com
LOGIN_PASSWORD=your_password
NAME=YourName

Running Tests

All Tests

npm test

By Category

Command Description
npm run test:ui UI tests only (Chromium)
npm run test:api API tests only
npm run test:smoke Smoke suite (@smoke tag)
npm run test:regression Regression suite (@regression tag)

By Browser / Mode

Command Description
npm run test:chrome Run in Chromium
npm run test:headed Run in headed mode
npm run test:debug Run with Playwright Inspector
npm run test:parallel Run with 4 workers

Code Quality

npm run lint          # ESLint check
npm run lint:fix      # ESLint auto-fix
npm run format        # Prettier format

Reports

The project generates two types of reports: Playwright HTML and Allure.

Playwright HTML Report

npm run report

Opens the built-in Playwright HTML report from playwright-report/.

Allure Report

Generate and open the Allure report:

npm run report:allure

Or step by step:

# Generate report from results
npm run report:allure:generate

# Open report in browser
npm run report:allure:open

# Clean previous results
npm run report:allure:clean

Allure results are written to allure-results/ and the generated report goes to allure-report/.


Docker

Build the Image

docker build -t 21vek-tests .

Run Tests in Container

docker run --rm \
  -e BASE_URL=https://www.21vek.by \
  -e LOGIN_EMAIL=your_email \
  -e LOGIN_PASSWORD=your_password \
  21vek-tests

Extract Reports from Container

# Run tests and keep the container
docker run --name test-run 21vek-tests

# Copy reports to host
docker cp test-run:/app/allure-results ./allure-results
docker cp test-run:/app/playwright-report ./playwright-report

# Generate Allure report locally
npm run report:allure:generate

# Cleanup
docker rm test-run

CI/CD

GitHub Actions

The workflow (.github/workflows/playwright.yml) runs on every pull request to main and can be triggered manually.

Pipeline stages:

  1. Lint & Type Check -- ESLint + TypeScript compilation check
  2. E2E Tests -- Runs Playwright tests in the official Playwright Docker container
  3. Reports -- Uploads Allure results, Allure report, and Playwright HTML report as artifacts

Required repository secrets: BASE_URL, LOGIN_EMAIL, LOGIN_PASSWORD, NAME.

Jenkins

The Jenkinsfile defines a declarative pipeline with the following stages:

  1. Checkout -- Pulls source code
  2. Install -- Installs npm dependencies and Playwright browsers
  3. Test -- Runs the full Playwright test suite
  4. Generate Allure Report -- Generates the Allure report from results

The pipeline integrates with the Allure Jenkins Plugin for in-dashboard report viewing.

Required Jenkins credentials: BASE_URL, LOGIN_EMAIL, LOGIN_PASSWORD.


License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors