Overview: I am using a C# Console app to run my power Apps to verify that it is working correctly.
Approach: I'm not using NodeJs but I'll use C# and add it into my devOps pipelines. I assume you have VS Code installed (you need the C# extensions, I have kept my notes at the bottom of the post). I'm using .NET 6 core SDK and the Microsoft.Playwright package. I'm not using any of the .NET testing frameworks to keep it simple.
Tips: Playwright by default use headless browser testing, I want the test to use my local JWT that I have stored against my Chrome browser. If I tell Playwright to use show the browser i.e., headless=false, it logs me in using my cached credentials. You should parameterise the login and store the username/pswd somewhere secure like a key vault.
Code Example:
Replace the C# code in the console as I have done above, and hit F5 (Run>Debug). The test logs me into the Canvas app and returns the Title of the page.
Note: I like the Canvas app testing feature but this is better as I can easily add testing to my CI/CD pipelines, tooling and recording is better and there are more ways I can use the Playwright approach.
Notes for installing Playwright on VSCode to use C#
1. Install VS Code and add the following two extensions
No comments:
Post a Comment