-
Notifications
You must be signed in to change notification settings - Fork 43
Enabling PowerApps MDA Table, Form, Classic Form for Custom Pages with Test Engine Support #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
v-nabalasubr
wants to merge
8
commits into
main
Choose a base branch
from
user/v-nabalasubr/Mda_formtablecontrol3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
049d1af
Changes for Table, Form and Classic Form controls
v-nabalasubr 325cd8f
Merge branch 'main' into user/v-nabalasubr/Mda_formtablecontrol3
v-nabalasubr baa24e4
Adding change for DateTime data type support
v-nabalasubr f5d0419
Merge branch 'main' into user/v-nabalasubr/Mda_formtablecontrol3
v-nabalasubr 2afc7d8
comments removed
v-nabalasubr 5cd572f
Merge branch 'main' into user/v-nabalasubr/Mda_formtablecontrol3
snamilikonda 0928145
Updating the provider name in command line
v-nabalasubr 0f6ea51
Updated Provider name in cli
v-nabalasubr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Overview | ||
|
||
This Power Apps Test Engine sample demonstrates how to assert and interact with the values of Table, Form, and Classic Forms—EditForm and ViewForm controls—in a model-driven application form. | ||
|
||
## Usage | ||
|
||
1. **Build the Test Engine Solution** | ||
Ensure the Power Apps Test Engine solution is built and ready to be executed. | ||
|
||
2. **Get the URL of the Model-Driven Application Form** | ||
Acquire the URL of the specific model-driven application form that you want to test. | ||
|
||
3. **Modify the testPlan.fx.yaml** | ||
Update the YAML file to assert expected values of the Table, Form, and Classic Forms—EditForm and ViewForm controls. | ||
|
||
> **Note:** The controls are referenced using the [logical name](https://learn.microsoft.com/power-apps/developer/data-platform/entity-metadata#table-names). | ||
|
||
4. **Update the Domain URL for Your Model-Driven Application** | ||
|
||
| URL Part | Description | | ||
| ---------------------------------------------- | ------------------------------------------------------- | | ||
| `appid=a1234567-cccc-44444-9999-a123456789123` | The unique identifier of your model-driven application. | | ||
| `etn=` | The name of the entity being validated. | | ||
| `id=26bafa27-ca7d-ee11-8179-0022482a91f4` | The unique identifier of the record being edited. | | ||
| `pagetype=custom` | The type of page to open. | | ||
| `UserAuth=storagestate` | The type of user authentication to use. | | ||
| `UseStaticContext=True` | A flag indicating the use of a static context. | | ||
|
||
5. **Execute the Test for Custom Page** | ||
Please replace the example URLs with your organization's URL. Validate the number of records in the Employee table before executing the test plan. If needed, update the number in the test plan. | ||
|
||
**Command for Form and Table Controls:** | ||
```pwsh | ||
cd bin\Debug\PowerAppsEngine | ||
dotnet PowerAppsTestEngine.dll -i ..\..\..\samples\mdaformtablecontrol\formtablecontroltestplan.fx.yaml -e 00000000-0000-0000-0000-11112223333 -t 11112222-3333-4444-5555-666677778888 -u browser -p mda -d "https://orgfc708206.crm.dynamics.com/main.aspx?appid=706281e3-b1ed-ef11-be20-7c1e526718b6&pagetype=custom&name=cr693_employeedetails_7f620" | ||
``` | ||
|
||
**Command for Classic Form and Table Controls:** | ||
```pwsh | ||
cd bin\Debug\PowerAppsEngine | ||
dotnet PowerAppsTestEngine.dll -i ..\..\..\samples\mdaformtablecontrol\classicformtablecontroltestplan.fx.yaml -e 00000000-0000-0000-0000-11112223333 -t 11112222-3333-4444-5555-666677778888 -u browser -p mda -d "https://orgfc708206.crm.dynamics.com/main.aspx?appid=706281e3-b1ed-ef11-be20-7c1e526718b6&pagetype=custom&name=cr7d6_classicforms_e08a2" | ||
``` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# Get current directory so we can reset back to it after running the tests | ||
$currentDirectory = Get-Location | ||
|
||
$config = Get-Content -Path .\config.json -Raw | ConvertFrom-Json | ||
$tenantId = $config.tenantId | ||
$environmentId = $config.environmentId | ||
$user1Email = $config.user1Email | ||
|
||
if ([string]::IsNullOrEmpty($environmentId)) { | ||
Write-Error "Environment not configured. Please update config.json" | ||
return | ||
} | ||
|
||
# Build the latest debug version of Test Engine from source | ||
Set-Location ..\..\src | ||
dotnet build | ||
|
||
if ($config.installPlaywright) { | ||
Start-Process -FilePath "pwsh" -ArgumentList "-Command `"..\bin\Debug\PowerAppsTestEngine\playwright.ps1 install`"" -Wait | ||
} else { | ||
Write-Host "Skipped playwright install" | ||
} | ||
|
||
Set-Location ..\bin\Debug\PowerAppsTestEngine | ||
$env:user1Email = $user1Email | ||
# Run the tests for each user in the configuration file. | ||
dotnet PowerAppsTestEngine.dll -u "storagestate" -p "mda" -a "none" -i "$currentDirectory\formtablecontroltestplan.fx.yaml" -t $tenantId -e $environmentId | ||
|
||
# Reset the location back to the original directory. | ||
Set-Location $currentDirectory |
158 changes: 158 additions & 0 deletions
158
samples/mdaformtablecontrol/classicformtablecontroltestplan.fx.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
testSuite: | ||
testSuiteName: MDA Custom Page tests - Table and Classic Edit and View form Control | ||
testSuiteDescription: Verify test cases for Table and Classic Edit and View form Control in Custom Page | ||
persona: User1 | ||
appLogicalName: NotNeeded | ||
|
||
testCases: | ||
- testCaseName: Test Table Control - Selected Property | ||
testCaseDescription: Verify that selecting a row updates the Selected property correctly. | ||
testSteps: | | ||
SetProperty(Table1.SelectedItems, Table(Index(Table1.Items, 5))); | ||
Select(Table1, 5); | ||
Wait(FormViewer1, "Visible", true); | ||
Assert(Form1.Visible = false && FormViewer1.Visible = true, "Checking if the View form is displayed and Edit form is hidden correctly"); | ||
Assert(Employee_Name_DataCard2.Default = "Diana Prince", "Checking if the selected record in the table display correctly in view form"); | ||
|
||
- testCaseName: Test Table Control - Validate the Selected Record in Form | ||
testCaseDescription: Verify that selected record in the table display correctly in view form. | ||
testSteps: | | ||
SetProperty(Table1.SelectedItems, Table(First(Table1.Items))); | ||
Assert(Employee_Name_DataCard2.Default = "George Clooney", "Checking if the selected record in the table display correctly in view form"); | ||
|
||
- testCaseName: Test Edit Form through Edit Button | ||
testCaseDescription: Verify that Edit form is visible on click of Edit button. | ||
testSteps: | | ||
Select(btnEdit); | ||
Assert(Form1.Visible = true && FormViewer1.Visible = false, "Checking if the Edit form is displayed and View form is hidden correctly"); | ||
|
||
- testCaseName: Test Form Control in Edit Mode - Validate Mode | ||
testCaseDescription: Verify that Form control is in Edit mode. | ||
testSteps: | | ||
Assert(Form1.DefaultMode = 0, "Checking if the form control is in edit mode during edit operation"); | ||
|
||
- testCaseName: Test Edit Form through updating field value | ||
testCaseDescription: Verify that Edit form through updating field value. | ||
testSteps: | | ||
SetProperty(Department_DataCard1.Default, {Id:681470003,Value:"Sales"}); | ||
SetProperty(DOB_DataCard1.Default, DateTime(1983,01,09,10,0,0)); | ||
SetProperty(Email_DataCard1.Default, "xyz123@abc.com"); | ||
Select(btnUpdate); | ||
SetProperty(Table1.SelectedItems, Table(First(Table1.Items))); | ||
Select(Table1, 1); | ||
Wait(FormViewer1, "Visible", true); | ||
Assert(DOB_DataCard2.Default = "1/9/1983 10:00 AM", "Check if the DOB displays '01/09/1983 10:00 AM'."); | ||
Assert(Email_DataCard2.Default = "xyz123@abc.com", "Checking if the email value updated to new value"); | ||
Assert(CountRows('DataCardValue12'.SelectedItems) = 1, "Check if only one item is selected in Department Field."); | ||
Assert(Form1.Visible = false && FormViewer1.Visible = true, "Checking if the Edit form is displayed and View form is hidden correctly"); | ||
|
||
|
||
# | ||
# | ||
# - testCaseName: Test Form Control in Edit Mode - Validate Mode | ||
# testCaseDescription: Verify that Form control is in edit mode during edit operation. | ||
# testSteps: | | ||
# SetProperty(Form2.DefaultMode, 0); | ||
# Assert(Form2.DefaultMode = 0, "Checking if the form control is in edit mode during edit operation"); | ||
|
||
# - testCaseName: Test Form Control in Edit Mode - Edit Value of Form Controls | ||
# testCaseDescription: Verify that Form control is in edit mode during edit operation. | ||
# testSteps: | | ||
# SetProperty(Department_DataCard2.Default, {Id:681470003,Value:"Sales"}); | ||
# SetProperty(Address_DataCard2.Default, "152 South Cross Street"); | ||
# SetProperty(Email_DataCard2.Default, "xyz@abc.com"); | ||
# SetProperty(Phone_Number_DataCard2.Default, "0987654321"); | ||
# SetProperty(DOB_DataCard3.Default, DateTime(1983,01,09,09,0,0)); | ||
# Select(btnEdit); | ||
# SetProperty(Table1.SelectedItems, Table(First(Table1.Items))); | ||
# Assert(Email_DataCard2.Default = "xyz@abc.com", "Checking if the email value updated to new value"); | ||
# Assert(Phone_Number_DataCard2.Default = "0987654321", "Checking if the phone value updated to new value"); | ||
# Assert(DOB_DataCard3.Default = DateTime(1983,01,09,09,0,0), "Check if the DOB displays '01/09/1983 09:00 AM'."); | ||
|
||
|
||
# # Form control test cases | ||
|
||
# - testCaseName: Navigate to New Employee Form Control | ||
# testCaseDescription: Verify that the Form Navigate to the new Employee form. | ||
# testSteps: | | ||
# Select(btnNew); | ||
|
||
# - testCaseName: Test Employee_Name_DataCard2 - Default Value | ||
# testCaseDescription: Verify that the Employee Name field displays the default value correctly. | ||
# testSteps: | | ||
# SetProperty(Employee_Name_DataCard2.Default, "David Benjamin12"); | ||
# Assert(Employee_Name_DataCard2.Default = "David Benjamin12", "Check if the Employee Name displays 'James Clear'."); | ||
|
||
# - testCaseName: Test Gender_DataCard2 - Default Value | ||
# testCaseDescription: Verify that updating the Gender field reflects correctly. | ||
# testSteps: | | ||
# SetProperty(Gender_DataCard2.Default, {Id:681470001,Value:"Female"}); | ||
# Assert(CountRows('DataCardValue7'.SelectedItems) = 1, "Check if only one item is selected in Gender Field."); | ||
|
||
# - testCaseName: Test DOB_DataCard3 - DateTime Value | ||
# testCaseDescription: Verify that setting DateTime in the DOB field reflects correctly. | ||
# testSteps: | | ||
# SetProperty(DOB_DataCard3.Default, DateTime(1975,01,01,05,0,0)); | ||
# Assert(DOB_DataCard3.Default = DateTime(1975,01,01,05,0,0), "Check if the DOB displays '01/01/1975 05:00 AM'."); | ||
|
||
# - testCaseName: Test Department_DataCard2 - Default Value | ||
# testCaseDescription: Verify that the Department field displays the default value correctly. | ||
# testSteps: | | ||
# SetProperty(Department_DataCard2.Default, {Id:681470003,Value:"Sales"}); | ||
# Assert(CountRows('DataCardValue8'.SelectedItems) = 1, "Check if only one item is selected in Department Field."); | ||
|
||
# - testCaseName: Test Address_DataCard3 - Default Value | ||
# testCaseDescription: Verify that the Address field displays the default value correctly. | ||
# testSteps: | | ||
# SetProperty(Address_DataCard3.Default, "100 North Cross Street"); | ||
# Assert(Address_DataCard3.Default = "100 North Cross Street", "Check if the Address displays '152 South Cross Street'."); | ||
|
||
# - testCaseName: Test Email_DataCard2 - Default Value | ||
# testCaseDescription: Verify that the Email field displays the default value correctly. | ||
# testSteps: | | ||
# SetProperty(Email_DataCard2.Default, "DavidBenjamin@abc.com"); | ||
# Assert(Email_DataCard2.Default = "DavidBenjamin@abc.com", "Check if the Email displays 'DavidBenjamin@abc.com'."); | ||
|
||
# - testCaseName: Test Phone_Number_DataCard2 - Default Value | ||
# testCaseDescription: Verify that the Phone Number field displays the default value correctly. | ||
# testSteps: | | ||
# SetProperty(Phone_Number_DataCard2.Default, "1112223344"); | ||
# Assert(Phone_Number_DataCard2.Default = "1112223344", "Check if the Phone Number displays '1112223344'."); | ||
|
||
# - testCaseName: Test Save Functionality of the New Employee Form Control | ||
# testCaseDescription: Verify that the Employee data in the form saved correctly. | ||
# testSteps: | | ||
# Select(btnSubmit); | ||
# Assert(CountRows(Table1.Items) = 14, "Checking if Table displays correct number of items"); | ||
|
||
# - testCaseName: Test Reset Functionality of the New Employee Form Control | ||
# testCaseDescription: Verify that the Employee data in the form is reset to default value. | ||
# testSteps: | | ||
# SetProperty(Employee_Name_DataCard2.Default, "John Benjamin"); | ||
# SetProperty(Gender_DataCard2.Default, {Id:681470001,Value:"Female"}); | ||
# SetProperty(DOB_DataCard3.Default, DateTime(1975,01,01,05,0,0)); | ||
# SetProperty(Department_DataCard2.Default, {Id:681470003,Value:"Sales"}); | ||
# SetProperty(Address_DataCard3.Default, "152 South Cross Street"); | ||
# SetProperty(Email_DataCard2.Default, "JohnBenjamin@abc.com"); | ||
# SetProperty(Phone_Number_DataCard2.Default, "1112223344"); | ||
# Select(btnReset); | ||
# Wait(Employee_Name_DataCard2, "Default",""); | ||
# Assert(Employee_Name_DataCard2.Default = "", "Check if the Employee Name displays default value."); | ||
# Assert(DOB_DataCard3.Default = DateTime(1980,01,01,03,0,0), "Check if the DOB displays '01/01/1980 03:00 AM'."); | ||
# Assert(CountRows('DataCardValue8'.SelectedItems) = 1, "Check if only one item is selected in Department Field."); | ||
|
||
testSettings: | ||
headless: false | ||
locale: "en-US" | ||
recordVideo: true | ||
extensionModules: | ||
enable: true | ||
browserConfigurations: | ||
- browser: Chromium | ||
channel: msedge | ||
|
||
environmentVariables: | ||
users: | ||
- personaName: User1 | ||
emailKey: user1Email | ||
passwordKey: NotNeeded |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.