microsoft / PowerApps-TestEngine

MIT License
93 stars 28 forks source link

Add test recording to the pac command line #329

Open pvillads opened 1 month ago

pvillads commented 1 month ago

Describe the deliverable

This is the pro-dev story. We have previously shown this by executing the Pause() power-fx function within a test, which would open the playwright recorder inside VS code. This is the experience we are looking for, but not from within the test itself, but from outside it, i.e. from the pac cli command:

pac test record --web-page https://aurorabapenvc8e8a.crm10.dynamics.com/

This would open VS code and the designated application. As the user clicks in the application, playwright will do its work, and enter the source code for the test case in a window. It is then up to the pro-developer to paste this code back into the YAML file as appropriate.

Ideally, this would work with ANY website, not just power apps. It allows us to run tests against model driven apps (before we fix that in a better way, by providing better power-fx abstractions for those) , but it should work for any app, like the FnO apps as well, as shown above.

Additional context

From a mail by Grant: I could see that this could be done. One item that could be considered is a new pac test command, maybe something like

pac test record --testSettings settings.json --test-output-file record.csx

Where settings.json could look something like

{ "profile": "user1", "authenticate": "certificate", "settings": { "AzureKeyVaultName": "name", "Path": "path to the key value" } }

This could:

  1. Check if the profile for user1 has been created, if it has not the user would need to interactively login or apply CBA.
  2. Bring up the playwright inspector
  3. Generate the file record.csx with boilerplate C# and an // INSERT CODE here

[Add any other context about the problem here.]
[Add any helpful context on the .msapp like created from teams, contains custom pcf components, etc.]