From d0a6c9622bbef490058c2d7a62a9d268c5871775 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 05:09:46 +0000 Subject: [PATCH 1/2] feat: add Playwright agent testability infrastructure Add test harness (window.__bitvidTest__), data-testid attributes, relay override support, and Playwright fixtures so agents can programmatically login, seed relay data, and inspect app state during E2E testing. - js/testHarness.js: exposes loginWithNsec, getAppState, relay overrides - data-testid attrs on login/upload/video modals, header buttons, feed - simple-relay.mjs: HTTP seeding API (POST /seed, GET /events, /health) - bitvidTestFixture.ts: reusable Playwright fixture with mock relay - agent-testability.spec.ts: E2E tests validating the infrastructure https://claude.ai/code/session_01XnrszNmdqrAGd8g8qhAn4G --- components/login-modal.html | 5 +- components/upload-modal.html | 9 +- components/video-modal.html | 1 + index.html | 4 + js/index.js | 5 + js/testHarness.js | 281 +++++++++++++++++++++++++ js/ui/components/VideoCard.js | 1 + scripts/agent/simple-relay.mjs | 159 ++++++++++++-- tests/e2e/agent-testability.spec.ts | 187 ++++++++++++++++ tests/e2e/helpers/bitvidTestFixture.ts | 210 ++++++++++++++++++ views/explore.html | 2 +- views/for-you.html | 2 +- views/most-recent-videos.html | 2 +- 13 files changed, 839 insertions(+), 29 deletions(-) create mode 100644 js/testHarness.js create mode 100644 tests/e2e/agent-testability.spec.ts create mode 100644 tests/e2e/helpers/bitvidTestFixture.ts diff --git a/components/login-modal.html b/components/login-modal.html index 41ee6f9f..6ec0e560 100644 --- a/components/login-modal.html +++ b/components/login-modal.html @@ -6,6 +6,7 @@ aria-labelledby="loginModalTitle" aria-describedby="loginModalDescription" data-ds="new" + data-testid="login-modal" >
@@ -91,6 +92,7 @@ class="login-option" type="button" data-provider-button + data-testid="login-provider-button" >