mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-11 08:24:57 +03:00
fix(web-test): убрать стуб showCaption/hideCaption в cmdTest
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user