Playwright test script that validates that the first 100 Hacker News articles are sorted from newest to oldest with Monocart test reporter support.
- The project was created for a QA Wolf take home assignment.
- Original QA Wolf assignment README.
- Navigates to https://news.ycombinator.com/newest
- Collects exactly 100 articles by paginating through "More" links as needed
- Extracts timestamps from each article's age element
- Validates that all articles are sorted from newest to oldest chronologically
- Provides detailed error reporting if any sorting violations are found
- CI/CD Integration for GitHub workflow support executing tests in Docker with GitHub Actions triggered on push/pull requests to main and for daily scheduled runs:
-
Clone or Download:
- Clone this repository:
git clone https://github.com/badj/HackerNewsTop100SortingPlaywrightTest.git - Alternatively, download the ZIP file and extract it.
- Clone this repository:
-
Navigate to Project Directory:
cd HackerNewsTop100SortingPlaywrightTest -
Initialise a Node.js project
npm init -y
-
Install node modules by running
npm i
-
Install Playwright
npm i -D @playwright/test
-
Install browsers
npx playwright install
-
Run the test:
npx playwright test
Sample output for a passing test run:
jjbadenhorst:HackerNewsTop100SortingPlaywrightTest (main) % npx playwright test
[MR] clean output dir ...
Running 1 test using 1 worker
[chromium] › tests/hackernews.spec.js:3:9 › Hacker News Article Sorting › should have first 100 articles sorted from newest to oldest
Scraping page 1, collected 0 articles so far...
Scraping page 2, collected 30 articles so far...
Scraping page 3, collected 60 articles so far...
Scraping page 4, collected 90 articles so far...
Collected 100 articles
First article: 2 minutes ago (2026-05-08T23:26:49 1778282809)
Last article: 2 hours ago (2026-05-08T20:55:41 1778273741)
✅ All 100 articles are correctly sorted from newest to oldest
1 passed (8.1s)
[MR] generating report data ...
[MR] generating test report ...
[MR] Playwright POC Test Report
┌─────────────┬───────────────────────┐
│ Tests │ 1 │
│ ├ Failed │ 0 (0.0%) │
│ ├ Flaky │ 0 (0.0%) │
│ ├ Skipped │ 0 (0.0%) │
│ └ Passed │ 1 (100.0%) │
│ Steps │ 130 │
│ Suites │ 1 │
│ ├ Projects │ 1 │
│ ├ Files │ 1 │
│ ├ Describes │ 1 │
│ └ Shards │ 0 │
│ Errors │ 0 │
│ Retries │ 0 │
│ Logs │ 8 │
│ Attachments │ 3 │
│ Artifacts │ 0 │
│ Playwright │ v1.59.1 │
│ Date │ 5/9/2026, 11:29:34 AM │
│ Duration │ 8.1s │
└─────────────┴───────────────────────┘
[MR] json: monocart-report/index.json
[MR] view report: npx monocart show-report monocart-report/index.html
To open last HTML report run:
npx playwright show-report
-
View the default built in HTML test results report in the browser:
npx playwright show-report
-
View the Monocart test results report in the browser:
npx monocart show-report monocart-report/index.html