mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-13 15:03:20 +03:00
refactor(web-test): этап E.13 — финализация (v1.17 + чистый facade + чистка)
1. Версия v1.16 → v1.17 во всех заголовках движка.
2. browser.mjs стал чистым facade — только re-exports, 0 функций определено.
Было: 249 LOC с 4 настоящими функциями (saveClipboard, restoreClipboard,
pasteText, getFormState) — теперь 57 LOC чистых re-export'ов.
3. engine/core/clipboard.mjs — новый модуль:
pasteText + saveClipboard + restoreClipboard (~85 LOC, был в browser.mjs).
4. engine/core/form-state.mjs — новый модуль:
getFormState — центральный читатель состояния формы (~30 LOC).
5. Убрано 12 циклических импортов из engine/* → ../../browser.mjs:
- Все читатели pasteText теперь импортят из engine/core/clipboard.mjs
- Все читатели getFormState — из engine/core/form-state.mjs
- session.mjs → nav/navigation.mjs (getPageState напрямую)
- filter.mjs → core/click.mjs (clickElement напрямую)
Граф зависимостей стал деревом (без обратных рёбер).
6. Убраны _-префиксы у 9 функций, которые стали приватными внутри своих
модулей (раньше _ означало "приватная для browser.mjs"):
_detectPlatformDialogs → detectPlatformDialogs
_closePlatformDialogs → closePlatformDialogs
_parseErrorStack → parseErrorStack
_fetchStackViaReport → fetchStackViaReport
_fetchStackViaHamburger → fetchStackViaHamburger
_logoutSlot → logoutSlot
_saveActiveSlot → saveActiveSlot
_activateSlot → activateSlot
_attachSessionListeners → attachSessionListeners
Публичный API: 56 экспортов, идентичный исходному.
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
8739d1d15c
commit
a24c39b6de
@@ -1,11 +1,11 @@
|
||||
// web-test forms/close v1.16 — Close current form via Escape, handle save-changes confirmation.
|
||||
// web-test forms/close v1.17 — Close current form via Escape, handle save-changes confirmation.
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import { page, recorder, ensureConnected } from '../core/state.mjs';
|
||||
import { detectFormScript } from '../../dom.mjs';
|
||||
import { dismissPendingErrors, checkForErrors, _detectPlatformDialogs, _closePlatformDialogs } from '../core/errors.mjs';
|
||||
import { dismissPendingErrors, checkForErrors, detectPlatformDialogs, closePlatformDialogs } from '../core/errors.mjs';
|
||||
import { waitForStable } from '../core/wait.mjs';
|
||||
import { getFormState } from '../../browser.mjs';
|
||||
import { getFormState } from '../core/form-state.mjs';
|
||||
|
||||
/**
|
||||
* Close the current form/dialog via Escape.
|
||||
@@ -19,9 +19,9 @@ export async function closeForm({ save } = {}) {
|
||||
ensureConnected();
|
||||
await dismissPendingErrors();
|
||||
// If platform dialogs are open, close them instead of pressing Escape
|
||||
const pd = await _detectPlatformDialogs();
|
||||
const pd = await detectPlatformDialogs();
|
||||
if (pd.length) {
|
||||
await _closePlatformDialogs();
|
||||
await closePlatformDialogs();
|
||||
await page.waitForTimeout(300);
|
||||
const state = await getFormState();
|
||||
state.closed = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// web-test forms/fill v1.16 — Fill form fields by name (text/checkbox/date/dropdown/reference). Delegates references to selectValue / fillReferenceField.
|
||||
// web-test forms/fill v1.17 — Fill form fields by name (text/checkbox/date/dropdown/reference). Delegates references to selectValue / fillReferenceField.
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import {
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
isTypeDialog, pickFromTypeDialog,
|
||||
} from './select-value.mjs';
|
||||
// pasteText + getFormState live in browser.mjs.
|
||||
import { pasteText, getFormState } from '../../browser.mjs';
|
||||
import { pasteText } from '../core/clipboard.mjs';
|
||||
import { getFormState } from '../core/form-state.mjs';
|
||||
|
||||
/** Fill fields on the current form via Playwright page.fill(). Returns fill results + updated form. */
|
||||
export async function fillFields(fields) {
|
||||
|
||||
@@ -16,7 +16,8 @@ import {
|
||||
detectNewForm as helperDetectNewForm,
|
||||
} from '../core/helpers.mjs';
|
||||
// pasteText + getFormState live in browser.mjs.
|
||||
import { pasteText, getFormState } from '../../browser.mjs';
|
||||
import { pasteText } from '../core/clipboard.mjs';
|
||||
import { getFormState } from '../core/form-state.mjs';
|
||||
|
||||
/**
|
||||
* Scan visible grid rows for a text match (exact → startsWith → includes).
|
||||
|
||||
Reference in New Issue
Block a user