import { test, expect, type Page } from '@playwright/test'; // ── Pieces editor (custom piece CRUD via the UI) E2E ────────────────────────── // // REQUIRES `npm run test:e2e` + a running server (ui/playwright.config.ts boots // the real orchestrator with auth OFF → synthetic 'local' user). This does NOT // run in the sandbox — there is no live server here. // // The Pieces page (page=pieces) is NOT auth-gated (NAV_ITEMS: pieces // requiresAuth:false). The published-tested `splitPieces` lib covers the // custom/default split; this proves the actual editor wiring that has no e2e: // create a custom piece from the sidebar, then edit + save it through the editor. // // Selector grounding (read from the real components): // - PiecesPage.tsx: the "+" button next to the custom-workflows section opens // an inline input with placeholder="piece-name"; Enter creates the piece via // POST /api/pieces and selects it. The two section headings USED to be // hardcoded English ("Default Workflows" / "Custom Workflows"); issue #1430 // moved them behind i18n (pieces.json sidebar.defaultSection/customSection). // This runner's locale is ja-JP, so every assertion on those headings has to // accept both languages -- the same shape as spaces.spec.ts uses for the // Default/Custom section labels. An English-only literal here does not fail // loudly: getByText simply never matches, and a toHaveCount(0) assertion // passes for the wrong reason. // - PieceEditor.tsx: a Visual/YAML mode toggle, a