Skip to content

subhambera/DevExpressWebAutomation-TestCafe-Javascript

Repository files navigation

🚀 TestCafe Web Automation Suite

TestCafe JavaScript Node.js Cross Browser

Comprehensive end-to-end web automation testing suite for the DevExpress TestCafe example website

📋 Table of Contents

🎯 Overview

This project provides a complete TestCafe automation suite for testing web forms and UI interactions. It demonstrates best practices for:

  • Form Element Testing - Text inputs, checkboxes, radio buttons, dropdowns, sliders
  • Screenshot Automation - Automated visual documentation at every step
  • Cross-Browser Testing - Chrome, Firefox, Safari, Edge support
  • Validation Testing - Form validation and error handling
  • UI/UX Testing - Element visibility and interaction testing

✨ Features

🔥 Core Capabilities

Feature Description Status
🎬 Visual Documentation 30+ automated screenshots per test run
🕐 Smart Timing Configurable execution speed with optimal waits
🧩 Modular Design Reusable selectors and helper functions
📝 Detailed Logging Console output with step-by-step progress
🛡️ Error Handling Comprehensive assertions and validations
🌐 Cross-Platform Works on Windows, macOS, and Linux

🎨 Test Coverage

📊 Form Elements Coverage: 100%
├── 📝 Text Inputs
├── ☑️  Checkboxes  
├── 🔘 Radio Buttons
├── 📋 Dropdowns
├── 🎚️ Sliders
└── 💬 Text Areas

🛠️ Prerequisites

Before you begin, ensure you have:

  • Node.js (v12.0 or higher) - Download here
  • npm (comes with Node.js)
  • Git (optional) - Download here
  • Modern web browser (Chrome, Firefox, Safari, Edge)

⚡ Quick Start

1️⃣ Clone the Repository

git clone https://github.com/yourusername/testcafe-automation-suite.git
cd testcafe-automation-suite

2️⃣ Install TestCafe

# Global installation (recommended)
npm install -g testcafe

# Or local installation
npm install testcafe --save-dev

3️⃣ Create Screenshots Directory

mkdir screenshots

4️⃣ Run Your First Test

# Run in Chrome
testcafe chrome testcafe-automation.js

# Run in headless mode
testcafe chrome:headless testcafe-automation.js

# Run in multiple browsers
testcafe chrome,firefox testcafe-automation.js

🧪 Test Scenarios

🎭 Test Suite Overview

Our comprehensive test suite includes 5 main test scenarios:

1. 📝 Complete Form Filling Test

  • Tests all form elements in sequence
  • Validates successful form submission
  • Captures 9 detailed screenshots

2. 🔍 Individual Element Testing

  • Tests each UI element independently
  • Validates checkbox and radio button states
  • Captures element-specific screenshots

3. ⚠️ Form Validation Testing

  • Tests empty form submission
  • Validates required field behavior
  • Tests minimum field requirements

4. 🖥️ UI Elements Verification

  • Verifies all elements are present
  • Tests dropdown functionality
  • Validates page structure

5. 🔄 Complete Workflow Testing

  • End-to-end user journey simulation
  • Detailed step-by-step logging
  • Comprehensive screenshot documentation

📸 Screenshots

The automation suite captures screenshots at every critical step:

📸 Screenshot Timeline:
├── 01_initial_page_load.png
├── 02_name_filled.png
├── 03_os_selection.png
├── 04_js_features_selected.png
├── 05_interface_selected.png
├── 06_slider_adjusted.png
├── 07_comments_filled.png
├── 08_form_submitted.png
├── 09_success_verification.png
└── ... (30+ total screenshots)

🏃‍♂️ Running Tests

🖥️ Desktop Browsers

# Chrome (default)
testcafe chrome testcafe-automation.js

# Firefox
testcafe firefox testcafe-automation.js

# Safari (macOS only)
testcafe safari testcafe-automation.js

# Edge
testcafe edge testcafe-automation.js

👻 Headless Mode

# Headless Chrome (CI/CD friendly)
testcafe chrome:headless testcafe-automation.js

# Headless Firefox
testcafe firefox:headless testcafe-automation.js

📱 Mobile Testing

# Mobile Chrome simulation
testcafe "chrome:emulation:device=iPhone X" testcafe-automation.js

# Mobile Firefox simulation
testcafe "firefox:headless --width=375 --height=667" testcafe-automation.js

🔧 Advanced Options

# Custom screenshot path
testcafe chrome testcafe-automation.js --screenshots path=./custom-screenshots

# Parallel execution
testcafe chrome testcafe-automation.js --concurrency 3

# Debug mode
testcafe chrome testcafe-automation.js --debug-mode

📊 Test Reports

📈 Built-in Reports

TestCafe provides several report formats:

# JSON Report
testcafe chrome testcafe-automation.js --reporter json > report.json

# JUnit XML Report  
testcafe chrome testcafe-automation.js --reporter xunit > report.xml

# Minimal Console Report
testcafe chrome testcafe-automation.js --reporter minimal

📋 Sample Console Output

✅ DevExpress TestCafe Example - Web Automation Testing
  ✅ Complete form filling with all elements (5.2s)
  ✅ Individual element interaction testing (3.8s) 
  ✅ Form validation and error handling (4.1s)
  ✅ UI elements and page interaction testing (2.9s)
  ✅ Complete workflow with detailed logging (7.3s)

  5 passed (23.3s)

🎨 Customization

⚙️ Speed Configuration

Adjust test execution speed in the code:

// Slow execution (good for demos)
await t.setTestSpeed(0.1);

// Fast execution (good for CI/CD)
await t.setTestSpeed(1.0);

// Moderate speed (recommended)
await t.setTestSpeed(0.6);

🎯 Adding New Test Cases

test('Your custom test case', async t => {
    console.log('Starting custom test...');
    
    await t
        .typeText('#your-selector', 'Your test data')
        .takeScreenshot('custom_test_step.png')
        .click('#submit-button')
        .expect('#success-message').ok();
        
    console.log('✅ Custom test completed');
});

📝 Modifying Selectors

Update the pageElements object to match different websites:

const pageElements = {
    yourInput: Selector('#your-input-id'),
    yourButton: Selector('.your-button-class'),
    // Add more selectors as needed
};

🤝 Contributing

We welcome contributions! Here's how you can help:

🌟 Ways to Contribute

  • 🐛 Report Bugs - Found an issue? Let us know!
  • 💡 Suggest Features - Have ideas for improvements?
  • 🔧 Submit Pull Requests - Code contributions welcome!
  • 📖 Improve Documentation - Help make our docs better!

📋 Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📈 Project Stats

GitHub stars GitHub forks GitHub issues GitHub license


🌟 Star this repository if you found it helpful!

Made with ❤️ by Subham Bera

⬆ Back to Top

🏷️ Tags

testcafe automation testing javascript web-testing e2e-testing selenium-alternative cross-browser screenshots form-testing ui-testing continuous-integration devops quality-assurance

About

Comprehensive end-to-end web automation testing suite for the DevExpress TestCafe example website

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published