Commit Graph

237 Commits

Author SHA1 Message Date
Nick Shirokov f9439dce6d docs(web-test): expand guide with detailed API, modes, and complex scenario
- Detailed description of autonomous vs interactive modes with examples
- Full API reference with signatures, return shapes, and code samples
- Complex autonomous scenario: compare stock reports across two warehouses
- Troubleshooting table for common errors
- Keyboard shortcuts reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:05:35 +03:00
Nick Shirokov 336466ae82 merge: dev-web → main — web-test browser automation skill 2026-02-28 17:59:24 +03:00
Nick Shirokov 59d223d72b docs: add web-test guide and README entry
- New docs/web-test-guide.md with usage scenarios, API overview, DCS filters
- README: add web-test row to skills table, directory structure, Node.js requirement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:55:59 +03:00
Nick Shirokov f56f5dc849 docs(web-test): add anti-loop guidelines to SKILL.md
Prevent models from endlessly retrying the same failed search.
Rules: max 2 attempts per approach, try alternatives not repeats,
report partial results instead of silent retry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:53:04 +03:00
Nick Shirokov 1fd3d8ffb8 docs(web-test): rewrite SKILL.md following Anthropic best practices
- Structured API reference with signatures, return types, and inline examples
- Added readSpreadsheet structured format (title, headers, data, totals)
- Added readTable pagination, tree, hierarchy documentation
- Added DCS reportSettings and human-readable labels for fillFields/selectValue
- Added decision guides (when to use which reading/closing method)
- Progressive disclosure: quick start → modes → API → patterns → notes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:49:40 +03:00
Nick Shirokov d6befb0dc8 feat(web-test): DCS report settings — human-readable labels for fillFields/selectValue/getFormState
fillFields({ 'Склад': 'value' }) now auto-resolves via DCS pair label
and auto-enables the checkbox. getFormState() returns reportSettings
array with readable names instead of raw КомпоновщикНастроек... fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:05:16 +03:00
Nick Shirokov 5120b135f5 fix(web-test): use e1cib/app/ for reports and data processors
Reports and DataProcessors need e1cib/app/ prefix (opens app form),
while lists/registers/catalogs use e1cib/list/ (opens list form).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:38:21 +03:00
Nick Shirokov 5d18bf4501 fix(web-test): scope readSpreadsheet to current form, improve headers
Two fixes:
- Scope iframe scanning to current form container (prevents reading
  stale data from other open report tabs)
- Improved header detection: use LAST row before data as detail header,
  previous row as group header with fill-forward for merged cells.
  Fixes two-level headers like "Начальный остаток / Долг клиента"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:34:42 +03:00
Nick Shirokov 366378c4b5 feat(web-test): structured readSpreadsheet with header detection
Parse SpreadsheetDocument into { title, meta, headers, data, totals }:
- Auto-detect header row (most non-empty before first numeric row)
- Group header prefix for duplicate column names (Сейчас/Доступно)
- Data rows as objects {column: value}, only non-empty cells
- Separate totals row (Итого/Всего)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:17:40 +03:00
Nick Shirokov 56203e2b71 feat(web-test): add readSpreadsheet() for extracting report data
Reads 1C SpreadsheetDocument (report output) rendered in iframes.
Collects cells from div[x]/div[y] elements across all frames,
returns { rows: string[][], total }.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 16:07:19 +03:00
Nick Shirokov ff14880871 docs(web-test): simplify navigateLink examples in SKILL.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:48:12 +03:00
Nick Shirokov a17a81fe98 feat(web-test): normalize navigateLink URLs
- Auto-prepend e1cib/list/ when missing
- Translate English type names to Russian (AccumulationRegister → РегистрНакопления, etc.)
- Accepts: full e1cib/..., short Тип.Имя, or English Type.Имя

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:46:30 +03:00
Nick Shirokov e58f5c1f82 feat(web-test): add navigateLink() for direct 1C navigation links
- navigateLink(url): opens form via Shift+F11 dialog with clipboard paste
- Grant clipboard-read/write permissions on browser context creation
- Register navigateLink in ACTION_FNS for auto-error detection
- Document in SKILL.md with examples (e1cib/list/...)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:37:58 +03:00
Nick Shirokov 0fbdd298ca docs(web-test): improve SKILL.md API discoverability
- getFormState: clarify returns table meta (columns + rowCount), not row data
- readTable: document return shape, add hint to use for grid contents
- closeForm: document {save} parameter and auto-confirm behavior
- Update closing forms patterns with save:true/false/omit variants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:17:05 +03:00
Nick Shirokov 68fd9bb4a7 feat(web-test): closeForm({ save }) auto-handles confirmation dialog
closeForm now accepts { save: true/false } option:
- save: false → clicks "Нет" on "Save changes?" dialog
- save: true  → clicks "Да" to save and close
- undefined   → returns confirmation as hint (previous behavior)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:06:19 +03:00
Nick Shirokov e18e8cd284 fix(web-test): auto-dismiss pending error modals before actions
Action functions now call dismissPendingErrors() at start, so a leftover
error modal from a previous operation doesn't block subsequent actions.
Diagnostic functions (getFormState, screenshot) are unchanged — they
show current state as-is.

