Skip to content

A comprehensive test automation solution featuring a React TypeScript frontend and Node.js backend with full test coverage and modern CI/CD practices.

Notifications You must be signed in to change notification settings

ccatimbang/simple-playwright-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Test Automation Project

A comprehensive test automation solution featuring a React TypeScript frontend and Node.js backend with full test coverage and modern CI/CD practices.

πŸš€ Quick Setup (1-2 minutes)

Prerequisites

  • Node.js 18+ and npm (or yarn)

⚑ One-Command Setup (Recommended)

# Clone and setup everything in one go
git clone <repository-url>
cd remtest
npm run setup

πŸ”§ Manual Setup (Alternative)

# 1. Install dependencies
npm run install:all

# 2. Setup Playwright browsers
cd client && npx playwright install --with-deps

# 3. Start both servers
npm run dev

🎯 What You Get

πŸ§ͺ Testing

Test Coverage

  • API Tests: 85.36% coverage, 23/23 tests passing βœ…
  • UI Tests: 18/18 E2E tests passing βœ…
  • Total: 41 tests with comprehensive coverage

Quick Test Commands

# Run all tests
npm run test:all

# Individual test suites
npm run test:api      # API tests only
npm run test:client   # UI tests only

# Code quality
npm run lint

πŸ“ Project Structure

β”œβ”€β”€ api/                 # Node.js Express backend
β”‚   β”œβ”€β”€ src/            # Source code
β”‚   β”œβ”€β”€ tests/          # API tests (Jest + Supertest)
β”‚   └── coverage/       # Test coverage reports
β”œβ”€β”€ client/             # React TypeScript frontend
β”‚   β”œβ”€β”€ src/            # Source code
β”‚   └── tests/          # UI tests (Playwright)
└── .github/            # CI/CD workflows

πŸ”„ CI/CD Pipeline

Main CI Workflow (main.yml)

  • Triggers: Pull requests and pushes to main/master
  • Purpose: Full CI pipeline with linting, testing, and building
  • Steps:
    1. Lint code with ESLint
    2. Run API tests with Jest
    3. Build React client
    4. Run E2E tests with Playwright

Pipeline Features

  • Parallel Execution: API and UI tests run simultaneously
  • Coverage Reporting: Integrated with Codecov
  • Test Artifacts: Screenshots and reports on failures
  • Health Checks: Reliable server startup validation
  • Dependency Caching: Optimized for fast builds

Code Quality Workflows

  • Lint Workflow: ESLint checks on both API and client
  • Auto-Fix Workflow: Automated code formatting and commits

πŸ› οΈ Application Features

Authentication System

  • JWT-based authentication with bcrypt password hashing
  • Session persistence using localStorage
  • Default credentials: admin / password
  • Comprehensive error handling and validation

Todo Management

  • CRUD Operations: Create, Read, Update, Delete todos
  • Fields: Title (required), description (optional), completion status
  • Features: Edit in-place, bulk operations, creation timestamps
  • User Isolation: Todos are user-specific and secure

Technical Stack

  • Frontend: React 18, TypeScript, CSS
  • Backend: Node.js, Express, JWT, bcrypt, UUID
  • Testing: Playwright, Jest, Supertest
  • Quality: ESLint, TypeScript compiler
  • CI/CD: GitHub Actions, npm scripts

πŸ“Š Test Coverage Details

API Coverage (85.36%)

  • Authentication: Login, logout, token validation
  • Todo CRUD: All endpoints with error scenarios
  • Security: JWT middleware, user isolation
  • Error Handling: Invalid requests, unauthorized access

UI Coverage (18/18 tests)

  • Authentication: Login/logout workflows
  • Todo Management: Full CRUD operations
  • User Experience: Form validation, state management
  • Edge Cases: Empty states, error handling

🚨 Known Issues & Limitations

Current Limitations

  • Data Persistence: In-memory storage (resets on server restart)
  • Single User: Designed for single-user scenarios
  • No Real Database: Uses in-memory arrays
  • No Concurrent Support: Single-user application design

Technical Constraints

  • No real database integration
  • No concurrent user support
  • No offline functionality
  • No file upload capabilities

πŸ”§ Development Commands

# Development
npm run dev              # Start both servers
npm run start:api        # Start backend only
npm run start:client     # Start frontend only

# Testing
npm run test:api         # API tests only
npm run test:client      # UI tests only
npm run test:all         # All tests
npm run test:ci          # CI-optimized tests

# Code Quality
npm run lint             # Check code quality
npm run lint:fix         # Auto-fix issues
npm run build            # Build production client

# Setup
npm run setup            # Full project setup
npm run install:all      # Install all dependencies

πŸ“ˆ Performance Metrics

  • Test Execution: ~10 seconds for full suite
  • API Response Time: <100ms average
  • UI Load Time: <2 seconds
  • Coverage: >85% API, comprehensive UI testing
  • Parallel Workers: 6 for UI tests

🎯 Future Enhancements

  • Add real database integration
  • Implement concurrent user support
  • Add performance testing
  • Add accessibility testing
  • Implement real-time features
  • Add API documentation generation

πŸ“ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: npm run test:all
  5. Ensure linting passes: npm run lint
  6. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details

About

A comprehensive test automation solution featuring a React TypeScript frontend and Node.js backend with full test coverage and modern CI/CD practices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published