From 5546c325930f41c03f7a3ed3c68a884a32b238a7 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 5 Jun 2026 10:52:00 -0400 Subject: [PATCH] test(e2e): move deploy/disable preconditions inside try for guaranteed cleanup (review fix) In Disable_Instance_ShowsOutcomeToast and Enable_Instance_ShowsOutcomeToast, the precondition CLI calls (DeployInstanceAsync / DisableInstanceAsync) were between CreateInstanceAsync and the try block. A throw there would skip the finally DeleteInstanceAsync, leaking the instance. Moved those calls to be the first statements inside try so cleanup always runs once the instance exists. --- .../Deployment/DeploymentActionTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentActionTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentActionTests.cs index af2479e6..28e1add0 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentActionTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentActionTests.cs @@ -86,11 +86,11 @@ public class DeploymentActionTests : IClassFixture Skip.IfNot(_cluster.Available, ClusterAvailability.SkipReason); var (instanceId, uniqueName) = await _cluster.CreateInstanceAsync(); - // Deploy moves the instance config state to Enabled, so the context menu - // offers "Disable" (it would offer "Enable" only for a Disabled instance). - await CliRunner.DeployInstanceAsync(instanceId); try { + // Deploy moves the instance config state to Enabled, so the context menu + // offers "Disable" (it would offer "Enable" only for a Disabled instance). + await CliRunner.DeployInstanceAsync(instanceId); var page = await _pw.NewAuthenticatedPageAsync(); await OpenInstanceContextMenuAsync(page, uniqueName); @@ -119,12 +119,12 @@ public class DeploymentActionTests : IClassFixture Skip.IfNot(_cluster.Available, ClusterAvailability.SkipReason); var (instanceId, uniqueName) = await _cluster.CreateInstanceAsync(); - // Deploy then Disable leaves the instance config state at Disabled, so the - // context menu offers "Enable". - await CliRunner.DeployInstanceAsync(instanceId); - await CliRunner.DisableInstanceAsync(instanceId); try { + // Deploy then Disable leaves the instance config state at Disabled, so the + // context menu offers "Enable". + await CliRunner.DeployInstanceAsync(instanceId); + await CliRunner.DisableInstanceAsync(instanceId); var page = await _pw.NewAuthenticatedPageAsync(); await OpenInstanceContextMenuAsync(page, uniqueName);