From 1d2ba5f373bd22f3ae846ea569761b4c0ef7c8af Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Mon, 18 Aug 2025 18:56:13 +0530
Subject: [PATCH 1/6] Preview Pause changes
---
.../Config/TestSettings.cs | 7 ++++++
.../PowerFx/Functions}/PauseFunction.cs | 23 ++++++++++++++-----
.../PowerFx/PowerFxEngine.cs | 1 +
.../PauseFunctionTests.cs | 1 +
.../testengine.module.pause.tests.csproj | 5 ++++
src/testengine.module.pause/PauseModule.cs | 5 ++--
.../testengine.module.pause.csproj | 5 ++++
7 files changed, 38 insertions(+), 9 deletions(-)
rename src/{testengine.module.pause => Microsoft.PowerApps.TestEngine/PowerFx/Functions}/PauseFunction.cs (66%)
diff --git a/src/Microsoft.PowerApps.TestEngine/Config/TestSettings.cs b/src/Microsoft.PowerApps.TestEngine/Config/TestSettings.cs
index 15e32f262..e67419a69 100644
--- a/src/Microsoft.PowerApps.TestEngine/Config/TestSettings.cs
+++ b/src/Microsoft.PowerApps.TestEngine/Config/TestSettings.cs
@@ -67,5 +67,12 @@ public class TestSettings
/// Define settings for Test Engine Extensions
///
public TestSettingExtensions ExtensionModules { get; set; } = new TestSettingExtensions();
+
+ ///
+ /// Gets or sets whether preview functions are enabled.
+ /// Default is false.
+ /// If set to true, preview functions like Pause() are available for use.
+ ///
+ public bool Preview { get; set; } = true;
}
}
diff --git a/src/testengine.module.pause/PauseFunction.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
similarity index 66%
rename from src/testengine.module.pause/PauseFunction.cs
rename to src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
index 9cfeb81a6..1a182133e 100644
--- a/src/testengine.module.pause/PauseFunction.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
@@ -1,14 +1,14 @@
-// Copyright (c) Microsoft Corporation.
+// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
+using System.Linq; // ADD THIS LINE - Required for .First() method
using Microsoft.Extensions.Logging;
using Microsoft.PowerApps.TestEngine.Config;
using Microsoft.PowerApps.TestEngine.TestInfra;
using Microsoft.PowerFx;
-using Microsoft.PowerFx.Core.Utils;
using Microsoft.PowerFx.Types;
-namespace testengine.module
+namespace Microsoft.PowerApps.TestEngine.PowerFx.Functions
{
///
/// This will pause the current test and allow the user to interact with the browser and inspect state when headless mode is false
@@ -19,8 +19,13 @@ public class PauseFunction : ReflectionFunction
private readonly ITestState _testState;
private readonly ILogger _logger;
+ ///
+ /// Gets a value indicating whether this function is a preview feature
+ ///
+ public bool IsPreview => true;
+
public PauseFunction(ITestInfraFunctions testInfraFunctions, ITestState testState, ILogger logger)
- : base(DPath.Root.Append(new DName("Preview")), "Pause", FormulaType.Blank)
+ : base("Pause", FormulaType.Blank) // Core function - no namespace needed
{
_testInfraFunctions = testInfraFunctions;
_testState = testState;
@@ -32,6 +37,13 @@ public BlankValue Execute()
_logger.LogInformation("------------------------------\n\n" +
"Executing Pause function.");
+ // Check if Preview features are enabled in settings
+ if (!_testState.GetTestSettings().Preview)
+ {
+ _logger.LogWarning("Pause function is a preview feature. Enable Preview in test settings to use this function.");
+ return FormulaValue.NewBlank();
+ }
+
if (!_testState.GetTestSettings().Headless)
{
var page = _testInfraFunctions.GetContext().Pages.First();
@@ -46,5 +58,4 @@ public BlankValue Execute()
return FormulaValue.NewBlank();
}
}
-}
-
+}
\ No newline at end of file
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
index dc6e97270..682a5969c 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
@@ -102,6 +102,7 @@ public void Setup(TestSettings settings)
powerFxConfig.AddFunction(new AssertNotErrorFunction(Logger));
powerFxConfig.AddFunction(new SetPropertyFunction(_testWebProvider, Logger));
powerFxConfig.AddFunction(new IsMatchFunction(Logger));
+ powerFxConfig.AddFunction(new PauseFunction(TestInfraFunctions, TestState, Logger));
if (settings != null && settings.ExtensionModules != null && settings.ExtensionModules.Enable)
{
diff --git a/src/testengine.module.pause.tests/PauseFunctionTests.cs b/src/testengine.module.pause.tests/PauseFunctionTests.cs
index 8ac6b45d0..e0f03d7a0 100644
--- a/src/testengine.module.pause.tests/PauseFunctionTests.cs
+++ b/src/testengine.module.pause.tests/PauseFunctionTests.cs
@@ -8,6 +8,7 @@
using Microsoft.PowerApps.TestEngine.System;
using Microsoft.PowerApps.TestEngine.TestInfra;
using Microsoft.PowerFx;
+using Microsoft.PowerApps.TestEngine.PowerFx.Functions;
using Moq;
namespace testengine.module.browserlocale.tests
diff --git a/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj b/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
index 59fb32f4b..6101e1623 100644
--- a/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
+++ b/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
@@ -23,6 +23,11 @@
+
+
+
+
+
diff --git a/src/testengine.module.pause/PauseModule.cs b/src/testengine.module.pause/PauseModule.cs
index c2ec41d6a..0ae96a7f1 100644
--- a/src/testengine.module.pause/PauseModule.cs
+++ b/src/testengine.module.pause/PauseModule.cs
@@ -23,9 +23,8 @@ public void ExtendBrowserContextOptions(BrowserNewContextOptions options, TestSe
public void RegisterPowerFxFunction(PowerFxConfig config, ITestInfraFunctions testInfraFunctions, ITestWebProvider testWebProvider, ISingleTestInstanceState singleTestInstanceState, ITestState testState, IFileSystem fileSystem)
{
- ILogger logger = singleTestInstanceState.GetLogger();
- config.AddFunction(new PauseFunction(testInfraFunctions, testState, logger));
- logger.LogInformation("Registered Pause()");
+ // Function is now registered as a core function in PowerFxEngine
+ // No longer needed here
}
public async Task RegisterNetworkRoute(ITestState state, ISingleTestInstanceState singleTestInstanceState, IFileSystem fileSystem, IPage Page, NetworkRequestMock mock)
diff --git a/src/testengine.module.pause/testengine.module.pause.csproj b/src/testengine.module.pause/testengine.module.pause.csproj
index cdc844dee..56dd1ed72 100644
--- a/src/testengine.module.pause/testengine.module.pause.csproj
+++ b/src/testengine.module.pause/testengine.module.pause.csproj
@@ -40,6 +40,11 @@
+
+
+
+
+
From 5fc6ac7f71952f9cf73f2bbd25e8d68e751ac16e Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Tue, 19 Aug 2025 13:06:40 +0530
Subject: [PATCH 2/6] fixing build issue
---
.../PowerFx/Functions/PauseFunction.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
index 1a182133e..4d473ee30 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
@@ -1,7 +1,7 @@
-// Copyright (c) Microsoft Corporation.
+// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
-using System.Linq; // ADD THIS LINE - Required for .First() method
+using System.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.PowerApps.TestEngine.Config;
using Microsoft.PowerApps.TestEngine.TestInfra;
@@ -25,7 +25,7 @@ public class PauseFunction : ReflectionFunction
public bool IsPreview => true;
public PauseFunction(ITestInfraFunctions testInfraFunctions, ITestState testState, ILogger logger)
- : base("Pause", FormulaType.Blank) // Core function - no namespace needed
+ : base("Pause", FormulaType.Blank)
{
_testInfraFunctions = testInfraFunctions;
_testState = testState;
From fce019c71b6ecfbe21b169fb402efd0412ddd29e Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Tue, 19 Aug 2025 13:26:17 +0530
Subject: [PATCH 3/6] Pause fucntion issue
---
.../PowerFx/Functions/PauseFunction.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
index 4d473ee30..f49af51ca 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
@@ -58,4 +58,4 @@ public BlankValue Execute()
return FormulaValue.NewBlank();
}
}
-}
\ No newline at end of file
+}
From c25def4bd0a113f8c5b3053e8661d34d17654bdd Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Tue, 19 Aug 2025 14:32:57 +0530
Subject: [PATCH 4/6] build fix
---
.../PowerFx/Functions/PauseFunction.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
index f49af51ca..4d473ee30 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
@@ -58,4 +58,4 @@ public BlankValue Execute()
return FormulaValue.NewBlank();
}
}
-}
+}
\ No newline at end of file
From 0cc793443eef791758a6f334cf7222576a2bfe2a Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Tue, 19 Aug 2025 15:11:49 +0530
Subject: [PATCH 5/6] build fix
---
.../PowerFx/Functions/PauseFunction.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
index 4d473ee30..f49af51ca 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/Functions/PauseFunction.cs
@@ -58,4 +58,4 @@ public BlankValue Execute()
return FormulaValue.NewBlank();
}
}
-}
\ No newline at end of file
+}
From f67d4d1ae2dd649a40fd81c6625ed7eeebbab07e Mon Sep 17 00:00:00 2001
From: v-raghulraja <165115074+v-raghulraja@users.noreply.github.com>
Date: Wed, 20 Aug 2025 13:19:54 +0530
Subject: [PATCH 6/6] Pause keeping pause module
---
.../PowerFx/PowerFxEngine.cs | 1 -
.../testengine.module.pause.tests.csproj | 8 +-------
src/testengine.module.pause/PauseModule.cs | 6 ++++--
.../testengine.module.pause.csproj | 7 +------
4 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs b/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
index 682a5969c..dc6e97270 100644
--- a/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
+++ b/src/Microsoft.PowerApps.TestEngine/PowerFx/PowerFxEngine.cs
@@ -102,7 +102,6 @@ public void Setup(TestSettings settings)
powerFxConfig.AddFunction(new AssertNotErrorFunction(Logger));
powerFxConfig.AddFunction(new SetPropertyFunction(_testWebProvider, Logger));
powerFxConfig.AddFunction(new IsMatchFunction(Logger));
- powerFxConfig.AddFunction(new PauseFunction(TestInfraFunctions, TestState, Logger));
if (settings != null && settings.ExtensionModules != null && settings.ExtensionModules.Enable)
{
diff --git a/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj b/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
index 6101e1623..d79be140f 100644
--- a/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
+++ b/src/testengine.module.pause.tests/testengine.module.pause.tests.csproj
@@ -21,13 +21,7 @@
-
-
-
-
-
-
-
+
diff --git a/src/testengine.module.pause/PauseModule.cs b/src/testengine.module.pause/PauseModule.cs
index 0ae96a7f1..95b0c2035 100644
--- a/src/testengine.module.pause/PauseModule.cs
+++ b/src/testengine.module.pause/PauseModule.cs
@@ -6,6 +6,7 @@
using Microsoft.Playwright;
using Microsoft.PowerApps.TestEngine.Config;
using Microsoft.PowerApps.TestEngine.Modules;
+using Microsoft.PowerApps.TestEngine.PowerFx.Functions;
using Microsoft.PowerApps.TestEngine.Providers;
using Microsoft.PowerApps.TestEngine.System;
using Microsoft.PowerApps.TestEngine.TestInfra;
@@ -23,8 +24,9 @@ public void ExtendBrowserContextOptions(BrowserNewContextOptions options, TestSe
public void RegisterPowerFxFunction(PowerFxConfig config, ITestInfraFunctions testInfraFunctions, ITestWebProvider testWebProvider, ISingleTestInstanceState singleTestInstanceState, ITestState testState, IFileSystem fileSystem)
{
- // Function is now registered as a core function in PowerFxEngine
- // No longer needed here
+ ILogger logger = singleTestInstanceState.GetLogger();
+ config.AddFunction(new PauseFunction(testInfraFunctions, testState, logger));
+ logger.LogInformation("Registered Pause()");
}
public async Task RegisterNetworkRoute(ITestState state, ISingleTestInstanceState singleTestInstanceState, IFileSystem fileSystem, IPage Page, NetworkRequestMock mock)
diff --git a/src/testengine.module.pause/testengine.module.pause.csproj b/src/testengine.module.pause/testengine.module.pause.csproj
index 56dd1ed72..8bc84ddf6 100644
--- a/src/testengine.module.pause/testengine.module.pause.csproj
+++ b/src/testengine.module.pause/testengine.module.pause.csproj
@@ -39,12 +39,7 @@
-
-
-
-
-
-
+