mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-30 00:16:56 +03:00
docs(web-test): полный sync спеки + contexts[] в testResult
spec.md v0.2 (последний sync 2026-05-13): §1 CLI: добавлены --report-dir и `--` separator в таблицу флагов. §1 «Режим выполнения»: убрана несуществующая «группировка по контексту», описана реальная алфавитная модель + lazy ensureContext. §2 пример multi-context: latin ID контекстов вместо кириллицы (clerk/manager) + showcase closeContext в финальном шаге. §3 список API расширен: контексты (createContext/closeContext/setActive/ listContexts/hasContext/getActiveContext), overlay-helpers (hideTitleSlide/ hideImage/setHighlight/isHighlightMode), error-helpers (dismissPendingErrors/ fetchErrorStack). §6 пример _hooks.mjs: убран mock-навигация в beforeAll, добавлены примеры afterOpenContext/beforeCloseContext, afterEach показывает testResult. §8 переписан раздел «Реализация в browser.mjs» (мульти-контекст уже live) + новая таблица режимов изоляции tab/window. §9 JSON example: поле "context" → "contexts": [...] (массив). §10: убрано упоминание несуществующего verbose-режима. §13 «Параметризация»: убран статус «будущее», описана реальная семантика T6 (template name, param 2-м аргументом, testInfo.param). §14 buildContext: переписан под done-состояние + scoped-вариант. §16 каталог тест-кейсов: 13 → 19 файлов (multi-context, recording, errors-stack, tree-form, misc, hooks). §17 дорожная карта: 10 → 18 пунктов, M4–M8 включены. run.mjs: - testResult получил поле contexts: [...names] во всех ветках (passed/failed/skipped/context-setup-failed). Раннер передаёт declaredContexts из единой точки до if(skip), чтобы skip-результаты тоже несли структурную информацию. Регресс 19/19 ✓ (9m 8.7s) после --rebuild-stand. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
eb87be5c04
commit
1eff62de42
@@ -571,25 +571,29 @@ async function cmdTest(rawArgs) {
|
||||
let testIdx = 0;
|
||||
for (const t of filtered) {
|
||||
testIdx++;
|
||||
// Declared contexts — нужны и в skip-ветке, и в основной, чтобы все
|
||||
// testResult-записи в отчёте всегда содержали `contexts` поле.
|
||||
const declaredContexts = t.contexts && t.contexts.length
|
||||
? t.contexts
|
||||
: [t.context || defaultContextName];
|
||||
|
||||
if (t.skip) {
|
||||
const reason = typeof t.skip === 'string' ? t.skip : '';
|
||||
W.write(` \u25CB ${t.name}${reason ? ` (skip: ${reason})` : ' (skip)'}\n`);
|
||||
results.push({ name: t.name, file: t.file, tags: t.tags, status: 'skipped', duration: 0, attempts: 0, steps: [], output: '', error: null, screenshot: null });
|
||||
results.push({ name: t.name, file: t.file, tags: t.tags, contexts: declaredContexts, status: 'skipped', duration: 0, attempts: 0, steps: [], output: '', error: null, screenshot: null });
|
||||
skipCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Resolve test's contexts: multi (t.contexts) or single (t.context || default).
|
||||
// Lazy-create them and set active to the primary one.
|
||||
const testContextNames = t.contexts && t.contexts.length
|
||||
? t.contexts
|
||||
: [t.context || defaultContextName];
|
||||
const testContextNames = declaredContexts;
|
||||
try {
|
||||
for (const cn of testContextNames) await ensureContext(cn);
|
||||
await browser.setActiveContext(testContextNames[0]);
|
||||
} catch (e) {
|
||||
W.write(` ✗ ${t.name} (context setup failed: ${e.message})\n`);
|
||||
results.push({ name: t.name, file: t.file, tags: t.tags, status: 'failed', duration: 0, attempts: 0, steps: [], output: '', error: { message: e.message }, screenshot: null });
|
||||
results.push({ name: t.name, file: t.file, tags: t.tags, contexts: declaredContexts, status: 'failed', duration: 0, attempts: 0, steps: [], output: '', error: { message: e.message }, screenshot: null });
|
||||
failCount++;
|
||||
if (opts.bail) break;
|
||||
continue;
|
||||
@@ -697,7 +701,7 @@ async function cmdTest(rawArgs) {
|
||||
try { await browser.stopRecording(); } catch {}
|
||||
}
|
||||
const dur = elapsed(t0);
|
||||
testResult = { name: t.name, file: t.file, tags: t.tags, status: 'passed', duration: dur, attempts: attempt, start: t0, stop: Date.now(), steps, output: output.join('\n'), error: null, screenshot: null, video: videoFile };
|
||||
testResult = { name: t.name, file: t.file, tags: t.tags, contexts: testContextNames, status: 'passed', duration: dur, attempts: attempt, start: t0, stop: Date.now(), steps, output: output.join('\n'), error: null, screenshot: null, video: videoFile };
|
||||
lastError = null;
|
||||
break;
|
||||
|
||||
@@ -731,7 +735,7 @@ async function cmdTest(rawArgs) {
|
||||
}
|
||||
lastError = { message: e.message, step: e.onecError?.step, screenshot: shotFile };
|
||||
const dur = elapsed(t0);
|
||||
testResult = { name: t.name, file: t.file, tags: t.tags, status: 'failed', duration: dur, attempts: attempt, start: t0, stop: Date.now(), steps, output: output.join('\n'), error: lastError, screenshot: shotFile, video: videoFile };
|
||||
testResult = { name: t.name, file: t.file, tags: t.tags, contexts: testContextNames, status: 'failed', duration: dur, attempts: attempt, start: t0, stop: Date.now(), steps, output: output.join('\n'), error: lastError, screenshot: shotFile, video: videoFile };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user