Skip to content

ellen20/hackernews-playwright-sorting-validation

Repository files navigation

HackerNews Sorting Validation - Playwright Test Suite

Playwright Tests Node.js Version Playwright

Comprehensive automated test suite validating chronological sorting and functionality of Hacker News' "newest" page. This project demonstrates advanced Playwright testing skills with 100-article validation and 38 UI test cases.

🎯 What This Tests

  • Core Validation: Chronological sorting of 100 articles (newest to oldest)
  • UI Components: Navigation, pagination, article metadata
  • Data Integrity: Timestamp formats, article elements, page structure
  • Edge Cases: Missing data, boundary conditions, error handling

Total Coverage: 39 test cases across 6 test suites + core sorting validation

🛠️ Technologies

  • Playwright v1.40+ (Library & Test Framework)
  • JavaScript (ES6+)
  • Node.js v16+

📦 Installation

# Clone the repository
git clone https://github.com/ellen20/hackernews-playwright-sorting-validation.git
cd hackernews-playwright-sorting-validation

# Install dependencies
npm install

# Install Playwright browsers
npx playwright install

# Verify installation
npm run test:core

🚀 Running Tests

npm run test:all       # Run everything (core + UI tests)
npm run test:core      # Run core sorting validation only (index.js)
npm run test:extra     # Run UI test suites only (tests/)
npm run test:report    # View HTML test report

📁 Project Structure

hackernews-playwright-sorting-validation/
├── index.js                      # Core: 100-article sort validation
├── tests/
│   ├── ui-elements.spec.js       # UI component interactions (6 tests)
│   ├── article-elements.spec.js  # Article metadata validation (7 tests)
│   ├── timestamp.spec.js         # Timestamp format/validity (5 tests)
│   ├── pagination.spec.js        # Navigation functionality (6 tests)
│   ├── page-structure.spec.js    # Page layout verification (6 tests)
│   └── edge-cases.spec.js        # Robustness testing (8 tests)
├── helpers/
│   ├── navigation.js             # Navigation utilities
│   └── extraction.js             # Data extraction utilities
├── playwright.config.js
├── package.json
└── README.md

📊 Test Coverage

Test Suite Tests Focus Area
Core Validation 1 100-article chronological sorting
UI Elements 6 Component interactions
Article Elements 7 Metadata validation
Timestamps 5 Format & validity
Pagination 6 Navigation functionality
Page Structure 6 Layout verification
Edge Cases 8 Robustness testing
Total 39 Comprehensive coverage

🔍 Implementation Approach

Core Test (index.js)

  • Uses Playwright as a library for direct browser automation
  • Validates 100 articles sorted chronologically (newest to oldest)
  • Execution: node index.js

UI Test Suites (tests/)

  • Uses Playwright Test framework with built-in runner and assertions
  • 38 tests across 6 comprehensive test suites
  • Cross-browser testing: Chromium, Firefox, WebKit
  • Execution: npx playwright test

This dual approach demonstrates proficiency with both Playwright library and test framework.

📝 Test Strategy

See TEST_STRATEGY.md for detailed testing approach, technical decisions, and rationale.

👨‍💻 Author

Jingling Jin

  • QA Engineer with 3 years of experience
  • Specializing in test automation and quality assurance
  • 📧 jljin0524@gmail.com
  • 📍 Houston, Texas

🎓 Project Purpose

This portfolio project demonstrates:

  • Advanced test automation with Playwright
  • Comprehensive test strategy design
  • Clean, maintainable code architecture
  • Real-world testing of live applications
  • Both library and framework implementation approaches

📄 License

This project is for educational and portfolio purposes.

About

Automated sorting validation tests for Hacker News using Playwright

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors