Skip to content

mishautkin/moxymind

Repository files navigation

Moxymind technical tasks

Table of contents

Overview

Repository with technical tasks accomplished by M. Utkin.

  • Test framework: Playwright + Typescript
  • Execution options: local + CI/CD (GitHub Actions)

Technical task #1

Frontend test automation - see docs/.

Technical task #2

API test automation - see docs/.

Setup Instructions

Prerequisites

  • Node.js (v16 or higher)
  • npm package manager

Local Installation

  1. Clone the repository:
git clone https://github.com/mishautkin/moxymind.git
cd moxymind
  1. Install dependencies and playwright:
npm run setup:tests
  1. In the project root create .env file with variables from Environment Variables section.

Project Structure

moxymind/
├── .github/                       # CI/CD workflows
├── docs/                          # Additional documentation
├── resources/
│   └── types.ts                   # Types declarations
├── tests/
│   ├── saucedemo/
│   │   ├── _test.setup.ts         # Saucedemo storage state setup
│   │   ├── _test.data.ts          # Saucedemo test data
│   │   └── saucedemo.spec.ts      # Saucedemo test suite
│   ├── rest-api/
│   │   ├── _test.data.ts          # REST API test data
│   │   └── rest-api.spec.ts       # REST API test suite
├── utils/
│   ├── test.ts                    # Playwright Test fixtures
│   ├── rest-client.ts             # REST API client class
│   ├── base-page.ts               # Parent POM class for other page fixtures
│   ├── login-page.ts              # POM class for loginPage fixture
│   ├── inventory-page.ts          # POM class for inventoryPage fixture
│   └── ...                        # Other POM files, utils and helpers
├── playwright.config.ts           # Playwright configuration
├── package.json                   # Dependencies and scripts
├── tsconfig.json                  # TypeScript configuration
└── README.md                      # This file

Running Tests

Parallel Execution

All given tests can be executed in parallel.

Parallel execution can be configured in playwright.config.ts:

  • Enable/disable parallel execution by fullyParallel param.
  • Number of tests running in parallel by workers param.

Alternative CLI commands:

# Run all Saucedemo tests using 1 worker (non-parallel)
npx playwright test --project=saucedemo* --workers=1

Run all tests

# Run all tests
npm run test:all

Saucedemo Test Execution

# Run all Saucedemo tests
npm run test:saucedemo

# Run Saucedemo tests only in Chrome 
npm run test:saucedemo:chrome

# Run Saucedemo tests only in Firefox 
npm run test:saucedemo:firefox

# Run Saucedemo tests only in Safari 
npm run test:saucedemo:webkit

REST API Test Execution

# Run all tests
npm run test:restapi

Test Filtering

# Run specific test case
npx playwright test --grep "TC-01" --project=saucedemo-chrome

# Run specific test case in debug mode
npx playwright test --grep "TC-01" --project=saucedemo-chrome --debug

Test Reports

Test suite is configured to list running tests and statuses in terminal and output html report: playwright-report/index.html.

Configuration

Test Configuration

Key configuration options in playwright.config.ts:

  • Parallel Execution: Tests run in parallel for faster execution
  • Retries: Automatic retry on failure (configurable for CI/local)
  • Screenshots: Captured on test failures
  • Videos: Recorded on test retries
  • Multiple Browsers: Chrome, Firefox, Safari, and mobile

Environment Variables

# Saucedemo vars
BASE_URL_SAUCEDEMO='https://www.saucedemo.com' # test site base URL
STORAGE_STATE_SAUCEDEMO='./storage-state-saucedemo.json' # storage state file

# REST API vars
BASE_URL_RESTAPI='https://reqres.in/api' # test site base URL
RESTAPI_KEY='***' # API key (free API key: reqres-free-v1)

CI/CD Integration

Two GitHub Action workflows are located in ./.github directory.

  • Workflows are triggered on push to main branch
  • Workflows require environment variables and secrets (see Environment Variables section) to be added on GutHub.

Coding standards

ESLint with standard libraries is used for code standardization.

Usage:

# Check for linting issues
npm run lint

# Automatically fix issues
npm run lint:fix

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Moxymind technical task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published