mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-01 17:27:45 +03:00
feat(web-test): управление пулом контекстов/лицензий в раннере
Раннер регресса теперь держит пул 1С-сеансов сам, вместо накопления контекстов
между тестами и ручного закрытия в хуках. Три необязательных поля webtest.config.mjs
(без них поведение прежнее):
- maxContexts — потолок одновременно живых сеансов (null = без лимита);
- contextPolicy — 'reuse' (держать открытыми в пределах лимита) | 'strict'
(закрывать non-pinned контексты теста сразу после него);
- pinnedContexts — не вытесняются LRU (default = [defaultContext]; [] делает
default вытесняемым на тесном стенде).
Перед setup каждого теста LRU-вытеснение освобождает слот под нужды теста;
уже открытые нужные контексты переиспользуются. Default больше не вечно-pinned.
Исчерпание пула даёт внятную ошибку вместо маскирующего «Browser not connected».
- new: cli/test-runner/context-pool.mjs — чистый планировщик planEviction + LRU.
- cli/commands/test.mjs (v1.4): парсинг/валидация полей, вытеснение с фолбэк-парковкой
на нужный контекст (нельзя закрыть единственный активный), strict-закрытие, LRU-трекинг.
- Доки: regression-spec (§7/§8/глоссарий), regression-guide (рецепт), regress.md.
- Регресс дай-фудит фичу: 14-multi-context-routing роутит в 3-й контекст c,
15-multi-context-handover проверяет вытеснение c на границе; конфиг maxContexts:2.
Юнит-краёв планировщика — в debug/ (gitignored). Live-регресс: 25/25 зелёных.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9e1341b80b
commit
3f1168b975
@@ -1,22 +1,24 @@
|
||||
export const name = 'Multi-context: routing single test to non-default context';
|
||||
export const tags = ['multi-context', 'smoke'];
|
||||
export const context = 'b';
|
||||
export const context = 'c';
|
||||
export const timeout = 60000;
|
||||
|
||||
export default async function({ getPageState, navigateSection, openCommand, closeForm, assert, step, log }) {
|
||||
|
||||
await step('Active context is b', async () => {
|
||||
// Sanity check — ensure we are routed into b's session
|
||||
await step('Active context is c', async () => {
|
||||
// Sanity check — ensure we are routed into c's session (a third, non-default context).
|
||||
// Leaving c open here is intentional: it becomes the LRU eviction candidate at the
|
||||
// 14→15 boundary under maxContexts:2 (asserted in 15-multi-context-handover).
|
||||
const state = await getPageState();
|
||||
assert.ok(Array.isArray(state.sections) && state.sections.length, 'Sections should be visible');
|
||||
log('Sections in b: ' + state.sections.map(s => s.name).join(', '));
|
||||
log('Sections in c: ' + state.sections.map(s => s.name).join(', '));
|
||||
});
|
||||
|
||||
await step('Open Контрагенты in context b', async () => {
|
||||
await step('Open Контрагенты in context c', async () => {
|
||||
await navigateSection('Склад');
|
||||
const state = await openCommand('Контрагенты');
|
||||
assert.ok(state.form != null, 'List form should open');
|
||||
log('Opened in b: ' + state.title);
|
||||
log('Opened in c: ' + state.title);
|
||||
await closeForm();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user