Skip to content

Add activity lifecycle E2E test fixture - #10365

Open
Prangshuman Das (t-prda) wants to merge 6 commits into
mainfrom
feature/activity-e2e-handler-646914
Open

Add activity lifecycle E2E test fixture#10365
Prangshuman Das (t-prda) wants to merge 6 commits into
mainfrom
feature/activity-e2e-handler-646914

Conversation

@t-prda

@t-prda Prangshuman Das (t-prda) commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Add deterministic Business Central setup for the Expense Agent activity lifecycle E2E tests.

  • Add ExpenseTestHandler_ConfigureApprovalScenario.
  • Configure a distinct approver Expense User for the current BC service account.
  • Create or replace the submitter-to-approver Expense Approval Setup.
  • Keep the standard BC approval workflow disabled so the tests exercise Expense Agent service approval routing without a User Setup dependency.
  • Reject using the same Expense User as both submitter and approver.

This is the BCApps companion to BC-ExpenseAgent PR #2391.

Tracking

Validation

  • git diff --check
  • Test app compiled and published manually.
  • Live BC lifecycle E2E: submit/approve passed.
  • Live BC lifecycle E2E: reject/resubmit/reapprove passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area labels Aug 18, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 18, 2026
@t-prda
Prangshuman Das (t-prda) marked this pull request as ready for review August 18, 2026 15:15
@t-prda
Prangshuman Das (t-prda) requested a review from a team August 18, 2026 15:15
@t-prda
Prangshuman Das (t-prda) requested a review from a team as a code owner August 18, 2026 15:15
@t-prda

Copy link
Copy Markdown
Contributor Author

Agentic PR Review - Round 1

Recommendation: Request Changes

What this PR does

This PR adds a test-handler endpoint that prepares two Expense Users for externally run approval lifecycle tests. It maps the approver to the current BC service identity, replaces the submitter's approval setup, and disables the standard BC approval workflow.

The setup path is otherwise narrow and matches the external test goal. However, assigning the service identity does not make that identity unique, while the approval code resolves it with FindFirst().

Suggestions

S1 - Make the approver identity deterministic
Clear UserId() from other Expense Users before assigning it here. Initialize() keeps Expense Users, and approval lookup uses FindFirst() on this non-unique field. A stale lower-key user can be selected on a later external test run.

Risk assessment and necessity

Risk: The changed code is test-only and does not affect the production app. The current identity setup can still make external lifecycle tests use the wrong Expense User, which gives unstable results and incorrect activity actors after a stale or interrupted run.

Necessity: A deterministic setup endpoint is needed for the linked lifecycle E2E coverage. The scope is appropriate once the service identity is made unique for each fixture run.


[AI-PR-REVIEW] version=1 promptVersion=1 system=github pr=10365 round=1 by=t-prda at=2026-08-18T15:19:12.3771320Z lastSha=4663a795121aa4987f3bff1a0a2359b0d81c9107 reviewKey=158c59f430abca4178e951bc8dba8675912e8702448d165cbd18bf5f9840e32d suggestions=S1@7eedcc06

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
@t-prda

Copy link
Copy Markdown
Contributor Author

Addressed S1 in 7c4f7a8. The fixture now clears the current service UserId() from every existing Expense User before assigning it to the dedicated approver, so FindFirst() cannot select a stale lower-key user on subsequent runs.

Comment thread src/Apps/W1/ExpenseAgent/test/src/Helper/ExpenseTestHandlerAPI.Codeunit.al Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Comment thread src/Apps/W1/ExpenseAgent/test/src/Helper/ExpenseTestHandlerAPI.Codeunit.al Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Comment thread src/Apps/W1/ExpenseAgent/test/src/Helper/ExpenseTestHandlerAPI.Codeunit.al Outdated
Comment thread src/Apps/W1/ExpenseAgent/test/src/Helper/ExpenseTestHandlerAPI.Codeunit.al Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant