with one click
poshi-shrink
// Shrink a Liferay component's Poshi test suite by merging overlapping tests. Use when the user asks to reduce, merge, or clean up Poshi tests for a @component-name.
// Shrink a Liferay component's Poshi test suite by merging overlapping tests. Use when the user asks to reduce, merge, or clean up Poshi tests for a @component-name.
| argument-hint | <component-name> |
| description | Shrink a Liferay component's Poshi test suite by merging overlapping tests. Use when the user asks to reduce, merge, or clean up Poshi tests for a @component-name. |
| name | poshi-shrink |
A playbook for shrinking a Liferay component's Poshi test suite before migrating tests to Playwright, Java integration, or the unit layer. Typical outcome: a file with ~27 tests ends up with ~8, in ~24 small reviewable commits.
The @component-name annotation, passed as ${ARGUMENTS} (e.g., portal-analytics-cloud, portal-commerce, portal-content-management). When ${ARGUMENTS} is empty, scan .testcase files under portal-web/test/functional/com/liferay/portalweb/tests/enduser, list the distinct @component-name values found, and ask the user to pick one. Do not guess.
Verify the component by enumerating, under portal-web/test/functional/com/liferay/portalweb/tests/enduser, every .testcase whose @component-name matches; abort when no file matches. The same enumeration feeds the Shrink Plan: per file, capture the path, the testray.main.component.name value, and the test-block count.
Build the plan via plan mode (EnterPlanMode) using this format:
## Inventory
| File | Test Count | testray.main.component.name |
| --- | --- | --- |
| <path> | <N> | <component> |
## Files to Attack
### <file path> (N ā M)
> **Group A ā <Context name>** (N ā 1):
>
> - Rename `<Keeper>` ā `<FinalName>` (commit 1)
> - Merge `<Source2>` ā adds `<assertion>` (commit 2)
> - Merge `<Source3>` ā adds `<assertion>` (commit 3)
> - ⦠etc
### <next file path> (N ā M)
ā¦
Sort the inventory ascending by test count so small files (easy wins) surface first. Avoid files with 40+ tests on the first pass.
Pick the keeper for each group: the test with the most comprehensive assertions, even when its name is awkward ā the keeper does not have to keep its name. The final name describes the combined behavior (e.g., ContentPerformancePanelInBlogDisplayPage, LanguageDropdownInContentPage) and is typically different from the keeper's original name.
Common merge-worthy signals ā classic patterns from Liferay test names:
AuthorNotShowIn<Context> tests ā usually one per panel context is enough.MetricsIconVisibleIn<Context> + PanelInformationIn<Context> ā the first checks title+traffic, the second title+URL+language ā huge overlap between the two.CheckAllInfo* or similar catch-all tests that duplicate specific-field tests.setUp + first N tasks (navigate, create blog, open panel) and differ only in the final assertion.property portal.upstream = "quarantine", property test.liferay.virtual.instance = "false", property test.run.type = "single" (when not inherited).@ignore / @skip annotations.After ExitPlanMode returns the user's approval, apply each operation in the order it appears in the plan and commit after each one with the /commit skill ā one commit per operation, never squashed. The per-merge granularity is exactly what makes the diff reviewable.
test <OldName> to test <FinalName> with no other edits. Commit message: <TICKET> Rename test <Keeper> to <FinalName>.test <Source> { ... } block and fold its unique assertions into the target as new task blocks. When the source's assertions are already fully covered by the target, simply delete the source. When the same condition is asserted at different strengths (e.g., AssertTextEquals.assertPartialText("web/<site-path>") vs the weaker AssertVisible value1="http://"), keep the stronger one. Commit message: <TICKET> Merge test <Source> into <FinalName>.When the file convention keeps tests alphabetical, add a final <TICKET> Alphabetic order commit after all merges.
After the file is shrunk, report:
testray.main.component.name.@ignore).[HINT] Download the complete skill directory including SKILL.md and all related files