From 25bcf9a2c3f13a8f66c581e76adc6a9297602cbd Mon Sep 17 00:00:00 2001 From: 6Cript Date: Wed, 29 Jul 2026 12:51:00 +0200 Subject: [PATCH 1/6] Subcontracting configuration guide implementation + tests --- .../Install/SubcBusinessSetupExt.Codeunit.al | 29 ++ .../SubcontractObjs.PermissionSet.al | 1 + .../Setup/SubcManufacturingSetup.PageExt.al | 5 + .../Setup/SubcontractingSetupGuide.Page.al | 356 ++++++++++++++++++ .../SubcSubcontractingUITest.Codeunit.al | 159 ++++++++ 5 files changed, 550 insertions(+) create mode 100644 src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al diff --git a/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al b/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al index a0bb8e73f42..8407938ca4e 100644 --- a/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al +++ b/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al @@ -7,14 +7,43 @@ namespace Microsoft.Manufacturing.Subcontracting; using Microsoft.Foundation.Company; using Microsoft.Manufacturing.Setup; using System.Environment.Configuration; +using System.Media; codeunit 99001502 "Subc. Business Setup Ext." { var + AssistedSetupDescriptionLbl: Label 'Review company defaults and continue with the pages used to configure your subcontracting process.'; + AssistedSetupShortTitleLbl: Label 'Set up Subcontracting'; + AssistedSetupTitleLbl: Label 'Set up Subcontracting'; + DocumentationUrlLbl: Label 'https://go.microsoft.com/fwlink/?linkid=2345593', Locked = true; SubcontractingDescriptionLbl: Label 'Make manual Subcontracting Setup'; SubcontractingKeyWordsLbl: Label 'Subcontracting, Management'; SubcontractingLbl: Label 'Subcontracting App'; + [EventSubscriber(ObjectType::Codeunit, Codeunit::"Guided Experience", OnRegisterAssistedSetup, '', false, false)] + local procedure OnRegisterAssistedSetup() + var + GuidedExperience: Codeunit "Guided Experience"; + AssistedSetupGroup: Enum "Assisted Setup Group"; + VideoCategory: Enum "Video Category"; + begin + if GuidedExperience.Exists("Guided Experience Type"::"Assisted Setup", ObjectType::Page, Page::"Subcontracting Setup Guide") then + exit; + + GuidedExperience.InsertAssistedSetup( + AssistedSetupTitleLbl, + AssistedSetupShortTitleLbl, + AssistedSetupDescriptionLbl, + 5, + ObjectType::Page, + Page::"Subcontracting Setup Guide", + AssistedSetupGroup::ReadyForBusiness, + '', + VideoCategory::ReadyForBusiness, + DocumentationUrlLbl, + true); + end; + [EventSubscriber(ObjectType::Codeunit, Codeunit::"Guided Experience", OnRegisterManualSetup, '', false, false)] local procedure OnRegisterManualSetup(sender: Codeunit "Guided Experience") var diff --git a/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al b/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al index 2ba713d8a32..880b343135c 100644 --- a/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al +++ b/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al @@ -85,6 +85,7 @@ permissionset 99001501 "Subcontract. - Objs" page "Subc. Routing Info Factbox" = X, page "Subc. Transfer Line Factbox" = X, page "Subcontractor Prices" = X, + page "Subcontracting Setup Guide" = X, page "Subc. WIP Adjustment" = X, page "Subc. WIP Ledger Entries" = X, diff --git a/src/Apps/W1/Subcontracting/App/src/Setup/SubcManufacturingSetup.PageExt.al b/src/Apps/W1/Subcontracting/App/src/Setup/SubcManufacturingSetup.PageExt.al index 8e5e436d0ae..84e8caf72f2 100644 --- a/src/Apps/W1/Subcontracting/App/src/Setup/SubcManufacturingSetup.PageExt.al +++ b/src/Apps/W1/Subcontracting/App/src/Setup/SubcManufacturingSetup.PageExt.al @@ -44,6 +44,11 @@ pageextension 99001542 "Subc. Manufacturing Setup" extends "Manufacturing Setup" ApplicationArea = Subcontracting; ToolTip = 'Specifies which Direct Unit Cost of a Prod. Order Component is to be used in the subcontracting purchase order. Standard: Standard pricing is used when procuring the component. Prod. Order Component: The calculated Direct Unit Cost of the Prod. Order Component Line is transferred to the subcontracting purchase order.'; } + field("Subc. Default Comp. Location"; Rec."Subc. Default Comp. Location") + { + ApplicationArea = Subcontracting; + ToolTip = 'Specifies where to get the default location for components supplied to the subcontractor.'; + } } } } diff --git a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al new file mode 100644 index 00000000000..d7c394d9d6a --- /dev/null +++ b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al @@ -0,0 +1,356 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.Manufacturing.Subcontracting; + +using Microsoft.Inventory.Location; +using Microsoft.Manufacturing.ProductionBOM; +using Microsoft.Manufacturing.Setup; +using Microsoft.Manufacturing.WorkCenter; +using Microsoft.Purchases.Vendor; +using System.Environment; +using System.Environment.Configuration; +using System.Utilities; + +page 99001505 "Subcontracting Setup Guide" +{ + ApplicationArea = All; + Caption = 'Subcontracting Setup'; + PageType = NavigatePage; + SourceTable = "Manufacturing Setup"; + + layout + { + area(Content) + { + group(StandardBanner) + { + Editable = false; + ShowCaption = false; + Visible = TopBannerVisible and not ReadyToConfigureStepVisible; + + field(StandardBannerImage; MediaResourcesStandard."Media Reference") + { + ApplicationArea = All; + Editable = false; + ShowCaption = false; + ToolTip = 'Specifies the image for the assisted setup.'; + } + } + group(FinishedBanner) + { + Editable = false; + ShowCaption = false; + Visible = TopBannerVisible and ReadyToConfigureStepVisible; + + field(FinishedBannerImage; MediaResourcesDone."Media Reference") + { + ApplicationArea = All; + Editable = false; + ShowCaption = false; + ToolTip = 'Specifies the image for the completed assisted setup.'; + } + } + group(WelcomeStep) + { + ShowCaption = false; + Visible = WelcomeStepVisible; + + group(Welcome) + { + Caption = 'Welcome to Subcontracting'; + InstructionalText = 'Subcontracting in Business Central helps you purchase production operations from vendors and manage the components that you supply to them.'; + } + group(WelcomeSequence) + { + Caption = 'Let''s get started'; + InstructionalText = 'First, review your company defaults. Then continue with the subcontractors, prices, component supply methods, and worksheet that support your subcontracting process.'; + } + } + group(CompanyDefaultsStep) + { + ShowCaption = false; + Visible = CompanyDefaultsStepVisible; + + group(CompanyDefaults) + { + Caption = 'Review company defaults'; + InstructionalText = 'Review the defaults created when the Subcontracting app was installed. You can change these values now or maintain them later from Manufacturing Setup.'; + + field("Subcontracting Template Name"; Rec."Subcontracting Template Name") + { + ApplicationArea = All; + ToolTip = 'Specifies the subcontracting worksheet template used to create subcontracting orders from released production order routings.'; + } + field("Subcontracting Batch Name"; Rec."Subcontracting Batch Name") + { + ApplicationArea = All; + ToolTip = 'Specifies the subcontracting worksheet batch used to create subcontracting orders from released production order routings.'; + } + field("Create Prod. Order Info Line"; Rec."Create Prod. Order Info Line") + { + ApplicationArea = All; + ToolTip = 'Specifies whether subcontracting purchase orders include an information line for the production order line.'; + } + field("Component Direct Unit Cost"; Rec."Component Direct Unit Cost") + { + ApplicationArea = All; + ToolTip = 'Specifies whether subcontracting purchase orders use standard component pricing or the direct unit cost from the production order component.'; + } + field("Subc. Comp. Transfer Lead Time"; Rec."Subc. Comp. Transfer Lead Time") + { + ApplicationArea = All; + ToolTip = 'Specifies the lead time for transferring components to the subcontractor.'; + } + field("Subc. Default Comp. Location"; Rec."Subc. Default Comp. Location") + { + ApplicationArea = All; + ToolTip = 'Specifies where to get the default location for components supplied to the subcontractor.'; + } + } + } + group(ReadyToConfigureStep) + { + ShowCaption = false; + Visible = ReadyToConfigureStepVisible; + + group(ReadyToConfigure) + { + Caption = 'Ready to configure Subcontracting'; + InstructionalText = 'Your company defaults are ready. Use these links to complete the data needed for your subcontracting process, or choose Finish and return to them later.'; + } + field(WorkCentersLink; WorkCentersLinkLbl) + { + ApplicationArea = All; + Caption = 'Set up subcontractor work centers'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Work Centers page to set up work centers for subcontractors.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Work Center List"); + end; + } + field(VendorsLink; VendorsLinkLbl) + { + ApplicationArea = All; + Caption = 'Set up vendors'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Vendors page to set up subcontractors.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Vendor List"); + end; + } + field(LocationsLink; LocationsLinkLbl) + { + ApplicationArea = All; + Caption = 'Set up locations'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Locations page to set up locations used for subcontracting.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Location List"); + end; + } + field(SubcontractorPricesLink; SubcontractorPricesLinkLbl) + { + ApplicationArea = All; + Caption = 'Set up subcontractor prices'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Subcontractor Prices page.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Subcontractor Prices"); + end; + } + field(ComponentSupplyMethodsLink; ComponentSupplyMethodsLinkLbl) + { + ApplicationArea = All; + Caption = 'Set up component supply methods'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Production BOMs page to specify how components are supplied to subcontractors.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Production BOM List"); + end; + } + field(DocumentationLink; DocumentationLinkLbl) + { + ApplicationArea = All; + Caption = 'Read the Subcontracting documentation'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the documentation for Subcontracting.'; + + trigger OnDrillDown() + begin + Hyperlink(DocumentationUrlLbl); + end; + } + field(SubcontractingWorksheetLink; SubcontractingWorksheetLinkLbl) + { + ApplicationArea = All; + Caption = 'Open the Subcontracting Worksheet'; + Editable = false; + ShowCaption = false; + ToolTip = 'Open the Subcontracting Worksheet page.'; + + trigger OnDrillDown() + begin + Page.Run(Page::"Subc. Subcontracting Worksheet"); + end; + } + } + } + } + + actions + { + area(Processing) + { + action(ActionBack) + { + ApplicationArea = All; + Caption = 'Back'; + Enabled = BackActionEnabled; + Image = PreviousRecord; + InFooterBar = true; + ToolTip = 'Return to the previous step.'; + + trigger OnAction() + begin + NextStep(true); + end; + } + action(ActionNext) + { + ApplicationArea = All; + Caption = 'Next'; + Enabled = NextActionEnabled; + Image = NextRecord; + InFooterBar = true; + ToolTip = 'Continue to the next step.'; + + trigger OnAction() + begin + NextStep(false); + end; + } + action(ActionFinish) + { + ApplicationArea = All; + Caption = 'Finish'; + Enabled = FinishActionEnabled; + Image = Approve; + InFooterBar = true; + ToolTip = 'Complete the Subcontracting assisted setup.'; + + trigger OnAction() + begin + FinishSetup(); + end; + } + } + } + + trigger OnInit() + begin + LoadTopBanners(); + EnableControls(); + end; + + trigger OnOpenPage() + begin + Rec.Get(); + end; + + trigger OnQueryClosePage(CloseAction: Action): Boolean + begin + if SetupCompleted then + exit(true); + + exit(Confirm(SetupNotCompletedQst, false)); + end; + + var + MediaRepositoryDone: Record "Media Repository"; + MediaRepositoryStandard: Record "Media Repository"; + MediaResourcesDone: Record "Media Resources"; + MediaResourcesStandard: Record "Media Resources"; + BackActionEnabled: Boolean; + CompanyDefaultsStepVisible: Boolean; + FinishActionEnabled: Boolean; + NextActionEnabled: Boolean; + ReadyToConfigureStepVisible: Boolean; + SetupCompleted: Boolean; + TopBannerVisible: Boolean; + WelcomeStepVisible: Boolean; + Step: Option Welcome,CompanyDefaults,ReadyToConfigure; + ComponentSupplyMethodsLinkLbl: Label 'Set up component supply methods'; + DocumentationLinkLbl: Label 'Read the Subcontracting documentation'; + DocumentationUrlLbl: Label 'https://go.microsoft.com/fwlink/?linkid=2345593', Locked = true; + LocationsLinkLbl: Label 'Set up locations'; + SetupNotCompletedQst: Label 'The Subcontracting setup is not complete. Are you sure you want to exit?'; + SubcontractingWorksheetLinkLbl: Label 'Open the Subcontracting Worksheet'; + SubcontractorPricesLinkLbl: Label 'Set up subcontractor prices'; + VendorsLinkLbl: Label 'Set up vendors'; + WorkCentersLinkLbl: Label 'Set up subcontractor work centers'; + + local procedure NextStep(Backwards: Boolean) + begin + if not Backwards and (Step = Step::CompanyDefaults) then + CurrPage.SaveRecord(); + + if Backwards then + Step := Step - 1 + else + Step := Step + 1; + + EnableControls(); + end; + + local procedure EnableControls() + begin + WelcomeStepVisible := Step = Step::Welcome; + CompanyDefaultsStepVisible := Step = Step::CompanyDefaults; + ReadyToConfigureStepVisible := Step = Step::ReadyToConfigure; + + BackActionEnabled := not WelcomeStepVisible; + NextActionEnabled := not ReadyToConfigureStepVisible; + FinishActionEnabled := ReadyToConfigureStepVisible; + end; + + local procedure FinishSetup() + var + GuidedExperience: Codeunit "Guided Experience"; + SubcApplicationAreaMgmt: Codeunit "Subc. Application Area Mgmt."; + begin + CurrPage.SaveRecord(); + GuidedExperience.CompleteAssistedSetup(ObjectType::Page, Page::"Subcontracting Setup Guide"); + SubcApplicationAreaMgmt.RefreshExperienceTierCurrentCompany(); + SetupCompleted := true; + CurrPage.Close(); + end; + + local procedure LoadTopBanners() + begin + if MediaRepositoryStandard.Get('AssistedSetup-NoText-400px.png', Format(CurrentClientType())) and + MediaRepositoryDone.Get('AssistedSetupDone-NoText-400px.png', Format(CurrentClientType())) + then + if MediaResourcesStandard.Get(MediaRepositoryStandard."Media Resources Ref") and + MediaResourcesDone.Get(MediaRepositoryDone."Media Resources Ref") + then + TopBannerVisible := MediaResourcesStandard."Media Reference".HasValue() and MediaResourcesDone."Media Reference".HasValue(); + end; +} \ No newline at end of file diff --git a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al index b2476f644d7..119bcb2b16c 100644 --- a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al +++ b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al @@ -10,12 +10,15 @@ using Microsoft.Inventory.Requisition; using Microsoft.Manufacturing.Capacity; using Microsoft.Manufacturing.ProductionBOM; using Microsoft.Manufacturing.Routing; +using Microsoft.Manufacturing.Setup; using Microsoft.Manufacturing.Subcontracting; using Microsoft.Manufacturing.WorkCenter; using Microsoft.Purchases.Document; using Microsoft.Purchases.History; using Microsoft.Purchases.Vendor; +using System.Environment.Configuration; using System.Reflection; +using System.TestLibraries.Environment.Configuration; codeunit 139990 "Subc. Subcontracting UI Test" { @@ -51,6 +54,154 @@ codeunit 139990 "Subc. Subcontracting UI Test" LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"Subc. Subcontracting UI Test"); end; + [Test] + procedure SubcontractingAssistedSetupIsRegistered() + var + AssistedSetupTestLibrary: Codeunit "Assisted Setup Test Library"; + begin + // [SCENARIO 642233] The Subcontracting assisted setup is registered with Guided Experience. + Initialize(); + + // [GIVEN] The Subcontracting assisted setup registration does not exist + AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Guide"); + + // [WHEN] Assisted setups are registered + AssistedSetupTestLibrary.CallOnRegister(); + + // [THEN] The Subcontracting setup guide is registered + Assert.IsTrue(AssistedSetupTestLibrary.Exists(Page::"Subcontracting Setup Guide"), 'The Subcontracting assisted setup should be registered.'); + end; + + [Test] + [HandlerFunctions('SetupNotCompletedConfirmHandler')] + procedure SubcontractingSetupGuideShowsCompanyDefaultsAndConfigurationLinks() + var + ManufacturingSetup: Record "Manufacturing Setup"; + SubcontractingSetupGuide: TestPage "Subcontracting Setup Guide"; + ComponentDirectUnitCost: Option Standard,"Prod. Order Component"; + CreateProdOrderInfoLine: Boolean; + SubcDefaultCompLocation: Enum "Components at Location"; + SubcCompTransferLeadTime: DateFormula; + SubcontractingBatchName: Code[10]; + SubcontractingTemplateName: Code[10]; + begin + // [SCENARIO 642233] The setup guide displays the installed company defaults and the next configuration links. + Initialize(); + + // [GIVEN] The company has Subcontracting defaults + ManufacturingSetup.Get(); + SubcontractingTemplateName := ManufacturingSetup."Subcontracting Template Name"; + SubcontractingBatchName := ManufacturingSetup."Subcontracting Batch Name"; + CreateProdOrderInfoLine := ManufacturingSetup."Create Prod. Order Info Line"; + ComponentDirectUnitCost := ManufacturingSetup."Component Direct Unit Cost"; + SubcCompTransferLeadTime := ManufacturingSetup."Subc. Comp. Transfer Lead Time"; + SubcDefaultCompLocation := ManufacturingSetup."Subc. Default Comp. Location"; + + // [WHEN] The setup guide is opened + SubcontractingSetupGuide.OpenEdit(); + + // [THEN] The welcome step is shown + Assert.IsFalse(SubcontractingSetupGuide.ActionBack.Enabled(), 'Back should be disabled on the welcome step.'); + Assert.IsTrue(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be enabled on the welcome step.'); + Assert.IsFalse(SubcontractingSetupGuide.ActionFinish.Enabled(), 'Finish should be disabled on the welcome step.'); + + // [WHEN] The user continues to company defaults + SubcontractingSetupGuide.ActionNext.Invoke(); + + // [THEN] The defaults created during installation are displayed + SubcontractingSetupGuide."Subcontracting Template Name".AssertEquals(SubcontractingTemplateName); + SubcontractingSetupGuide."Subcontracting Batch Name".AssertEquals(SubcontractingBatchName); + SubcontractingSetupGuide."Create Prod. Order Info Line".AssertEquals(CreateProdOrderInfoLine); + SubcontractingSetupGuide."Component Direct Unit Cost".AssertEquals(ComponentDirectUnitCost); + SubcontractingSetupGuide."Subc. Comp. Transfer Lead Time".AssertEquals(SubcCompTransferLeadTime); + SubcontractingSetupGuide."Subc. Default Comp. Location".AssertEquals(SubcDefaultCompLocation); + Assert.IsTrue(SubcontractingSetupGuide.ActionBack.Enabled(), 'Back should be enabled on the company defaults step.'); + Assert.IsTrue(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be enabled on the company defaults step.'); + + // [WHEN] The user continues to the final step + SubcontractingSetupGuide.ActionNext.Invoke(); + + // [THEN] Links to the remaining Subcontracting configuration are displayed + Assert.IsTrue(SubcontractingSetupGuide.WorkCentersLink.Visible(), 'The work centers link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.VendorsLink.Visible(), 'The vendors link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.LocationsLink.Visible(), 'The locations link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.SubcontractorPricesLink.Visible(), 'The subcontractor prices link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.ComponentSupplyMethodsLink.Visible(), 'The component supply methods link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.DocumentationLink.Visible(), 'The documentation link should be visible.'); + Assert.IsTrue(SubcontractingSetupGuide.SubcontractingWorksheetLink.Visible(), 'The Subcontracting Worksheet link should be visible.'); + Assert.IsFalse(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be disabled on the final step.'); + Assert.IsTrue(SubcontractingSetupGuide.ActionFinish.Enabled(), 'Finish should be enabled on the final step.'); + + SubcontractingSetupGuide.Close(); + + // [THEN] Opening and navigating the guide did not replace the installed defaults + ManufacturingSetup.Get(); + Assert.AreEqual(SubcontractingTemplateName, ManufacturingSetup."Subcontracting Template Name", 'The Subcontracting template default should be preserved.'); + Assert.AreEqual(SubcontractingBatchName, ManufacturingSetup."Subcontracting Batch Name", 'The Subcontracting batch default should be preserved.'); + Assert.AreEqual(CreateProdOrderInfoLine, ManufacturingSetup."Create Prod. Order Info Line", 'The production order information line default should be preserved.'); + Assert.AreEqual(ComponentDirectUnitCost, ManufacturingSetup."Component Direct Unit Cost", 'The component direct unit cost default should be preserved.'); + Assert.AreEqual(SubcCompTransferLeadTime, ManufacturingSetup."Subc. Comp. Transfer Lead Time", 'The component transfer lead time default should be preserved.'); + Assert.AreEqual(SubcDefaultCompLocation, ManufacturingSetup."Subc. Default Comp. Location", 'The default component location source should be preserved.'); + end; + + [Test] + procedure FinishingSubcontractingSetupGuideSavesDefaultsAndCompletesAssistedSetup() + var + ManufacturingSetup: Record "Manufacturing Setup"; + AssistedSetupTestLibrary: Codeunit "Assisted Setup Test Library"; + GuidedExperience: Codeunit "Guided Experience"; + SubcontractingSetupGuide: TestPage "Subcontracting Setup Guide"; + CreateProdOrderInfoLine: Boolean; + OriginalCreateProdOrderInfoLine: Boolean; + begin + // [SCENARIO 642233] Finishing the setup guide saves changes and marks the assisted setup as completed. + Initialize(); + + // [GIVEN] The Subcontracting assisted setup is registered and incomplete + AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Guide"); + AssistedSetupTestLibrary.CallOnRegister(); + AssistedSetupTestLibrary.SetStatusToNotCompleted(Page::"Subcontracting Setup Guide"); + Assert.IsFalse(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Guide"), 'The assisted setup should initially be incomplete.'); + + // [GIVEN] A changed company default in the setup guide + ManufacturingSetup.Get(); + OriginalCreateProdOrderInfoLine := ManufacturingSetup."Create Prod. Order Info Line"; + CreateProdOrderInfoLine := not OriginalCreateProdOrderInfoLine; + SubcontractingSetupGuide.OpenEdit(); + SubcontractingSetupGuide.ActionNext.Invoke(); + SubcontractingSetupGuide."Create Prod. Order Info Line".SetValue(CreateProdOrderInfoLine); + SubcontractingSetupGuide.ActionNext.Invoke(); + + // [WHEN] The user finishes the setup guide + SubcontractingSetupGuide.ActionFinish.Invoke(); + + // [THEN] The company default is saved and the assisted setup is completed + ManufacturingSetup.Get(); + Assert.AreEqual(CreateProdOrderInfoLine, ManufacturingSetup."Create Prod. Order Info Line", 'The changed company default should be saved.'); + Assert.IsTrue(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Guide"), 'The assisted setup should be completed.'); + + ManufacturingSetup."Create Prod. Order Info Line" := OriginalCreateProdOrderInfoLine; + ManufacturingSetup.Modify(); + end; + + [Test] + procedure ManufacturingSetupContainsDefaultComponentLocationSource() + var + ManufacturingSetup: Record "Manufacturing Setup"; + PageControl: Record "Page Control Field"; + begin + // [SCENARIO 642233] Manufacturing Setup remains available for maintaining all Subcontracting company defaults. + Initialize(); + + // [WHEN] Controls on Manufacturing Setup are inspected + PageControl.SetRange(TableNo, Database::"Manufacturing Setup"); + PageControl.SetRange(PageNo, Page::"Manufacturing Setup"); + PageControl.SetRange(FieldNo, ManufacturingSetup.FieldNo("Subc. Default Comp. Location")); + + // [THEN] Default Component Location Source is available for later maintenance + Assert.IsFalse(PageControl.IsEmpty(), StrSubstNo(ControlNotExistMsg, ManufacturingSetup.FieldCaption("Subc. Default Comp. Location"))); + end; + [Test] procedure CheckCustCtrl_PagePurchaseOrderSubContractingLocationCode() var @@ -670,6 +821,13 @@ codeunit 139990 "Subc. Subcontracting UI Test" exit(1); end; + [ConfirmHandler] + procedure SetupNotCompletedConfirmHandler(Question: Text[1024]; var Reply: Boolean) + begin + Assert.ExpectedMessage(SetupNotCompletedQst, Question); + Reply := true; + end; + var Assert: Codeunit Assert; LibraryERMCountryData: Codeunit "Library - ERM Country Data"; @@ -688,4 +846,5 @@ codeunit 139990 "Subc. Subcontracting UI Test" ILEProdActionsNotEnabledErr: Label 'Production actions should be enabled for a subcontracting Item Ledger Entry.'; ILEPurchActionsEnabledErr: Label 'Purchase Order action should not be enabled for a non-subcontracting Item Ledger Entry.'; ILEPurchActionsNotEnabledErr: Label 'Purchase Order action should be enabled for a subcontracting Item Ledger Entry.'; + SetupNotCompletedQst: Label 'The Subcontracting setup is not complete. Are you sure you want to exit?'; } \ No newline at end of file From 4beea1e47d02547cf4072df2a5e63729d6e9ad0c Mon Sep 17 00:00:00 2001 From: 6Cript Date: Thu, 30 Jul 2026 11:21:22 +0200 Subject: [PATCH 2/6] spaces removed --- .../App/src/Setup/SubcontractingSetupGuide.Page.al | 2 +- .../Test/Tests/SubcSubcontractingUITest.Codeunit.al | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al index d7c394d9d6a..777d8cfe412 100644 --- a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al +++ b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al @@ -353,4 +353,4 @@ page 99001505 "Subcontracting Setup Guide" then TopBannerVisible := MediaResourcesStandard."Media Reference".HasValue() and MediaResourcesDone."Media Reference".HasValue(); end; -} \ No newline at end of file +} diff --git a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al index 119bcb2b16c..f607212b40b 100644 --- a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al +++ b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al @@ -847,4 +847,4 @@ codeunit 139990 "Subc. Subcontracting UI Test" ILEPurchActionsEnabledErr: Label 'Purchase Order action should not be enabled for a non-subcontracting Item Ledger Entry.'; ILEPurchActionsNotEnabledErr: Label 'Purchase Order action should be enabled for a subcontracting Item Ledger Entry.'; SetupNotCompletedQst: Label 'The Subcontracting setup is not complete. Are you sure you want to exit?'; -} \ No newline at end of file +} From 27e261dde37c9274995a06f4ae95324fff10d662 Mon Sep 17 00:00:00 2001 From: 6Cript Date: Thu, 30 Jul 2026 11:33:01 +0200 Subject: [PATCH 3/6] telemetry added --- .../App/src/Setup/SubcontractingSetupGuide.Page.al | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al index 777d8cfe412..18d6bc2e1f6 100644 --- a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al +++ b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al @@ -11,6 +11,7 @@ using Microsoft.Manufacturing.WorkCenter; using Microsoft.Purchases.Vendor; using System.Environment; using System.Environment.Configuration; +using System.Telemetry; using System.Utilities; page 99001505 "Subcontracting Setup Guide" @@ -273,6 +274,7 @@ page 99001505 "Subcontracting Setup Guide" trigger OnOpenPage() begin Rec.Get(); + FeatureTelemetry.LogUptake('0001Q7N', SubcontractingTok, Enum::"Feature Uptake Status"::Discovered); end; trigger OnQueryClosePage(CloseAction: Action): Boolean @@ -288,6 +290,7 @@ page 99001505 "Subcontracting Setup Guide" MediaRepositoryStandard: Record "Media Repository"; MediaResourcesDone: Record "Media Resources"; MediaResourcesStandard: Record "Media Resources"; + FeatureTelemetry: Codeunit "Feature Telemetry"; BackActionEnabled: Boolean; CompanyDefaultsStepVisible: Boolean; FinishActionEnabled: Boolean; @@ -302,6 +305,7 @@ page 99001505 "Subcontracting Setup Guide" DocumentationUrlLbl: Label 'https://go.microsoft.com/fwlink/?linkid=2345593', Locked = true; LocationsLinkLbl: Label 'Set up locations'; SetupNotCompletedQst: Label 'The Subcontracting setup is not complete. Are you sure you want to exit?'; + SubcontractingTok: Label 'Subcontracting', Locked = true; SubcontractingWorksheetLinkLbl: Label 'Open the Subcontracting Worksheet'; SubcontractorPricesLinkLbl: Label 'Set up subcontractor prices'; VendorsLinkLbl: Label 'Set up vendors'; @@ -338,6 +342,7 @@ page 99001505 "Subcontracting Setup Guide" begin CurrPage.SaveRecord(); GuidedExperience.CompleteAssistedSetup(ObjectType::Page, Page::"Subcontracting Setup Guide"); + FeatureTelemetry.LogUptake('0001Q7O', SubcontractingTok, Enum::"Feature Uptake Status"::"Set up"); SubcApplicationAreaMgmt.RefreshExperienceTierCurrentCompany(); SetupCompleted := true; CurrPage.Close(); From 092cb9fd8f217a46a8d07bc6b24886427f52c300 Mon Sep 17 00:00:00 2001 From: 6Cript Date: Thu, 30 Jul 2026 11:42:46 +0200 Subject: [PATCH 4/6] Improve setup guide confirmation test --- .../Test/Tests/SubcSubcontractingUITest.Codeunit.al | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al index f607212b40b..315835949bd 100644 --- a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al +++ b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al @@ -35,6 +35,7 @@ codeunit 139990 "Subc. Subcontracting UI Test" local procedure Initialize() begin LibraryTestInitialize.OnTestInitialize(Codeunit::"Subc. Subcontracting UI Test"); + LibraryVariableStorage.Clear(); LibrarySetupStorage.Restore(); SubcontractingMgmtLibrary.Initialize(); @@ -132,8 +133,14 @@ codeunit 139990 "Subc. Subcontracting UI Test" Assert.IsFalse(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be disabled on the final step.'); Assert.IsTrue(SubcontractingSetupGuide.ActionFinish.Enabled(), 'Finish should be enabled on the final step.'); + // [WHEN] The user closes the guide without finishing the setup + LibraryVariableStorage.Enqueue(SetupNotCompletedQst); + LibraryVariableStorage.Enqueue(true); SubcontractingSetupGuide.Close(); + // [THEN] The expected confirmation was handled + LibraryVariableStorage.AssertEmpty(); + // [THEN] Opening and navigating the guide did not replace the installed defaults ManufacturingSetup.Get(); Assert.AreEqual(SubcontractingTemplateName, ManufacturingSetup."Subcontracting Template Name", 'The Subcontracting template default should be preserved.'); @@ -824,8 +831,8 @@ codeunit 139990 "Subc. Subcontracting UI Test" [ConfirmHandler] procedure SetupNotCompletedConfirmHandler(Question: Text[1024]; var Reply: Boolean) begin - Assert.ExpectedMessage(SetupNotCompletedQst, Question); - Reply := true; + Assert.ExpectedConfirm(LibraryVariableStorage.DequeueText(), Question); + Reply := LibraryVariableStorage.DequeueBoolean(); end; var @@ -833,6 +840,7 @@ codeunit 139990 "Subc. Subcontracting UI Test" LibraryERMCountryData: Codeunit "Library - ERM Country Data"; LibrarySetupStorage: Codeunit "Library - Setup Storage"; LibraryTestInitialize: Codeunit "Library - Test Initialize"; + LibraryVariableStorage: Codeunit "Library - Variable Storage"; LibraryMfgManagement: Codeunit "Subc. Library Mfg. Management"; SubcontractingMgmtLibrary: Codeunit "Subc. Management Library"; SubSetupLibrary: Codeunit "Subc. Setup Library"; From 1f2d2f4e3aedfbb5885720ea3cde810680d591f1 Mon Sep 17 00:00:00 2001 From: 6Cript Date: Thu, 30 Jul 2026 14:49:42 +0200 Subject: [PATCH 5/6] using added --- .../Test/Tests/SubcSubcontractingUITest.Codeunit.al | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al index 315835949bd..ef946cce6ad 100644 --- a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al +++ b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al @@ -19,6 +19,7 @@ using Microsoft.Purchases.Vendor; using System.Environment.Configuration; using System.Reflection; using System.TestLibraries.Environment.Configuration; +using System.TestLibraries.Utilities; codeunit 139990 "Subc. Subcontracting UI Test" { From 2587b6881c0802a785c4c233391c949010214407 Mon Sep 17 00:00:00 2001 From: 6Cript Date: Fri, 31 Jul 2026 10:47:18 +0200 Subject: [PATCH 6/6] page name changed to include "Wizard" + worksheet link removed from last step --- .../Install/SubcBusinessSetupExt.Codeunit.al | 4 +- .../SubcontractObjs.PermissionSet.al | 2 +- ...e.al => SubcontractingSetupWizard.Page.al} | 18 +--- .../SubcSubcontractingUITest.Codeunit.al | 87 +++++++++---------- 4 files changed, 48 insertions(+), 63 deletions(-) rename src/Apps/W1/Subcontracting/App/src/Setup/{SubcontractingSetupGuide.Page.al => SubcontractingSetupWizard.Page.al} (95%) diff --git a/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al b/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al index 8407938ca4e..4b6b82ef364 100644 --- a/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al +++ b/src/Apps/W1/Subcontracting/App/src/Install/SubcBusinessSetupExt.Codeunit.al @@ -27,7 +27,7 @@ codeunit 99001502 "Subc. Business Setup Ext." AssistedSetupGroup: Enum "Assisted Setup Group"; VideoCategory: Enum "Video Category"; begin - if GuidedExperience.Exists("Guided Experience Type"::"Assisted Setup", ObjectType::Page, Page::"Subcontracting Setup Guide") then + if GuidedExperience.Exists("Guided Experience Type"::"Assisted Setup", ObjectType::Page, Page::"Subcontracting Setup Wizard") then exit; GuidedExperience.InsertAssistedSetup( @@ -36,7 +36,7 @@ codeunit 99001502 "Subc. Business Setup Ext." AssistedSetupDescriptionLbl, 5, ObjectType::Page, - Page::"Subcontracting Setup Guide", + Page::"Subcontracting Setup Wizard", AssistedSetupGroup::ReadyForBusiness, '', VideoCategory::ReadyForBusiness, diff --git a/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al b/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al index 880b343135c..5bef8da75d5 100644 --- a/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al +++ b/src/Apps/W1/Subcontracting/App/src/Permissions/SubcontractObjs.PermissionSet.al @@ -85,7 +85,7 @@ permissionset 99001501 "Subcontract. - Objs" page "Subc. Routing Info Factbox" = X, page "Subc. Transfer Line Factbox" = X, page "Subcontractor Prices" = X, - page "Subcontracting Setup Guide" = X, + page "Subcontracting Setup Wizard" = X, page "Subc. WIP Adjustment" = X, page "Subc. WIP Ledger Entries" = X, diff --git a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupWizard.Page.al similarity index 95% rename from src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al rename to src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupWizard.Page.al index 18d6bc2e1f6..b6a4ee542e3 100644 --- a/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupGuide.Page.al +++ b/src/Apps/W1/Subcontracting/App/src/Setup/SubcontractingSetupWizard.Page.al @@ -14,7 +14,7 @@ using System.Environment.Configuration; using System.Telemetry; using System.Utilities; -page 99001505 "Subcontracting Setup Guide" +page 99001505 "Subcontracting Setup Wizard" { ApplicationArea = All; Caption = 'Subcontracting Setup'; @@ -199,19 +199,6 @@ page 99001505 "Subcontracting Setup Guide" Hyperlink(DocumentationUrlLbl); end; } - field(SubcontractingWorksheetLink; SubcontractingWorksheetLinkLbl) - { - ApplicationArea = All; - Caption = 'Open the Subcontracting Worksheet'; - Editable = false; - ShowCaption = false; - ToolTip = 'Open the Subcontracting Worksheet page.'; - - trigger OnDrillDown() - begin - Page.Run(Page::"Subc. Subcontracting Worksheet"); - end; - } } } } @@ -306,7 +293,6 @@ page 99001505 "Subcontracting Setup Guide" LocationsLinkLbl: Label 'Set up locations'; SetupNotCompletedQst: Label 'The Subcontracting setup is not complete. Are you sure you want to exit?'; SubcontractingTok: Label 'Subcontracting', Locked = true; - SubcontractingWorksheetLinkLbl: Label 'Open the Subcontracting Worksheet'; SubcontractorPricesLinkLbl: Label 'Set up subcontractor prices'; VendorsLinkLbl: Label 'Set up vendors'; WorkCentersLinkLbl: Label 'Set up subcontractor work centers'; @@ -341,7 +327,7 @@ page 99001505 "Subcontracting Setup Guide" SubcApplicationAreaMgmt: Codeunit "Subc. Application Area Mgmt."; begin CurrPage.SaveRecord(); - GuidedExperience.CompleteAssistedSetup(ObjectType::Page, Page::"Subcontracting Setup Guide"); + GuidedExperience.CompleteAssistedSetup(ObjectType::Page, Page::"Subcontracting Setup Wizard"); FeatureTelemetry.LogUptake('0001Q7O', SubcontractingTok, Enum::"Feature Uptake Status"::"Set up"); SubcApplicationAreaMgmt.RefreshExperienceTierCurrentCompany(); SetupCompleted := true; diff --git a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al index ef946cce6ad..4cfc6c7bc52 100644 --- a/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al +++ b/src/Apps/W1/Subcontracting/Test/Tests/SubcSubcontractingUITest.Codeunit.al @@ -65,21 +65,21 @@ codeunit 139990 "Subc. Subcontracting UI Test" Initialize(); // [GIVEN] The Subcontracting assisted setup registration does not exist - AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Guide"); + AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Wizard"); // [WHEN] Assisted setups are registered AssistedSetupTestLibrary.CallOnRegister(); - // [THEN] The Subcontracting setup guide is registered - Assert.IsTrue(AssistedSetupTestLibrary.Exists(Page::"Subcontracting Setup Guide"), 'The Subcontracting assisted setup should be registered.'); + // [THEN] The Subcontracting setup wizard is registered + Assert.IsTrue(AssistedSetupTestLibrary.Exists(Page::"Subcontracting Setup Wizard"), 'The Subcontracting assisted setup should be registered.'); end; [Test] [HandlerFunctions('SetupNotCompletedConfirmHandler')] - procedure SubcontractingSetupGuideShowsCompanyDefaultsAndConfigurationLinks() + procedure SubcontractingSetupWizardShowsCompanyDefaultsAndConfigurationLinks() var ManufacturingSetup: Record "Manufacturing Setup"; - SubcontractingSetupGuide: TestPage "Subcontracting Setup Guide"; + SubcontractingSetupWizard: TestPage "Subcontracting Setup Wizard"; ComponentDirectUnitCost: Option Standard,"Prod. Order Component"; CreateProdOrderInfoLine: Boolean; SubcDefaultCompLocation: Enum "Components at Location"; @@ -87,7 +87,7 @@ codeunit 139990 "Subc. Subcontracting UI Test" SubcontractingBatchName: Code[10]; SubcontractingTemplateName: Code[10]; begin - // [SCENARIO 642233] The setup guide displays the installed company defaults and the next configuration links. + // [SCENARIO 642233] The setup wizard displays the installed company defaults and the next configuration links. Initialize(); // [GIVEN] The company has Subcontracting defaults @@ -99,45 +99,44 @@ codeunit 139990 "Subc. Subcontracting UI Test" SubcCompTransferLeadTime := ManufacturingSetup."Subc. Comp. Transfer Lead Time"; SubcDefaultCompLocation := ManufacturingSetup."Subc. Default Comp. Location"; - // [WHEN] The setup guide is opened - SubcontractingSetupGuide.OpenEdit(); + // [WHEN] The setup wizard is opened + SubcontractingSetupWizard.OpenEdit(); // [THEN] The welcome step is shown - Assert.IsFalse(SubcontractingSetupGuide.ActionBack.Enabled(), 'Back should be disabled on the welcome step.'); - Assert.IsTrue(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be enabled on the welcome step.'); - Assert.IsFalse(SubcontractingSetupGuide.ActionFinish.Enabled(), 'Finish should be disabled on the welcome step.'); + Assert.IsFalse(SubcontractingSetupWizard.ActionBack.Enabled(), 'Back should be disabled on the welcome step.'); + Assert.IsTrue(SubcontractingSetupWizard.ActionNext.Enabled(), 'Next should be enabled on the welcome step.'); + Assert.IsFalse(SubcontractingSetupWizard.ActionFinish.Enabled(), 'Finish should be disabled on the welcome step.'); // [WHEN] The user continues to company defaults - SubcontractingSetupGuide.ActionNext.Invoke(); + SubcontractingSetupWizard.ActionNext.Invoke(); // [THEN] The defaults created during installation are displayed - SubcontractingSetupGuide."Subcontracting Template Name".AssertEquals(SubcontractingTemplateName); - SubcontractingSetupGuide."Subcontracting Batch Name".AssertEquals(SubcontractingBatchName); - SubcontractingSetupGuide."Create Prod. Order Info Line".AssertEquals(CreateProdOrderInfoLine); - SubcontractingSetupGuide."Component Direct Unit Cost".AssertEquals(ComponentDirectUnitCost); - SubcontractingSetupGuide."Subc. Comp. Transfer Lead Time".AssertEquals(SubcCompTransferLeadTime); - SubcontractingSetupGuide."Subc. Default Comp. Location".AssertEquals(SubcDefaultCompLocation); - Assert.IsTrue(SubcontractingSetupGuide.ActionBack.Enabled(), 'Back should be enabled on the company defaults step.'); - Assert.IsTrue(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be enabled on the company defaults step.'); + SubcontractingSetupWizard."Subcontracting Template Name".AssertEquals(SubcontractingTemplateName); + SubcontractingSetupWizard."Subcontracting Batch Name".AssertEquals(SubcontractingBatchName); + SubcontractingSetupWizard."Create Prod. Order Info Line".AssertEquals(CreateProdOrderInfoLine); + SubcontractingSetupWizard."Component Direct Unit Cost".AssertEquals(ComponentDirectUnitCost); + SubcontractingSetupWizard."Subc. Comp. Transfer Lead Time".AssertEquals(SubcCompTransferLeadTime); + SubcontractingSetupWizard."Subc. Default Comp. Location".AssertEquals(SubcDefaultCompLocation); + Assert.IsTrue(SubcontractingSetupWizard.ActionBack.Enabled(), 'Back should be enabled on the company defaults step.'); + Assert.IsTrue(SubcontractingSetupWizard.ActionNext.Enabled(), 'Next should be enabled on the company defaults step.'); // [WHEN] The user continues to the final step - SubcontractingSetupGuide.ActionNext.Invoke(); + SubcontractingSetupWizard.ActionNext.Invoke(); // [THEN] Links to the remaining Subcontracting configuration are displayed - Assert.IsTrue(SubcontractingSetupGuide.WorkCentersLink.Visible(), 'The work centers link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.VendorsLink.Visible(), 'The vendors link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.LocationsLink.Visible(), 'The locations link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.SubcontractorPricesLink.Visible(), 'The subcontractor prices link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.ComponentSupplyMethodsLink.Visible(), 'The component supply methods link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.DocumentationLink.Visible(), 'The documentation link should be visible.'); - Assert.IsTrue(SubcontractingSetupGuide.SubcontractingWorksheetLink.Visible(), 'The Subcontracting Worksheet link should be visible.'); - Assert.IsFalse(SubcontractingSetupGuide.ActionNext.Enabled(), 'Next should be disabled on the final step.'); - Assert.IsTrue(SubcontractingSetupGuide.ActionFinish.Enabled(), 'Finish should be enabled on the final step.'); + Assert.IsTrue(SubcontractingSetupWizard.WorkCentersLink.Visible(), 'The work centers link should be visible.'); + Assert.IsTrue(SubcontractingSetupWizard.VendorsLink.Visible(), 'The vendors link should be visible.'); + Assert.IsTrue(SubcontractingSetupWizard.LocationsLink.Visible(), 'The locations link should be visible.'); + Assert.IsTrue(SubcontractingSetupWizard.SubcontractorPricesLink.Visible(), 'The subcontractor prices link should be visible.'); + Assert.IsTrue(SubcontractingSetupWizard.ComponentSupplyMethodsLink.Visible(), 'The component supply methods link should be visible.'); + Assert.IsTrue(SubcontractingSetupWizard.DocumentationLink.Visible(), 'The documentation link should be visible.'); + Assert.IsFalse(SubcontractingSetupWizard.ActionNext.Enabled(), 'Next should be disabled on the final step.'); + Assert.IsTrue(SubcontractingSetupWizard.ActionFinish.Enabled(), 'Finish should be enabled on the final step.'); // [WHEN] The user closes the guide without finishing the setup LibraryVariableStorage.Enqueue(SetupNotCompletedQst); LibraryVariableStorage.Enqueue(true); - SubcontractingSetupGuide.Close(); + SubcontractingSetupWizard.Close(); // [THEN] The expected confirmation was handled LibraryVariableStorage.AssertEmpty(); @@ -153,12 +152,12 @@ codeunit 139990 "Subc. Subcontracting UI Test" end; [Test] - procedure FinishingSubcontractingSetupGuideSavesDefaultsAndCompletesAssistedSetup() + procedure FinishingSubcontractingSetupWizardSavesDefaultsAndCompletesAssistedSetup() var ManufacturingSetup: Record "Manufacturing Setup"; AssistedSetupTestLibrary: Codeunit "Assisted Setup Test Library"; GuidedExperience: Codeunit "Guided Experience"; - SubcontractingSetupGuide: TestPage "Subcontracting Setup Guide"; + SubcontractingSetupWizard: TestPage "Subcontracting Setup Wizard"; CreateProdOrderInfoLine: Boolean; OriginalCreateProdOrderInfoLine: Boolean; begin @@ -166,27 +165,27 @@ codeunit 139990 "Subc. Subcontracting UI Test" Initialize(); // [GIVEN] The Subcontracting assisted setup is registered and incomplete - AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Guide"); + AssistedSetupTestLibrary.Delete(Page::"Subcontracting Setup Wizard"); AssistedSetupTestLibrary.CallOnRegister(); - AssistedSetupTestLibrary.SetStatusToNotCompleted(Page::"Subcontracting Setup Guide"); - Assert.IsFalse(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Guide"), 'The assisted setup should initially be incomplete.'); + AssistedSetupTestLibrary.SetStatusToNotCompleted(Page::"Subcontracting Setup Wizard"); + Assert.IsFalse(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Wizard"), 'The assisted setup should initially be incomplete.'); - // [GIVEN] A changed company default in the setup guide + // [GIVEN] A changed company default in the setup wizard ManufacturingSetup.Get(); OriginalCreateProdOrderInfoLine := ManufacturingSetup."Create Prod. Order Info Line"; CreateProdOrderInfoLine := not OriginalCreateProdOrderInfoLine; - SubcontractingSetupGuide.OpenEdit(); - SubcontractingSetupGuide.ActionNext.Invoke(); - SubcontractingSetupGuide."Create Prod. Order Info Line".SetValue(CreateProdOrderInfoLine); - SubcontractingSetupGuide.ActionNext.Invoke(); + SubcontractingSetupWizard.OpenEdit(); + SubcontractingSetupWizard.ActionNext.Invoke(); + SubcontractingSetupWizard."Create Prod. Order Info Line".SetValue(CreateProdOrderInfoLine); + SubcontractingSetupWizard.ActionNext.Invoke(); - // [WHEN] The user finishes the setup guide - SubcontractingSetupGuide.ActionFinish.Invoke(); + // [WHEN] The user finishes the setup wizard + SubcontractingSetupWizard.ActionFinish.Invoke(); // [THEN] The company default is saved and the assisted setup is completed ManufacturingSetup.Get(); Assert.AreEqual(CreateProdOrderInfoLine, ManufacturingSetup."Create Prod. Order Info Line", 'The changed company default should be saved.'); - Assert.IsTrue(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Guide"), 'The assisted setup should be completed.'); + Assert.IsTrue(GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Subcontracting Setup Wizard"), 'The assisted setup should be completed.'); ManufacturingSetup."Create Prod. Order Info Line" := OriginalCreateProdOrderInfoLine; ManufacturingSetup.Modify();