Smoketest: Selector Drift Detection
Twitch could change its UI. This extension uses a nightly smoketest to detect when selectors break — before users complain.
🛠 What It Tests
Each night, a GitHub Action opens:
- Twitch homepage
- A live channel’s chat and profile views
It checks whether expected Twitch DOM elements still exist — based on the selector context definitions in selectorMetadata.ts
.
✅ How It Works
- Playwright runs headless Chromium
- Selectors are grouped by context (homepage, chat, profile, etc.)
- Pages are visited and each relevant selector is checked:
- If it matched previously but now returns 0 → it is marked as dropped
- A diff is generated between current and last baseline
- If any selectors dropped from
true → false
, a GitHub Issue is opened
💾 Baseline Behavior
- The smoketest compares against
last-smoketest.json
from thebaselines
branch - If the baseline is missing or empty, it skips alerting and saves the current snapshot
🔄 Updating the Baseline
If Twitch makes harmless UI changes and the extension still works:
- Run the smoketest manually or let it run on schedule
- If all selectors are still valid, the job will:
- Upload a new
last-smoketest.json
- Push it to the
baselines
branch
- Upload a new
You don’t need to touch this manually unless the automation fails.
🧪 Running Locally
To debug selector issues:
HEADLESS=false npm run smoketest
This runs the smoketest visibly so you can inspect the DOM in a real browser window.
🔔 When You’ll Get Notified
If:
- A selector previously matched
- And now it doesn’t
Then a GitHub issue will be opened (with full JSON diff)
This helps catch Twitch UI updates before users do.
📘 For selector architecture, context definitions, and how to add new selectors, see the Selectors documentation.