From cc9064617ef9bbec02b6c1126e1772c6e3cf9517 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:36:41 +0000 Subject: [PATCH] fix(tests): remediate known issues in LoginModal and VideoCard tests - Fix `LoginModalController` async activity leak by binding `setTimeout` to `this.window`. - Fix `VideoCard` moderation test by explicitly updating `ModerationDecorator` settings. - Verify `popover.spec.ts` issue persists and update `KNOWN_ISSUES.md`. - Update `KNOWN_ISSUES.md` to reflect fixes and current status. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- KNOWN_ISSUES.md | 6 ++---- js/ui/loginModalController.js | 4 +++- tests/login-modal-controller.test.mjs | 3 +-- tests/moderation/video-card.test.mjs | 9 +++++++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index 074937b0..6573fb68 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -3,14 +3,12 @@ ## Tests ### Unit Tests -- `npm run test:unit` may time out in resource-constrained environments (like CI) when running the full suite serially. CI workflows use sharding (`test:unit:shardX`) to mitigate this. Targeted testing (`test:dm:unit`, `test:dm:integration`) is recommended for local development focus. (Last checked: 2024-05-22) +- `npm run test:unit` may time out in resource-constrained environments (like CI) when running the full suite serially. CI workflows use sharding (`test:unit:shardX`) to mitigate this. Targeted testing (`test:dm:unit`, `test:dm:integration`) is recommended for local development focus. (Last checked: 2025-02-23) ### Skipped Tests The following tests are skipped due to flakiness or environmental issues and should be investigated: -- `tests/e2e/popover.spec.ts`: `keeps the bottom-right grid menu inside the viewport` (Visual regression layout issue) -- `tests/moderation/video-card.test.mjs`: `VideoCard block action restores trusted mute hide state after override` (Logic issue with state restoration) -- `tests/login-modal-controller.test.mjs`: `LoginModalController shows NIP-46 handshake panel` (JSDOM async activity leak) +- `tests/e2e/popover.spec.ts`: `keeps the bottom-right grid menu inside the viewport` (Visual regression layout issue: Floating UI `flip` middleware fails to respect viewport boundary in constrained height scenarios. Verified 2025-02-23, fix attempt failed.) ### Visual Regression Tests (`test:visual`) - **Artifact Retention**: Visual tests are configured to retain screenshots, traces, and videos on failure to assist with debugging. These artifacts can be found in `artifacts/test-results/`. diff --git a/js/ui/loginModalController.js b/js/ui/loginModalController.js index bc323ecd..bf8e512d 100644 --- a/js/ui/loginModalController.js +++ b/js/ui/loginModalController.js @@ -1571,7 +1571,9 @@ export default class LoginModalController { } // Kick off the handshake generation - this.nip46AutoStartTimer = setTimeout(autoStart, 0); + if (this.window && typeof this.window.setTimeout === "function") { + this.nip46AutoStartTimer = this.window.setTimeout(autoStart, 0); + } }); } diff --git a/tests/login-modal-controller.test.mjs b/tests/login-modal-controller.test.mjs index ea356529..27e2aa13 100644 --- a/tests/login-modal-controller.test.mjs +++ b/tests/login-modal-controller.test.mjs @@ -249,8 +249,7 @@ test('LoginModalController does not set required attribute when toggling modes', assert.equal(unlockPassphrase.required, false); }); -// flaky: JSDOM async activity leak (HTMLElement not defined) -test.skip('LoginModalController shows NIP-46 handshake panel', async (t) => { +test('LoginModalController shows NIP-46 handshake panel', async (t) => { const providers = [{ id: 'nip46', label: 'Remote Signer', login: async () => {} }]; const authService = { requestLogin: async () => {} }; controller = createController({ providers, services: { authService } }); diff --git a/tests/moderation/video-card.test.mjs b/tests/moderation/video-card.test.mjs index dba192ed..fb11f61e 100644 --- a/tests/moderation/video-card.test.mjs +++ b/tests/moderation/video-card.test.mjs @@ -402,8 +402,7 @@ test("VideoCard blurs thumbnails when trusted mute triggers without reports", as assert.equal(card.moderationBlockButton.textContent, "Block"); }); -// flaky: Consistently fails - logic issue with state restoration (contextAfterHide.activeHidden is false) -test.skip("VideoCard block action restores trusted mute hide state after override", async (t) => { +test("VideoCard block action restores trusted mute hide state after override", async (t) => { const { document } = setupDom(t); withMockedNostrTools(t); @@ -414,6 +413,12 @@ test.skip("VideoCard block action restores trusted mute hide state after overrid trustedMuteHideThreshold: 1, trustedSpamHideThreshold: Number.POSITIVE_INFINITY, }); + app.moderationDecorator.updateSettings({ + trustedMuteHideThreshold: 1, + autoplayBlockThreshold: Number.POSITIVE_INFINITY, + blurThreshold: Number.POSITIVE_INFINITY, + trustedSpamHideThreshold: Number.POSITIVE_INFINITY, + }); app.pubkey = "f".repeat(64); app.isUserLoggedIn = () => true; app.showStatus = () => {};