Skip to content

feat(TA0002): report actions invoked on a directly opened part test page - #549

Merged
Arthurvdv merged 5 commits into
mainfrom
feat/ta0002-invoke-action-on-part-test-page
Sep 13, 2026
Merged

feat(TA0002): report actions invoked on a directly opened part test page#549
Arthurvdv merged 5 commits into
mainfrom
feat/ta0002-invoke-action-on-part-test-page

Conversation

@Arthurvdv

@Arthurvdv Arthurvdv commented Sep 13, 2026

Copy link
Copy Markdown
Member

Why

A test that opens a ListPart or CardPart page directly through its own TestPage variable and then invokes an action on it fails at runtime with "The action with ID = xxx is not found on the page." A part page opened on its own renders no actions (same in the client), so the test framework cannot find them. The working pattern is to reach the action through the part control of the hosting page (HostPage.SubPagePart.MyAction.Invoke()). Discussion: #455

What

New TestAutomationCop rule TA0002 InvokeActionOnPartTestPage (Warning, Usage, enabled by default).

Reports Invoke(), Enabled() and Visible() on an action of a TestPage variable whose target page has PageType = ListPart or CardPart.

Message (3 placeholders): Action '{0}' cannot be invoked on page '{1}' opened directly because its PageType is {2}; invoke it through the part control of the hosting page instead.

EnumProvider additions: NavTypeKind.TestPage, PageTypeKind.CardPart (both exist at the ns2.0 12.0 floor).

Deliberate non-reports

  • Actions reached through a part control (MainPage.SubPagePart.MyAction.Invoke()) — receiver is TestPart, not TestPage
  • Field access, OpenView/OpenEdit/OpenNew and other TestPage built-ins
  • Built-in actions OK/Cancel/Yes/No/View/EditSubPage.OK().Invoke() has an invocation as the outer Instance, not an ITestActionAccess
  • HeadlinePart and every other PageType not confirmed to fail
  • TestRequestPageRequestPageTypeSymbol is IPageBaseTypeSymbol but not IPageTypeSymbol

Obsolete test code is not exempt: the test runner still executes an obsolete test method or codeunit, so the failure is real. The call is identified by its ITestActionAccess receiver alone; the built-in TestAction class has exactly Invoke, Enabled and Visible.

Test notes

19 tests total: 9 HasDiagnostic, 10 NoDiagnostic — all pass.

Regression-first evidence (stub analyzer with no registration):

  • All 9 HasDiagnostic cases failed with There is no issue reported for TA0002 at [...]
  • 9 of 10 NoDiagnostic cases passed (TestRequestPage initially had a compile error, fixed to use RequestPageHandler parameter syntax)

Verification:

  • dotnet build ALCops.sln — 0 errors
  • dotnet test src/ALCops.TestAutomationCop.Test/ --filter "FullyQualifiedName~InvokeActionOnPartTestPage" — 19 passed
  • dotnet test src/ALCops.Common.Test/ — 159 passed
  • dotnet format ALCops.sln --verify-no-changes — exit 0
  • Three-TFM Release builds (TestAutomationCop, Common) — 0 errors, 0 warnings

Docs companion: ALCops/alcops.dev#187

Resolves #455

🤖 Generated with Claude Code

Arthurvdv and others added 2 commits September 13, 2026 15:49
Reports Invoke(), Enabled() and Visible() on an action of a TestPage
variable whose target page has PageType = ListPart or CardPart. A part
page opened directly renders no actions at runtime. The working pattern
is to reach the action through the part control of the hosting page.

Not reported: actions through a part control, field access and TestPage
built-ins, built-in OK/Cancel/Yes/No/View/Edit actions, HeadlinePart,
TestRequestPage, obsolete test code.

EnumProvider: NavTypeKind.TestPage, PageTypeKind.CardPart.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Purpose, design decisions, deliberate non-reports and the SDK facts
(TestPage receiver type, TestActionAccess versus TestPartAccess, the
TestAction built-in class) that the analyzer relies on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Arthurvdv
Arthurvdv marked this pull request as ready for review September 13, 2026 13:51
@Arthurvdv Arthurvdv closed this Sep 13, 2026
@Arthurvdv Arthurvdv reopened this Sep 13, 2026
Arthurvdv and others added 2 commits September 13, 2026 16:14
…e 13.0

AL 12 rejects a pageextension whose target page is declared in the same
module (AL0334), so the fixture cannot compile on those SDK versions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…order

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ction access alone

The test runner still executes an obsolete test method or codeunit, so
skipping obsolete code hid a real runtime failure. The built-in class
and method-kind checks were implied by the ITestActionAccess receiver:
its type is TestAction, whose only members are Invoke, Enabled and
Visible.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Arthurvdv
Arthurvdv merged commit b9ed989 into main Sep 13, 2026
39 checks passed
@Arthurvdv
Arthurvdv deleted the feat/ta0002-invoke-action-on-part-test-page branch September 13, 2026 15:13
Arthurvdv added a commit to ALCops/alcops.dev that referenced this pull request Sep 13, 2026
Documents TestAutomationCop rule TA0002 InvokeActionOnPartTestPage: Invoke(),
Enabled() and Visible() on an action of a TestPage variable whose page is a
ListPart or CardPart fail at runtime because a part opened directly renders no
actions; the action must be reached through the part control of the hosting
page. The page covers the triggering conditions, the exceptions (field access,
TestPage built-ins, built-in system actions, TestRequestPage) and a
suppression example, and the TestAutomationCop index gains the TA0002 row.

Related: ALCops/Analyzers#549

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant