From 551b753425b58820e3e0a255f18a03c4e06516bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 4 Jul 2024 17:47:31 +0200 Subject: [PATCH] Optimizing basic Media operations testing --- .../MediaOperationsTestingUITestContextExtensions.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lombiq.Tests.UI/BasicOrchardFeaturesTesting/MediaOperationsTestingUITestContextExtensions.cs b/Lombiq.Tests.UI/BasicOrchardFeaturesTesting/MediaOperationsTestingUITestContextExtensions.cs index ad1ab5648..c1dced671 100644 --- a/Lombiq.Tests.UI/BasicOrchardFeaturesTesting/MediaOperationsTestingUITestContextExtensions.cs +++ b/Lombiq.Tests.UI/BasicOrchardFeaturesTesting/MediaOperationsTestingUITestContextExtensions.cs @@ -34,6 +34,10 @@ public static Task TestMediaOperationsAsync(this UITestContext context) => await context .Get(By.CssSelector($"a[href=\"/media/{imageName}\"]").OfAnyVisibility()) .ClickReliablyAsync(context); + // Closing the newly opened tab with the image, so the browser doesn't continue to switch the UI back + // and forth. + context.SwitchToLastWindow(); + context.Driver.Close(); context.SwitchToFirstWindow(); context.WaitForPageLoad(); @@ -54,6 +58,8 @@ await context await context .Get(By.CssSelector($"a[href=\"/media/{documentName}\"]")) .ClickReliablyAsync(context); + context.SwitchToLastWindow(); + context.Driver.Close(); context.SwitchToFirstWindow(); context.WaitForPageLoad();