From d8a2ce9398ff9c9dc6ec429252952de94fe01f4b Mon Sep 17 00:00:00 2001 From: ksemenenko Date: Thu, 2 Apr 2026 22:21:04 +0200 Subject: [PATCH] Address browser test review fixes --- AGENTS.md | 1 + .../Learn/LearnStartupAlignmentTests.cs | 2 +- .../Media/recording-file-harness.js | 30 +++++++++++++++---- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 73eb511..bb0aca2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -423,6 +423,7 @@ Ask first: - progress updates that talk about internal skill routing instead of the concrete repo change - long exploratory work before producing the concrete vendored files the user explicitly asked for - unexpected browser debugger pause hooks in the default dev launch profile; browser debugging must stay explicit opt-in +- temporary worktrees or throwaway repo copies for normal repo tasks when the current workspace branch is available; work in the active workspace unless the user explicitly asks for isolation ## Preferred Skills diff --git a/tests/PrompterOne.App.UITests/Learn/LearnStartupAlignmentTests.cs b/tests/PrompterOne.App.UITests/Learn/LearnStartupAlignmentTests.cs index bcbc089..46e88e8 100644 --- a/tests/PrompterOne.App.UITests/Learn/LearnStartupAlignmentTests.cs +++ b/tests/PrompterOne.App.UITests/Learn/LearnStartupAlignmentTests.cs @@ -101,13 +101,13 @@ private static string BuildStartupTraceScript() let animationFramePasses = 0; const captureOnAnimationFrame = () => { + animationFramePasses += 1; capture(); if (window.__learnStartupTrace.length >= maxSamples || animationFramePasses >= maxAnimationFramePasses) { return; } - animationFramePasses += 1; window.requestAnimationFrame(captureOnAnimationFrame); }; diff --git a/tests/PrompterOne.App.UITests/Media/recording-file-harness.js b/tests/PrompterOne.App.UITests/Media/recording-file-harness.js index 17386f8..2cc5210 100644 --- a/tests/PrompterOne.App.UITests/Media/recording-file-harness.js +++ b/tests/PrompterOne.App.UITests/Media/recording-file-harness.js @@ -118,12 +118,32 @@ } async function waitForNextVideoFrame(videoElement) { - if (typeof videoElement.requestVideoFrameCallback === "function") { - await new Promise(resolve => videoElement.requestVideoFrameCallback(() => resolve())); - return; - } + await new Promise(resolve => { + let completed = false; + + const finish = () => { + if (completed) { + return; + } + + completed = true; + resolve(); + }; - await new Promise(resolve => window.setTimeout(resolve, visibleVideoPollDelayMs)); + const timeoutId = window.setTimeout(finish, visibleVideoPollDelayMs); + const canAwaitVideoFrame = typeof videoElement.requestVideoFrameCallback === "function" + && !videoElement.paused + && !videoElement.ended; + + if (!canAwaitVideoFrame) { + return; + } + + videoElement.requestVideoFrameCallback(() => { + window.clearTimeout(timeoutId); + finish(); + }); + }); } async function detectVisibleVideoAcrossFrames(videoElement) {