refactor(web-test): form-state переехал из core/ в forms/

getFormState — высокоуровневая операция «прочитать состояние формы»,
семантически в forms/ ближе чем в core/ (foundational плумбинг движка).

  engine/core/form-state.mjs → engine/forms/state.mjs

Все 11 importer'ов обновлены. Внутри state.mjs пути исправлены:
'./state.mjs' → '../core/state.mjs', './errors.mjs' → '../core/errors.mjs'.

03-fillfields регресс зелёный.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-05-26 16:48:08 +03:00
parent ab10761667
commit 8bdcb9e664
13 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export {
export {
pasteText, saveClipboard, restoreClipboard,
} from './engine/core/clipboard.mjs';
export { getFormState } from './engine/core/form-state.mjs';
export { getFormState } from './engine/forms/state.mjs';
export { fetchErrorStack } from './engine/core/errors.mjs';
export { clickElement } from './engine/core/click.mjs';
@@ -15,7 +15,7 @@ import { getGridToggleIcon, shouldClickToggle } from '../table/grid-toggle.mjs';
import {
clickSpreadsheetCell, findSpreadsheetCellByText,
} from '../table/spreadsheet.mjs';
import { getFormState } from '../forms/state.mjs';
/** Click a button/hyperlink/tab on the current form. Use {dblclick: true} to double-click (open items from lists).
@@ -4,7 +4,7 @@
import { page } from './state.mjs';
import { dismissPendingErrors, checkForErrors } from './errors.mjs';
import { getFormState } from './form-state.mjs';
import { getFormState } from '../forms/state.mjs';
/**
* page.click with the standard "intercepts pointer events" retry ladder:
@@ -5,7 +5,7 @@ import { page, recorder, ensureConnected } from '../core/state.mjs';
import { detectFormScript } from '../../dom.mjs';
import { dismissPendingErrors, checkForErrors, detectPlatformDialogs, closePlatformDialogs } from '../core/errors.mjs';
import { waitForStable } from '../core/wait.mjs';
import { getFormState } from '../core/form-state.mjs';
import { getFormState } from './state.mjs';
/**
* Close the current form/dialog via Escape.
@@ -15,7 +15,7 @@ import {
isTypeDialog, pickFromTypeDialog,
} from './select-value.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { getFormState } from './state.mjs';
/** Fill fields on the current form via Playwright page.fill(). Returns fill results + updated form. */
@@ -16,7 +16,7 @@ import {
detectNewForm as helperDetectNewForm,
} from '../core/helpers.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { getFormState } from './state.mjs';
/**
@@ -1,4 +1,4 @@
// web-test engine/core/form-state v1.17 — central form-state reader.
// web-test engine/forms/state v1.17 — central form-state reader.
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
//
// getFormState — the canonical "what's on the screen right now" call. Combines:
@@ -8,9 +8,9 @@
//
// Returned by virtually every action-function as the "after" snapshot.
import { page, ensureConnected } from './state.mjs';
import { page, ensureConnected } from '../core/state.mjs';
import { getFormStateScript } from '../../dom.mjs';
import { checkForErrors, detectPlatformDialogs } from './errors.mjs';
import { checkForErrors, detectPlatformDialogs } from '../core/errors.mjs';
/** Read current form state. Single evaluate call via combined script. */
export async function getFormState() {
@@ -15,7 +15,7 @@ import { highlight, unhighlight } from '../recording/highlight.mjs';
import { returnFormState } from '../core/helpers.mjs';
// Static import — ESM cycle that resolves at call time.
import { pasteText } from '../core/clipboard.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { getFormState } from '../forms/state.mjs';
/**
@@ -44,7 +44,7 @@ export async function wait(seconds) {
} else {
await page.waitForTimeout(ms);
}
}
}
const { getFormState } = await import('../forms/state.mjs');
return await getFormState();
}
@@ -9,7 +9,7 @@ import { highlight, unhighlight } from '../recording/highlight.mjs';
import { safeClick } from '../core/helpers.mjs';
import { selectValue, fillReferenceField } from '../forms/select-value.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { getFormState } from '../core/form-state.mjs';
import { getFormState } from '../forms/state.mjs';
import { clickElement } from '../core/click.mjs';
/**
@@ -10,7 +10,7 @@ import { detectFormScript, readTableScript, resolveGridScript } from '../../dom.
import { dismissPendingErrors } from '../core/errors.mjs';
import { waitForStable } from '../core/wait.mjs';
import { clickElement } from '../core/click.mjs';
import { getFormState } from '../forms/state.mjs';
/** Read structured table data with pagination. Returns columns, rows, total count. */
@@ -20,7 +20,7 @@ import {
fillReferenceField, selectValue,
} from '../forms/select-value.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { pasteText } from '../core/clipboard.mjs';
import { getFormState } from '../forms/state.mjs';
/**
@@ -4,7 +4,7 @@
import { page, ensureConnected } from '../core/state.mjs';
import { detectFormScript } from '../../dom.mjs';
import { waitForStable } from '../core/wait.mjs';
import { getFormState } from '../forms/state.mjs';