{"id":41934,"date":"2025-08-04T14:22:48","date_gmt":"2025-08-04T08:52:48","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=41934"},"modified":"2025-08-04T15:01:17","modified_gmt":"2025-08-04T09:31:17","slug":"exploring-preview-power-fx-functions-in-power-apps-test-engine","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2025\/08\/exploring-preview-power-fx-functions-in-power-apps-test-engine\/","title":{"rendered":"Exploring Preview Power Fx Functions in Power Apps Test Engine"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41940\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine.png\" alt=\"Exploring Preview Power Fx Functions in Power Apps Test Engine\" width=\"2100\" height=\"1200\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine.png 2100w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-300x171.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-1024x585.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-768x439.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-1536x878.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-2048x1170.png 2048w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/Exploring-Preview-Power-Fx-Functions-in-Power-Apps-Test-Engine-660x377.png 660w\" sizes=\"(max-width: 2100px) 100vw, 2100px\" \/><\/p>\n<p>Microsoft Power Apps Test Engine provides a powerful automation framework to validate Canvas apps using test plans written in YAML and Power Fx.<br \/>\nWith the recent releases, Microsoft has introduced Preview Power Fx functions, enabling deeper, more realistic interaction with the app, pausing test execution, running Playwright scripts, and more.<\/p>\n<h3><strong>Prerequisites<\/strong><\/h3>\n<ol>\n<li>To start using the preview functions, ensure you have the Power Platform CLI (pac CLI) installed with version 27.5 or later.<\/li>\n<li>Before getting started with this blog, make sure you&#8217;ve completed the necessary setup and configuration. You can follow the instructions provided in this <a href=\"https:\/\/www.inogic.com\/blog\/2025\/07\/automating-ui-testing-for-canvas-apps-with-power-platform-test-engine\/\">blog link<\/a> to get everything ready.<\/li>\n<\/ol>\n<p>Please find some preview PowerFx functions that we can use to create a YAML test suite:<\/p>\n<h4>1. Preview.Pause(milliseconds: Number)<\/h4>\n<p><strong>Purpose<\/strong>: Pauses the execution of the test for the given number of milliseconds. Useful when you need to wait for UI changes, animations, async data loads, or events before the next test step. This is a non-blocking delay function used between steps.<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<p>Preview.Pause(2000); \/\/ Wait for 2 seconds<\/p>\n<h4>2. Preview.PlaywrightAction(action: Text, selector: Text)<\/h4>\n<p><strong>Purpose<\/strong>: Executes a raw Playwright UI action on an HTML element using a selector. This enables fine-grained UI control, such as clicking DOM elements directly. Supported actions: &#8220;click&#8221;, &#8220;dblclick&#8221;, &#8220;hover&#8221;, &#8220;fill&#8221;, &#8220;press&#8221;, etc.<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<p>Preview.PlaywrightAction(&#8220;click&#8221;, &#8220;text=Submit&#8221;);<\/p>\n<h4>3. Preview.PlaywrightActionValue(action: Text, selector: Text, value: Text<\/h4>\n<p><strong>Purpose<\/strong>: Like PlaywrightAction, but lets you pass a <strong>value<\/strong> with the action \u2014 e.g., for filling input fields.<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<p>Preview.PlaywrightActionValue(&#8220;fill&#8221;, &#8220;input[name=&#8217;email&#8217;]&#8221;, &#8220;test@example.com&#8221;);<\/p>\n<h4>4. Preview.SelectControl(controlName: Text<\/h4>\n<p><strong>Purpose<\/strong>: Selects a Power Apps control <strong>by its name<\/strong>, useful when Select() does not work (e.g., deeply nested or dynamic controls). Designed to work when Select(MyControl) fails or is ambiguous.<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<p>Preview.SelectControl(&#8220;LoginButton&#8221;);<\/p>\n<p>This works only if the control has a globally unique name and is present in the current screen context.<\/p>\n<p><strong>Please find the steps below on how to configure and execute test suite on Canvas app.<\/strong><\/p>\n<p>Step 1: To showcase these functions, we\u2019ve created a simple Canvas app with standard login controls\u2014UsernameInput, PasswordInput, and LoginButton.<\/p>\n<h3><img decoding=\"async\" class=\"alignnone size-full wp-image-41935\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine.png\" alt=\"Power Apps Test Engine\" width=\"1380\" height=\"610\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine.png 1380w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine-300x133.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine-1024x453.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine-768x339.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/1Power-Apps-Test-Engine-660x292.png 660w\" sizes=\"(max-width: 1380px) 100vw, 1380px\" \/><\/h3>\n<p>Step 2: Create a YAML suite.<\/p>\n<p>The test cases are defined in a YAML file (as explained in the blog linked at the beginning).<\/p>\n<p>Below is a sample YAML test plan that demonstrates how to use Power Fx Test Engine Preview functions in your Canvas app testing scenarios.<\/p>\n<pre class=\"lang:css gutter:true start:1\"><em>testSuite:<\/em>\r\n\r\n<em>\u00a0 testSuiteName: LoginCanvasApp<\/em>\r\n\r\n<em>\u00a0 testSuiteDescription: Validates login using Preview Power Fx functions<\/em>\r\n\r\n<em>\u00a0 persona: User1<\/em>\r\n\r\n<em>\u00a0 appLogicalName: [YOUR_CANVAS_APP_ID]<\/em>\r\n\r\n<em>\u00a0<\/em>\r\n\r\n<em>testCases:<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 - testCaseName: Valid Login with Power Fx<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0 testSteps: |<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"UsernameInput\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightActionValue(\"Fill\", null, \"admin\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"PasswordInput\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightActionValue(\"Fill\", null, \"1234\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"LoginButton\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightAction(\"Click\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.Pause(2000); <\/em>\r\n\r\n<em>\u00a0<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 - testCaseName: Invalid Login with Wrong Password<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0 testSteps: |<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"UsernameInput\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightActionValue(\"Fill\", null, \"admin\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"PasswordInput\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightActionValue(\"Fill\", null, \"wrongpass\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.SelectControl(\"LoginButton\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.PlaywrightAction(\"Click\");<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Preview.Pause(2000);<\/em>\r\n\r\n<em>\u00a0<\/em>\r\n\r\n<em>testSettings:<\/em>\r\n\r\n<em>\u00a0 locale: \"en-US\"<\/em>\r\n\r\n<em>\u00a0 recordVideo: true<\/em>\r\n\r\n<em>\u00a0 enablePowerFxPreview: true<\/em>\r\n\r\n<em>\u00a0 browserConfigurations:<\/em>\r\n\r\n<em>\u00a0 - browser: Chromium<\/em>\r\n\r\n<em>\u00a0<\/em>\r\n\r\n<em>environmentVariables:<\/em>\r\n\r\n<em>\u00a0 users:<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 - personaName: User1<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0 emailKey: user1Email<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0\u00a0\u00a0 passwordKey: user1Password<\/em><\/pre>\n<p>&nbsp;<\/p>\n<p>Please find below the properties that we need to configure while writing the test suite:<\/p>\n<ol>\n<li>appLogicalName \u2013 Replace this with the <strong>Canvas <\/strong><strong>App ID<\/strong> of your Canvas app.<\/li>\n<li>testCases \u2013 Define your individual test scenarios here. In this example, we\u2019ve included two test cases: one for a valid login and another for an invalid login attempt.<\/li>\n<li>testSettings \u2013<\/li>\n<\/ol>\n<p>recordVideo: It enables video recording of the test run. The video will be available in the TestOutput folder, as shown in the screenshot below.<\/p>\n<p>enablePowerFxPreview: This setting is required to enable usage of <strong>preview functions<\/strong> like Preview.Pause, Preview.SelectControl, and Select within your test cases.<\/p>\n<p>Step 3: To execute the test suite, run the following command in the terminal:<\/p>\n<p><strong><em>pac tests run &#8211;test-plan-file &lt;YAML file path&gt; &#8211;environment-id &lt;YOUR_ENVIRONMENT_ID&gt; &#8211;tenant &lt;YOUR_TENANT_ID&gt;<\/em><\/strong><\/p>\n<p>Step 4: After executing the test suite execution command, you will get the exact output, which will show you how many test cases failed and how many of them passed. For further details of test cases results, you can redirect to the test suite directory as shown in the screenshot below.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41936\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine.png\" alt=\"Power Apps Test Engine\" width=\"1379\" height=\"705\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine.png 1379w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine-300x153.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine-1024x524.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine-768x393.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/08\/2Power-Apps-Test-Engine-660x337.png 660w\" sizes=\"(max-width: 1379px) 100vw, 1379px\" \/><\/p>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>Preview Power Fx functions significantly extend the capabilities of the Power Apps Test Engine, enabling more flexible, reliable, and intelligent automation for Canvas apps. By combining low-code automation with advanced testing techniques.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Power Apps Test Engine provides a powerful automation framework to validate Canvas apps using test plans written in YAML and Power Fx. With the recent releases, Microsoft has introduced Preview Power Fx functions, enabling deeper, more realistic interaction with the app, pausing test execution, running Playwright scripts, and more. Prerequisites To start using the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2025\/08\/exploring-preview-power-fx-functions-in-power-apps-test-engine\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44],"tags":[3200],"class_list":["post-41934","post","type-post","status-publish","format-standard","hentry","category-power-apps","tag-power-apps-test-engine"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/41934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=41934"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/41934\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=41934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=41934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=41934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}