Skip to content

Commit

Permalink
Review edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant-Archibald-MS committed Nov 16, 2024
1 parent 0343a10 commit 3f04ddb
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 36 deletions.
2 changes: 1 addition & 1 deletion discussion/test-authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Using the generated Power Fx command [Generative AI](./generative-ai.md) can be

## How Can I Try This?

This feature is currently available in a development branch of the Power Apps Test Engine. You can read the sample [README](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-ms/data-record-386/samples/coe-kit-setup-wizard/README.md) and follow the steps in the Record and Replay section
This feature is currently available in a development branch of the Power Apps Test Engine. You can read the sample [README](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-ms/data-record-386/samples/coe-kit-setup-wizard) and follow the steps in the Record and Replay section

If you wanted to try this against another Power Platform Model Driven APplication custom page you could alter the [GetAppId.powerfx](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-ms/data-record-386/samples/coe-kit-setup-wizard/GetAppId.powerfx) with the unique name of your model driven application.

Expand Down
4 changes: 2 additions & 2 deletions examples/coe-kit-build-from-source-run-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In contrast, the Power Platform CLI [pac test run](https://learn.microsoft.com/p

### Prerequisites for Source Code Version

To get started with the source code version, you will need to install several tools and have specific permissions. First, you need to install the .Net SDK 6.0, which is essential for building and running the tests. Additionally, PowerShell must be installed on your system, as it is a crucial task automation tool from Microsoft. The Power Platform Command Line Interface (CLI) is another necessary tool, allowing you to interact with Power Platform from your command line. You will also need to create a Power Platform environment, which can be done using the Power Platform Admin Center or the Power Platform Command Line. Furthermore, you must have System Administrator or System Customizer roles to make changes in your Power Platform environment. Lastly, a Git Client should be installed, and the CoE Starter Kit core module must be installed into the environment.
To get started with the source code version, you will need to install several tools and have specific permissions. First, you need to install the .Net SDK 8.0, which is essential for building and running the tests. Additionally, PowerShell must be installed on your system, as it is a crucial task automation tool from Microsoft. The Power Platform Command Line Interface (CLI) is another necessary tool, allowing you to interact with Power Platform from your command line. You will also need to create a Power Platform environment, which can be done using the Power Platform Admin Center or the Power Platform Command Line. Furthermore, you must have System Administrator or System Customizer roles to make changes in your Power Platform environment. Lastly, a Git Client should be installed, and the CoE Starter Kit core module must be installed into the environment.

### Source Code Version Benefits

Expand All @@ -32,7 +32,7 @@ The build from source approach enables the creation of new pull requests to enha

### Getting Started

As documented in the [README.md](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-md/integration-merge/samples/coe-kit-setup-wizard/README.md) to begin, clone the repository using the git application and PowerShell command line. Ensure you are logged out of the pac CLI to clear any previous sessions. Then, log in to the Power Platform CLI and add the config.json file in the same folder as RunLibraryTests.ps1, replacing the values with your tenant and environment ID. Finally, run the sample tests from PowerShell.
As documented in the [CoE Setup Wizard Sample](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-md/integration-merge/samples/coe-kit-setup-wizard/) to begin, clone the repository using the git application and PowerShell command line. Ensure you are logged out of the pac CLI to clear any previous sessions. Then, log in to the Power Platform CLI and add the config.json file in the same folder as RunLibraryTests.ps1, replacing the values with your tenant and environment ID. Finally, run the sample tests from PowerShell.

### What to Expect

Expand Down
22 changes: 13 additions & 9 deletions examples/coe-kit-extending-test-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ To start of the discussion lets look at a snippet of yaml and Power Fx testSteps
testCaseDescription: Verify pre-requistes in place
testSteps: |
=
TestEngine.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
TestEngine.Pause();
Experimental.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
Experimental.Pause();
Set(configStep, 1);
Assert(configStep=1);
Select(btnNext);
Expand All @@ -26,7 +26,7 @@ To start of the discussion lets look at a snippet of yaml and Power Fx testSteps
Assert(configStep=2);
Assert(CountRows(colCommunicate)=3);
Experimental.SelectControl(Button3,1);
TestEngine.Pause();
Experimental.Pause();
```
## Test Case Design
Expand All @@ -40,7 +40,11 @@ Test case isolation is a critical aspect of software testing that ensures each t
### Sequential Test Execution
Sequential test execution involves running test cases one after the other in a specific order. This approach is beneficial when tests need to share a common state or when the outcome of one test case affects the next.
For example, in the CoE Starter Kit Setup and Upgrade Wizard, the first test case, "Step 1 - Confirm Pre-requisites," verifies that the pre-requisites are in place. It involves steps such as displaying the consent dialog, pausing the test engine, setting the configStep variable to 1, and selecting the next button. The second test case, "Step 2 - Configure communication methods," builds on the state set by the first test case, verifying the setup of communication methods by asserting that the configStep variable is set to 2 and checking the colCommunicate collection. This sequential approach ensures that each step is executed in the correct order, maintaining the necessary state throughout the process.
For example, in the CoE Starter Kit Setup and Upgrade Wizard, the first test case, **"Step 1 - Confirm Pre-requisites"** verifies that the pre-requisites are in place. It involves steps such as displaying the consent dialog, pausing the test engine, setting the configStep variable to 1, and selecting the next button.
The second test case, **"Step 2 - Configure communication methods"** builds on the state set by the first test case, verifying the setup of communication methods by asserting that the configStep variable is set to 2 and checking the colCommunicate collection.
This sequential approach ensures that each step is executed in the correct order, maintaining the necessary state throughout the process.
### Parallel Test Execution
Expand All @@ -66,14 +70,14 @@ The Experimental Power Fx namespace is another vital aspect of this extension. I

One example of this is the use of the `Experimental.SelectControl()` function. This function is particularly useful for selecting controls, such as Button3, that exist in galleries. This capability addresses a limitation in the current released version that did not allow `Select()` to be applied to repeating controls inside a gallery. The result enables more comprehensive testing scenarios and ensuring that all aspects of the application are thoroughly tested.

## TestEngine.Pause()
## Experimental.Pause()

The `TestEngine.Pause()` function is a powerful tool in the testing process, allowing you to pause test execution and present the Playwright inspector. This feature is particularly useful for building and verifying tests, as it provides an opportunity to interact with the application in real-time.
The `Experimental.Pause()` function is a powerful tool in the testing process, allowing you to pause test execution and present the Playwright inspector. This feature is particularly useful for building and verifying tests, as it provides an opportunity to interact with the application in real-time.

When you invoke `TestEngine.Pause()`, the test execution halts, and the Playwright inspector is displayed. This interactive environment enables you to examine the current state of the application, inspect elements, and perform actions manually. By doing so, you can verify that the test steps are executing as expected and make any necessary adjustments on the fly.
When you invoke `Experimental.Pause()`, the test execution halts, and the Playwright inspector is displayed. This interactive environment enables you to examine the current state of the application, inspect elements, and perform actions manually. By doing so, you can verify that the test steps are executing as expected and make any necessary adjustments on the fly.

Using `TestEngine.Pause()` is especially beneficial during the development of test cases. It allows you to step through the test script, observe the behavior of the application, and ensure that each step produces the desired outcome. This iterative process helps in identifying and resolving issues early, leading to more robust and reliable test scripts.
Using `Experimental.Pause()` is especially beneficial during the development of test cases. It allows you to step through the test script, observe the behavior of the application, and ensure that each step produces the desired outcome. This iterative process helps in identifying and resolving issues early, leading to more robust and reliable test scripts.

Moreover, the Playwright inspector provides a visual representation of the application, making it easier to understand the context of each test step. You can interact with the application elements, check their properties, and validate that the test assertions are correct. This hands-on approach enhances the accuracy of your tests and ensures that they cover all necessary scenarios.

In summary, TestEngine.Pause() is an invaluable feature for building and verifying tests. By pausing test execution and presenting the Playwright inspector, it allows you to interact with the application, inspect elements, and ensure that your test scripts are accurate and reliable. This interactive process not only simplifies test development but also enhances the overall quality of your testing efforts.
In summary, Experimental.Pause() is an invaluable feature for building and verifying tests. By pausing test execution and presenting the Playwright inspector, it allows you to interact with the application, inspect elements, and ensure that your test scripts are accurate and reliable. This interactive process not only simplifies test development but also enhances the overall quality of your testing efforts.
4 changes: 2 additions & 2 deletions examples/coe-kit-infrastructure-as-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Once the application is created, a user with the required permissions will need

## Setting up a new Test Tenant

As an optional step if you have created an empty test tenant and have completed the bootstrap process, you can follow the template provided in [Demo Tenant Sample](https://github.com/Grant-Archibald-MS/power-platform-terraform-quickstarts/blob/grant-archibald-ms/coe-kit-connections/quickstarts/103-demo-tenant/README.md).
As an optional step if you have created an empty test tenant and have completed the bootstrap process, you can follow the template provided in [Demo Tenant Sample](https://github.com/Grant-Archibald-MS/power-platform-terraform-quickstarts/blob/grant-archibald-ms/coe-kit-connections/quickstarts/103-demo-tenant).

This template provide optional steps to do the following:
1. Create a set of sample test users with random passwords.
Expand All @@ -158,7 +158,7 @@ This template provide optional steps to do the following:

Follow the following post bootstrap steps to create

1. Review the [README](https://github.com/Grant-Archibald-MS/power-platform-terraform-quickstarts/blob/grant-archibald-ms/coe-kit-connections/quickstarts/103-demo-tenant/README.md)
1. Review the [103-demo-tenant](https://github.com/Grant-Archibald-MS/power-platform-terraform-quickstarts/blob/grant-archibald-ms/coe-kit-connections/quickstarts/103-demo-tenant)

2. Remember to clear your pac cli authentication and login to your tenant

Expand Down
4 changes: 2 additions & 2 deletions examples/coe-kit-setup-and-install-wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The custom page of the application introduced testing complexities such as the c
We does this look like? In one of our test steps we take advantage of the Power Fx extensions for test engine to add a command similar to the following.

```powerfx
TestEngine.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
Experimental.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
```

This function waits to see if the Consent Dialog Appears, if it does it accepts the connections. If the text "Center of Excellence Setup Wizard" appears then it continues with the remaining test steps.
Expand All @@ -78,7 +78,7 @@ The [ConsentDialogFunction](https://github.com/microsoft/PowerApps-TestEngine/bl

## Scaling Guidance

In addition to focusing on the technical code elements of core functionality and tests, we are contributing to the wider low-code [testing guidance](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-ms/docs/docs/README.md) based on our experiences so far.
In addition to focusing on the technical code elements of core functionality and tests, we are contributing to the wider low-code [testing guidance documentation](https://github.com/microsoft/PowerApps-TestEngine/tree/grant-archibald-md/integration-merge/docs) based on our experiences so far.

By sharing our learnings, we aim to help the broader community implement effective automated testing strategies, ensuring that others can benefit from our insights and improve their own testing processes.

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-page-variables-and-collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Key parts of this [example test](https://github.com/microsoft/PowerApps-TestEngi


```powerfx
TestEngine.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
Experimental.ConsentDialog(Table({Text: "Center of Excellence Setup Wizard"}));
Set(configStep, 1);
Assert(configStep=1);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In this example, we explore the extensibility of TestEngine Power FX using C# te

We will discuss extending the code-first extensibility of web-based Playwright commands. This approach enables developers to write custom test scripts that leverage the powerful capabilities of Playwright for browser automation.

Providers in TestEngine understand the underlying model of the component being tested. They create Power FX abstractions that hide complexity, allowing testers to focus on the high-level logic of their tests. To allaow code first extension the ```TestEngine.PlaywrightScript()``` Power FX function allows scripts to be recorded or authored in C# to extend the test.
Providers in TestEngine understand the underlying model of the component being tested. They create Power FX abstractions that hide complexity, allowing testers to focus on the high-level logic of their tests. To allaow code first extension the ```Experimental.PlaywrightScript()``` Power FX function allows scripts to be recorded or authored in C# to extend the test.

![Diagram that shows mapping of PlaywrightScript function to to C# class](./media/powerfx+csharp.png)

Expand All @@ -24,11 +24,11 @@ By using TestEngine, developers can handle common code efficiently and focus on

TestEngine provides the ability to "no cliffs" extension with C# to interact with Playwright. This feature allows developers to write custom C# code for scenarios where Power FX alone is insufficient.

One powerful combination is using the C# script with the `TestEngine.Pause()` command. This function pauses the test execution and displays the Playwright Test Explorer. From the Playwright Test Explorer, developers can inspect the state of the web page, which is invaluable for debugging and understanding the current state of the application under test.
One powerful combination is using the C# script with the `Experimental.Pause()` command. This function pauses the test execution and displays the Playwright Test Explorer. From the Playwright Test Explorer, developers can inspect the state of the web page, which is invaluable for debugging and understanding the current state of the application under test.

Additionally, the Playwright Test Explorer offers the capability to record actions performed on the web page. These recorded actions can then be converted into C# scripts, which can be integrated back into the test. This feature streamlines the process of generating parts of the C# script, making it easier to create accurate and efficient test scripts.

By leveraging `TestEngine.Pause()`, developers can:
By leveraging `Experimental.Pause()`, developers can:
- **Inspect Web Page State**: Pause the test to examine the current state of the web page, helping to identify issues and verify that the application is behaving as expected.
- **Record C# Scripts**: Use the Playwright Test Explorer to record interactions with the web page. These interactions can be automatically converted into C# code, reducing the manual effort required to write test scripts.
- **Enhance Debugging**: The ability to pause and inspect the test execution provides a powerful debugging tool, allowing developers to quickly identify and resolve issues.
Expand All @@ -38,13 +38,13 @@ By leveraging `TestEngine.Pause()`, developers can:
This examples how Power FX provides a powerful capability to act as an extensible domain-specific language (DSL) to encapsulate testing content. This flexibility makes it a powerful tool for writing and maintaining test scripts using both low code PowerFX and code first C# scripts together.


## Overview with TestEngine.PlaywrightScript()
## Overview with Experimental.PlaywrightScript()

To illustrate the integration, we explain how the process works with `TestEngine.PlaywrightScript("sample.csx")` works:
To illustrate the integration, we explain how the process works with `Experimental.PlaywrightScript("sample.csx")` works:

- **Compile the Code Using Roslyn**: The script is compiled using the [Roslyn compiler](https://learn.microsoft.com/dotnet/csharp/roslyn-sdk/), ensuring that the C# code is executed efficiently.
- **Implement Defined C# Class**: The compiled code implements a defined C# class that will be called from the Power FX script, enabling seamless interaction between the PowerFX code and the C# and .Net components.

## Example Script

A examplof of using `TestEngine.PlaywrightScript()` is in [testPlan.fx.yaml](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-md/integration-merge/samples/playwrightscript/testPlan.fx.yaml)
A examplof of using `Experimental.PlaywrightScript()` is in [testPlan.fx.yaml](https://github.com/microsoft/PowerApps-TestEngine/blob/grant-archibald-md/integration-merge/samples/playwrightscript/testPlan.fx.yaml)
Loading

0 comments on commit 3f04ddb

Please sign in to comment.