Clarify restart-safe batches and scripted UI handler tests

Address Nikola's batching and UI-handler feedback on PR #132. Preserve existing false-positive guards and defer the unconfirmed IsHandled policy.

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

Copilot-Session: f841a18b-535a-498e-96f2-f279b5378da5
This commit is contained in:
wenjiefan 2026-09-14 09:29:35 +02:00
parent 35d0966a8d
commit 0561b12c96
7 changed files with 155 additions and 46 deletions

View file

@ -30,6 +30,41 @@ codeunit 50400 "Test UI Handler Capture Good"
Assert.AreEqual(Customer."No.", CapturedCustomerNo, 'The customer card opened for the wrong customer.');
end;
[Test]
[HandlerFunctions('ConfirmHandler,PostMessageHandler')]
procedure ConfirmPostingAndShowMessage()
begin
LibraryVariableStorage.Clear();
LibraryVariableStorage.Enqueue('Post this document?');
LibraryVariableStorage.Enqueue(true);
LibraryVariableStorage.Enqueue('Posting completed.');
Assert.IsTrue(RunPostingThatConfirmsAndMessages(), 'The posting confirmation was declined.');
LibraryVariableStorage.AssertEmpty();
end;
local procedure RunPostingThatConfirmsAndMessages(): Boolean
begin
if not Confirm('Post this document?', false) then
exit(false);
Message('Posting completed.');
exit(true);
end;
[ConfirmHandler]
procedure ConfirmHandler(Question: Text[1024]; var Reply: Boolean)
begin
Assert.ExpectedConfirm(LibraryVariableStorage.DequeueText(), Question);
Reply := LibraryVariableStorage.DequeueBoolean();
end;
[MessageHandler]
procedure PostMessageHandler(MessageText: Text[1024])
begin
Assert.ExpectedMessage(LibraryVariableStorage.DequeueText(), MessageText);
end;
[ModalPageHandler]
procedure CustomerCardHandler(var CustomerCard: TestPage "Customer Card")
begin
@ -45,5 +80,6 @@ codeunit 50400 "Test UI Handler Capture Good"
var
Assert: Codeunit "Library Assert";
LibrarySales: Codeunit "Library - Sales";
LibraryVariableStorage: Codeunit "Library - Variable Storage";
CapturedCustomerNo: Code[20];
}