Key fixes:
- Target OK button within modal's form container (#formN_container)
  to avoid clicking wrong pressDefault on the page
- Use force:true click to bypass #modalSurface pointer intercept
- Replace local dismissErrors() in fillReferenceField with shared fn

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 15:02:29 +03:00
Nick Shirokov 5ea6414585 fix(web-test): detect modal errors without #modalSurface dependency
1C platform shows some modal dialogs (e.g. "Не удалось записать") via
ps*win floating windows WITHOUT setting #modalSurface visible. Removed
the modalSurface gate from checkErrorsScript — now scans all small forms
for button patterns regardless of overlay state. The elCount > 100
threshold already filters content forms reliably.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 13:57:18 +03:00
Nick Shirokov 75558fe46c fix(web-test): detect server-side errors via waitForSelector and ancestry-based button grouping
Two problems solved:
1. Server-side exceptions (ВызватьИсключение in ПередЗаписью) produce modal dialogs
   AFTER the DOM stabilizes. clickElement now uses waitForSelector with MutationObserver
   (doesn't block JS event loop) to detect #modalSurface or .balloon appearance.
2. checkErrorsScript used button IDs to determine form ownership, but 1C modal dialog
   buttons often have empty IDs. Now uses closest('[id$="_container"]') ancestry to
   group pressButtons by form, correctly separating modal buttons from background form
   buttons (e.g. "Зачет оплаты" in ERP order form).

Tested with ТестОшибки CFE extension on ERP — error detected in 7.7s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 13:28:23 +03:00
Nick Shirokov 90ca2a7c4a feat(web-test): auto-detect 1C errors and stop script execution
Action functions (clickElement, fillFields, selectValue, etc.) are now
wrapped to check for 1C errors (modal dialogs, validation balloons)
after each call. When detected, execution stops immediately with full
diagnostic context:

- error: human-readable 1C error message
- step: which API function triggered the error
- stepArgs: arguments passed to that function
- onecErrors: raw balloon/messages/modal data from DOM
- formState: complete form state at the moment of error
- screenshot: auto-captured error-shot.png

This enables autonomous scripts (run mode) to fail fast with enough
information for the caller (agent or human) to diagnose and decide on
corrective action.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:15:17 +03:00
Nick Shirokov 500e05703e docs(web-test): update SKILL.md — autonomous run mode, cleaner workflow
- Add `run <url> <script>` as preferred mode for complete scenarios
- Reorganize workflow: autonomous (run) vs interactive (start/exec/stop)
- Remove obsolete "batch mode" section (replaced by run)
- Update URL section with .v8-project.json guidance
- Simplify script template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:07:47 +03:00
Nick Shirokov ebda3e6608 feat(web-test): add autonomous run command
`node run.mjs run <url> <script>` — connect, execute, disconnect in one
call. No HTTP server, no session management. Process exits when done.

Useful for CI, subagents, and standalone test scenarios where the full
start/exec/stop lifecycle is unnecessary overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:05:34 +03:00
Nick Shirokov 328cb60f18 fix(web-test): strict search input detection in selection forms
Selection forms without a search field (e.g. ERP Соглашения) have only
filter fields like ТипСоглашения. The old code fell back to inputs[0],
typing the search text into the filter field and breaking the form.

Now pickFromSelectionForm only uses inputs whose ID matches known search
field patterns (поиск/search/строкапоиска/SearchString/find). When no
search input is found, it skips text entry and matches rows directly in
the grid — which works because the target value is visible among the rows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:46:10 +03:00
Nick Shirokov 5061d83282 fix(web-test): ERP compatibility — CB button fallback, div-based grid
selectValue: try DLB button first, fallback to CB (Choose Button).
ERP uses _CB suffix instead of _DLB for some reference fields
(Соглашение, Склад).

fillTableRow: handle non-INPUT focus between grid cells. ERP's
div-based grid puts DIV.gridBody focus between editable cells on Tab.
Also treat TEXTAREA cells (e.g. Содержание) as editable grid cells.
Added wrap-around detection to exit when Tab loops back to first cell.

Tested: Заказ клиента in ERP — all fields fill correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:02:41 +03:00
Nick Shirokov b10802d4d7 revert(web-test): restore fixed delays, keep waitForCondition utility
Smart wait polling showed no measurable speedup in benchmarks
(31.8s vs 32.0s baseline). 1C backend response time (~1.5-2s per
autocomplete) is the real bottleneck, not client-side delay calibration.
Reverted all 5 replacements to original fixed delays to reduce complexity.
Kept waitForCondition() utility for potential future use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 20:09:15 +03:00
Nick Shirokov ae0c3e3278 refactor(web-test): replace fixed delays with smart waitForCondition polls
Add waitForCondition() utility — polls JS expression every 100ms with
timeout fallback. Replace key fixed delays:
- fillReferenceField paste: 2000ms → poll for EDD/cloud (max 2s)
- fillTableRow add: 1000ms → poll for grid INPUT focus (max 2s)
- fillTableRow cell paste: 1500ms → poll for EDD/value (max 1.5s)
- fillTableRow Tab skip/commit: 300-1000ms → poll for focus change

Benchmark: 31.8s vs 32.0s baseline — no measurable speedup because
1C backend response time (~1.5-2s for autocomplete) is the real
bottleneck, not our delay calibration. Code is correct and will
benefit from faster backends.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 20:05:42 +03:00
Nick Shirokov 00ec14aed3 feat(web-test): add required field detection via markIncomplete CSS class
Fields with 1C fill-check enabled show `required: true` in getFormState()
when empty, allowing proactive filling before posting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 19:49:05 +03:00
Nick Shirokov 102a7b8849 fix(web-test): force click before Escape on surface intercept
Escape on document forms triggers "save changes?" dialog. Reorder
retry strategy: try force:true first (no side effects), then Escape
as fallback. Applied to both clickElement and fillReferenceField.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:43:41 +03:00
Nick Shirokov 68e346d645 fix(web-test): improve modal detection, surface retry, search regex
- detectFormScript: lower modal threshold from >=2 to >=1 visible elements
- clickElement: force:true on third retry when surface overlay persists
- filterList/unfilterList: add SearchString pattern for selection forms
- fillTableRow: wrap body in try/catch for structured error returns
- SKILL.md: add keyboard shortcuts reference (F8, Shift+F4, F4, Alt+F)
- gitignore: exclude *.png screenshot artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:31:57 +03:00
Nick Shirokov c8f58b5461 feat(web-test): embed browser automation engine into skill
Move browser.mjs, dom.mjs, run.mjs from external 1c-web-client-mcp
project into .claude/skills/web-test/scripts/. Now the skill is
self-contained — copy .claude/skills/ + npm install is all that's
needed.

- Add scripts/package.json with playwright dependency
- Update SKILL.md with relative runner path and setup section
- Add node_modules/ and .browser-session.json to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 12:15:35 +03:00
Nick Shirokov ba963739d8 docs(web-test): advanced search works on hierarchical catalogs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 11:57:38 +03:00
Nick Shirokov afe760af4b docs(web-test): fix hierarchical list — simple filterList works
Simple filterList('text') works on hierarchical catalogs after
the search input regex fix. No need to switch view mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 10:40:00 +03:00
Nick Shirokov c6eae770f5 docs(web-test): fix hierarchical list — switch to flat mode before filter
The Alt+F (Найти) in 1C navigates the tree instead of filtering.
Correct approach: Ещё → Режим просмотра → Список, then filterList.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 10:32:37 +03:00
Nick Shirokov d28bea8f0a docs(web-test): add dblclick, closeForm, hierarchical, lifecycle docs
- clickElement {dblclick:true} for opening items from lists
- closeForm() API and closing forms patterns table
- Hierarchical lists search gotcha with filterList
- Startup lifecycle: start blocks, run in background
- status command in workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 10:14:33 +03:00
Nick Shirokov 475b6d9544 docs(web-test): rewrite SKILL.md for CLI runner workflow
- Replace MCP-based workflow with run.mjs CLI runner (start/exec/shot/stop)
- Add interactive mode (stdin pipe) and batch mode (file exec)
- Compact API reference table, remove verbose return value docs
- Add filterList/unfilterList/deleteTableRow (missing before)
- Remove implementation details (EDD, DLB internals)
- Universal paths, no hardcoded infrastructure specifics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 09:38:15 +03:00
Nick Shirokov 2d69ecf709 docs: clarify PS1 as primary runtime, Python as derived port
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:45:19 +03:00
Nick Shirokov 88f74e96f0 fix(python): add stderr UTF-8 encoding for Windows compatibility
Without reconfiguring stderr, Cyrillic error messages appear garbled
on Windows (cp1251 default). Mirrors the existing stdout fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:31:27 +03:00
Nick Shirokov bce2d7c85c fix(epf-build,epf-dump): remove double-quoting in subprocess arguments
Same issue as db-* scripts: embedded quotes in list-based subprocess
args get escaped by list2cmdline, causing 1C to receive literal quote
characters in paths. Python's list2cmdline handles quoting automatically
for separate flag+value pairs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:15:53 +03:00
Nick Shirokov 8f3bde5cfc fix(db-create): restore quotes in CREATEINFOBASE connection string
File="path" quotes are part of 1C connection string syntax, not shell
quoting. Previous fix correctly removed quotes from /Out and /F args
(where list2cmdline handles quoting) but incorrectly removed them from
the CREATEINFOBASE connection string too.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:00:38 +03:00
Nick Shirokov 85cdea925e fix(db-*): remove double-quoting in subprocess arguments
Python subprocess.run() with list args handles quoting automatically.
Extra f'"{path}"' wrapping made quotes literal, breaking 1cv8.exe CLI.
Removed inner quotes from all 8 db-* scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:49:05 +03:00
Nick Shirokov 679f6bae94 fix(meta-compile): handle dict-format attributes in tabular sections
Python list(dict) returns only keys, losing values. Added _as_list()
helper to convert dict {"K":"V"} → ["K:V"] before passing to
parse_attribute_shorthand(). Fixes TS attribute generation for all
dict-format inputs (attributes, accountingFlags, etc.).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:16:52 +03:00
Nick Shirokov c5abfc3a4f fix(form-add): resolve directory path to sibling .xml file
When ObjectPath is a directory (e.g. Catalogs/Номенклатура),
auto-resolve to the sibling XML file (Catalogs/Номенклатура.xml)
before parsing. Matches behavior of other edit scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:02:56 +03:00
Nick Shirokov d9ce7b03cc fix(role-info): add missing -NoProfile flag to SKILL.md
Normalize PowerShell invocation to match all other skills,
ensuring clean round-trip through switch-to-python/switch-to-powershell.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:38:15 +03:00
Nick Shirokov d6abb2b651 fix(python): add stdout UTF-8 encoding for Windows compatibility
Python on Windows defaults to cp1251 for piped stdout, which cannot
handle Unicode box-drawing characters used in info/analysis output.
Added sys.stdout.reconfigure(encoding="utf-8") to all 59 Python scripts.

Tested on real config data: epf-init, epf-validate, cf-info, cf-validate,
meta-info, form-info, role-info, skd-info, subsystem-info — all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:29:26 +03:00
Nick Shirokov 86a959a354 feat(crossplatform): add Python 3 ports for all 58 PS1 skill scripts
Add cross-platform Python alternatives alongside existing PowerShell
scripts. PS1 remains the default runtime; Python is opt-in via switch
scripts. All parameters are identical between runtimes.

New files:
- 58 Python scripts in .claude/skills/*/scripts/*.py
- scripts/switch-to-python.py and switch-to-powershell.py
- docs/python-porting-guide.md
- __pycache__/ added to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:16:07 +03:00
Nick Shirokov 8e7125d850 docs(web-test): fix navigation limitation — Shift+Tab works in 1C
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:27:08 +03:00
Nick Shirokov fa9fae49c2 docs(web-test): add fillTableRow API — table part row filling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:25:27 +03:00
Nick Shirokov c0e18ed428 docs(web-test): update SKILL.md — selectValue 3 patterns, clipboard paste
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:17:02 +03:00
Nick Shirokov 64453ebe08 docs(web-test): update SKILL.md — fillFields supports reference fields
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:32:56 +03:00
Nick Shirokov c91ad0a158 feat(web): add /web-test skill for browser automation scripting
Skill generates and runs .mjs scripts using browser.mjs API.
Includes function table, script template, and usage notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:23:49 +03:00
Nick Shirokov 6b5992de34 Merge branch 'dev-web' 2026-02-22 18:53:06 +03:00