From a650325baf033ec0d4156bafd1d67d993cb5aa72 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Mon, 11 May 2026 11:37:42 +0300 Subject: [PATCH] =?UTF-8?q?fix(web-test):=20=D1=83=D0=B1=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D1=81=D1=82=D1=83=D0=B1=20showCaption/hideCaption=20?= =?UTF-8?q?=D0=B2=20cmdTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run.mjs v1.10: cmdTest больше не передаёт noRecord:true в buildContext. Тестам доступен полный API browser.mjs (showCaption, hideCaption, startRecording, stopRecording, addNarration). Изначальный стуб с noRecord:true прятал showCaption/hideCaption тестов вместе с recording-функциями. Это блокировало визуальные оверлеи в мульти-контекстных тестах: a.showCaption() тихо превращался в no-op, баннер никогда не отображался даже под --record. Smart wait внутри showCaption и так гейтится на наличие recorder (`if (recorder && ...)`), поэтому без --record тесты остаются быстрыми (никаких 2-секундных пауз на каждый вызов). startRecording/stopRecording/addNarration теперь тоже доступны тестам. При попытке вызвать startRecording в момент активной runner-записи browser.startRecording бросает "Already recording" — loud failure лучше silent no-op. Регресс: 15-multi-context-handover один проходит за 19.9s. Полный прогон 10/12 (04 и 15 флапают независимо в последовательности). Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/skills/web-test/scripts/run.mjs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.claude/skills/web-test/scripts/run.mjs b/.claude/skills/web-test/scripts/run.mjs index 96ab0148..ee360d5d 100644 --- a/.claude/skills/web-test/scripts/run.mjs +++ b/.claude/skills/web-test/scripts/run.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// web-test run v1.9 — CLI runner for 1C web client automation +// web-test run v1.10 — CLI runner for 1C web client automation // Source: https://github.com/Nikolay-Shirokov/cc-1c-skills /** * CLI runner for 1C web client automation. @@ -113,8 +113,8 @@ async function handleRequest(req, res) { * is prefixed with `setActiveContext(name)` so the test can interleave actions * across contexts (`ctx.a.click(...); ctx.b.click(...)`). */ -function buildScopedContext(name, { noRecord = false } = {}) { - const inner = buildContext({ noRecord }); +function buildScopedContext(name) { + const inner = buildContext({ noRecord: false }); const scoped = {}; for (const [k, v] of Object.entries(inner)) { if (typeof v === 'function') { @@ -512,8 +512,11 @@ async function cmdTest(rawArgs) { // Connect: create the default context up front (so beforeAll has a working browser) await ensureContext(defaultContextName); - // Build context — flat API for single-context tests; reused across tests via setActiveContext - const ctx = buildContext({ noRecord: true }); + // Build context — flat API for single-context tests; reused across tests via setActiveContext. + // noRecord: false → tests get full API (showCaption, startRecording, etc.). The runner manages + // its own recording via --record; if a test author calls startRecording while the runner already + // records, browser.startRecording throws "Already recording" (loud failure beats silent no-op). + const ctx = buildContext({ noRecord: false }); ctx.assert = createAssertions(); ctx.log = (...a) => { /* per-test, overridden below */ }; @@ -599,7 +602,7 @@ async function cmdTest(rawArgs) { const scopedKeys = []; if (t.contexts && t.contexts.length) { for (const cn of t.contexts) { - ctx[cn] = buildScopedContext(cn, { noRecord: true }); + ctx[cn] = buildScopedContext(cn); scopedKeys.push(cn); } }