mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-21 01:35:53 +03:00
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:
co-authored by
Claude Opus 4.7
parent
ab10761667
commit
8bdcb9e664
@@ -13,7 +13,7 @@ export {
|
|||||||
export {
|
export {
|
||||||
pasteText, saveClipboard, restoreClipboard,
|
pasteText, saveClipboard, restoreClipboard,
|
||||||
} from './engine/core/clipboard.mjs';
|
} 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 { fetchErrorStack } from './engine/core/errors.mjs';
|
||||||
export { clickElement } from './engine/core/click.mjs';
|
export { clickElement } from './engine/core/click.mjs';
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { getGridToggleIcon, shouldClickToggle } from '../table/grid-toggle.mjs';
|
|||||||
import {
|
import {
|
||||||
clickSpreadsheetCell, findSpreadsheetCellByText,
|
clickSpreadsheetCell, findSpreadsheetCellByText,
|
||||||
} from '../table/spreadsheet.mjs';␍
|
} from '../table/spreadsheet.mjs';␍
|
||||||
import { getFormState } from './form-state.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).
|
/** Click a button/hyperlink/tab on the current form. Use {dblclick: true} to double-click (open items from lists).
|
||||||
* First argument can also be an object { row, column } to click a SpreadsheetDocument cell. */
|
* First argument can also be an object { row, column } to click a SpreadsheetDocument cell. */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import { page } from './state.mjs';
|
import { page } from './state.mjs';
|
||||||
import { dismissPendingErrors, checkForErrors } from './errors.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:
|
* 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 { 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 { waitForStable } from '../core/wait.mjs';
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from './state.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the current form/dialog via Escape.
|
* Close the current form/dialog via Escape.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
isTypeDialog, pickFromTypeDialog,
|
isTypeDialog, pickFromTypeDialog,
|
||||||
} from './select-value.mjs';␍
|
} from './select-value.mjs';␍
|
||||||
import { pasteText } from '../core/clipboard.mjs';
|
import { pasteText } from '../core/clipboard.mjs';
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from './state.mjs';
|
||||||
|
|
||||||
/** Fill fields on the current form via Playwright page.fill(). Returns fill results + updated form. */
|
/** Fill fields on the current form via Playwright page.fill(). Returns fill results + updated form. */
|
||||||
export async function fillFields(fields) {
|
export async function fillFields(fields) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
detectNewForm as helperDetectNewForm,
|
detectNewForm as helperDetectNewForm,
|
||||||
} from '../core/helpers.mjs';␍
|
} from '../core/helpers.mjs';␍
|
||||||
import { pasteText } from '../core/clipboard.mjs';
|
import { pasteText } from '../core/clipboard.mjs';
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from './state.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan visible grid rows for a text match (exact → startsWith → includes).
|
* Scan visible grid rows for a text match (exact → startsWith → includes).
|
||||||
|
|||||||
+3
-3
@@ -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
|
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
//
|
//
|
||||||
// getFormState — the canonical "what's on the screen right now" call. Combines:
|
// 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.
|
// 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 { 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. */
|
/** Read current form state. Single evaluate call via combined script. */
|
||||||
export async function getFormState() {
|
export async function getFormState() {
|
||||||
@@ -15,7 +15,7 @@ import { highlight, unhighlight } from '../recording/highlight.mjs';
|
|||||||
import { returnFormState } from '../core/helpers.mjs';␍
|
import { returnFormState } from '../core/helpers.mjs';␍
|
||||||
// Static import — ESM cycle that resolves at call time.
|
// Static import — ESM cycle that resolves at call time.
|
||||||
import { pasteText } from '../core/clipboard.mjs';
|
import { pasteText } from '../core/clipboard.mjs';
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from '../forms/state.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current page state: active section, tabs.
|
* Get current page state: active section, tabs.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export async function wait(seconds) {
|
|||||||
await page.waitForTimeout(ms);
|
await page.waitForTimeout(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { getFormState } = await import('../core/form-state.mjs');
|
const { getFormState } = await import('../forms/state.mjs');
|
||||||
return await getFormState();
|
return await getFormState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { highlight, unhighlight } from '../recording/highlight.mjs';
|
|||||||
import { safeClick } from '../core/helpers.mjs';
|
import { safeClick } from '../core/helpers.mjs';
|
||||||
import { selectValue, fillReferenceField } from '../forms/select-value.mjs';
|
import { selectValue, fillReferenceField } from '../forms/select-value.mjs';
|
||||||
import { pasteText } from '../core/clipboard.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';
|
import { clickElement } from '../core/click.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { detectFormScript, readTableScript, resolveGridScript } from '../../dom.
|
|||||||
import { dismissPendingErrors } from '../core/errors.mjs';
|
import { dismissPendingErrors } from '../core/errors.mjs';
|
||||||
import { waitForStable } from '../core/wait.mjs';
|
import { waitForStable } from '../core/wait.mjs';
|
||||||
import { clickElement } from '../core/click.mjs';␍
|
import { clickElement } from '../core/click.mjs';␍
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from '../forms/state.mjs';
|
||||||
|
|
||||||
/** Read structured table data with pagination. Returns columns, rows, total count. */
|
/** Read structured table data with pagination. Returns columns, rows, total count. */
|
||||||
export async function readTable({ maxRows = 20, offset = 0, table } = {}) {
|
export async function readTable({ maxRows = 20, offset = 0, table } = {}) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
fillReferenceField, selectValue,
|
fillReferenceField, selectValue,
|
||||||
} from '../forms/select-value.mjs';␍
|
} from '../forms/select-value.mjs';␍
|
||||||
import { pasteText } from '../core/clipboard.mjs';
|
import { pasteText } from '../core/clipboard.mjs';
|
||||||
import { getFormState } from '../core/form-state.mjs';
|
import { getFormState } from '../forms/state.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill cells in the current table row via Tab navigation.
|
* Fill cells in the current table row via Tab navigation.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { page, ensureConnected } from '../core/state.mjs';
|
import { page, ensureConnected } from '../core/state.mjs';
|
||||||
import { detectFormScript } from '../../dom.mjs';
|
import { detectFormScript } from '../../dom.mjs';
|
||||||
import { waitForStable } from '../core/wait.mjs';␍
|
import { waitForStable } from '../core/wait.mjs';␍
|
||||||
import { getFormState } from '../core/form-state.mjs';␍
|
import { getFormState } from '../forms/state.mjs';␍
|
||||||
|
|
||||||
// --- Spreadsheet helpers (shared by readSpreadsheet and clickElement) ---
|
// --- Spreadsheet helpers (shared by readSpreadsheet and clickElement) ---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user