test: harden coverage and browser release gates

This commit is contained in:
KoalaDev
2026-08-21 14:10:35 +02:00
parent 368daa6e2e
commit 230e7f5932
29 changed files with 1176 additions and 806 deletions
+10
View File
@@ -8,6 +8,9 @@ enough to control it.
npm run test:e2e:install # once, downloads the browsers
npm run build:extension # extension.spec.mjs loads dist/chrome
npm run test:e2e
npm run test:e2e:detection # finder only: Chromium, Firefox, WebKit
npm run test:e2e:extension # packed extension only: Chromium MV3
npm run test:e2e:race # @race scenarios, repeated 20 times
```
## Layout
@@ -21,6 +24,12 @@ npm run test:e2e
| `fixtures/media/` | Small generated clips (see below) |
| `helpers/content-source.mjs` | Lifts the real finder out of `extension/content.js` |
The detection fixtures run as three Playwright projects: Chromium, Firefox,
and WebKit. Packed-extension tests remain Chromium-only because they exercise
Chrome MV3 APIs and a persistent service-worker context. The scheduled
`.github/workflows/race-tests.yml` lane repeats tests marked `@race` and uploads
traces/results on failure.
## Two rules worth keeping
**The specs run the shipped source, not a copy.** `helpers/content-source.mjs`
@@ -45,6 +54,7 @@ reads as a broken fixture instead of a scoring regression.
| `late-frame.html` | Player frame attached after the page settled |
| `shadow-player.html` | Player in a shadow root, tiny teaser in the light DOM |
| `muted-player.html` | Mute must not disqualify the only player |
| `display-contents-player.html` | A visible player survives a boxless `display: contents` wrapper |
| `hidden-preload.html` | A `display:none` preload still reports 1080p; it must lose |
| `ad-frame.html` | 1080p asset in a 300x250 ad slot must lose to the real player |
| `background-loop.html` | Silent looping hero must lose despite being the largest |
+1 -1
View File
@@ -737,7 +737,7 @@ test('polling video state on a page with no video does not restart the target',
.toBe('true');
});
test('stays ready on a page whose ad frames keep mutating', async ({ context, extensionId, baseURL }) => {
test('@race stays ready on a page whose ad frames keep mutating', async ({ context, extensionId, baseURL }) => {
test.setTimeout(90000);
// Live ad churn wakes the media-frame monitor several times a second. Each
// wake used to schedule a trailing refresh that rebuilt the target
+21
View File
@@ -25,6 +25,27 @@ export default defineConfig({
args: ['--autoplay-policy=no-user-gesture-required']
}
},
projects: [
{
name: 'detection-chromium',
testMatch: 'detection.spec.mjs',
use: { browserName: 'chromium' }
},
{
name: 'detection-firefox',
testMatch: 'detection.spec.mjs',
use: { browserName: 'firefox' }
},
{
name: 'detection-webkit',
testMatch: 'detection.spec.mjs',
use: { browserName: 'webkit' }
},
{
name: 'extension-chromium',
testIgnore: 'detection.spec.mjs'
}
],
webServer: {
command: `node "${fileURLToPath(new URL('./fixture-server.mjs', import.meta.url))}" ${PORT}`,
url: `http://localhost:${PORT}/pages/simple-player.html`,