← Back to Portfolio

QA Wolf Technical Assessment

Hacker News sort validator built with Node.js and Playwright — scrapes the 100 newest articles and verifies chronological ordering with a modular CLI and full test suite.

Test Automation Web Scraping CLI Tool
Watch Demo View Code

Jump to Section

Demo Video
Project Overview

A Node.js + Playwright tool that scrapes the first 100 articles from Hacker News/newest and validates they are sorted newest-to-oldest by timestamp, reporting any out-of-order articles with detailed context.

  • Multi-page Playwright navigation across paginated results
  • Timestamp parsing and strict ordering validation
  • Configurable CLI flags for article count, titles to display, verbose output
  • Built-in error injection mode to verify the validator itself
  • Robust handling of malformed timestamps, pagination errors, and network issues
Technology Stack

Node.js

JavaScript runtime for the CLI and scraper

Playwright

Browser automation for scraping and tests

JavaScript ES6+

Async/await, modules, destructuring

@playwright/test

Built-in test runner

Key Features

Playwright Scraping

Multi-page navigation with dynamic content extraction.

Sort Validation

ISO timestamp parsing with precise out-of-order detection.

CLI Interface

Flags, defaults, and built-in help documentation.

Modular Architecture

CLI parser, validator, logger, result handler, and debug utilities split into focused modules.

Error Injection

Test mode that intentionally breaks the data to verify the validator catches it.

Resilient Errors

Graceful handling of pagination failures, bad timestamps, and network hiccups.

Usage
# Fetch and validate 100 articles
node index.js

# Show first 5 article titles
node index.js 100 5

# Verbose output
node index.js 100 5 --verbose

# Test mode with intentional sorting errors
node index.js 100 0 --test-error

# Help
node index.js --help
Testing

Run the suite with npx playwright test:

  • CLI parser tests — argument parsing, defaults, flag handling
  • Validator tests — timestamp parsing and edge cases
  • Result tests — Result class methods and error reporting
  • Integration tests — end-to-end workflow
  • Test-error tests — confirms intentional error injection works