Skip to content

Commit a4632e1

Browse files
authored
[Feature]: Enable PowerApps MDA Column chart Control for Custom Pages (#591)
* [Feature]: Enable PowerApps MDA Column chart Control for Custom Pages * [Feature]: Enable PowerApps MDA Column chart Control for Custom Pages * provider change * used common example url * Removed city names from testcases
1 parent ebb247c commit a4632e1

8 files changed

Lines changed: 368 additions & 0 deletions
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
testSuite:
2+
testSuiteName: Column Chart Controls
3+
testSuiteDescription: Verifies that the column chart controls work correctly.
4+
persona: User1
5+
appLogicalName: column_chart_controls_app
6+
7+
testCases:
8+
- testCaseName: Verify Items Property
9+
testCaseDescription: Check if the column chart correctly sets and displays the items.
10+
testSteps: |
11+
SetProperty(ColumnChart1.Items, Table(
12+
{Labels: "Category A", Series1: 31, Series2: 39, Series3: 12, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
13+
{Labels: "Category B", Series1: 15, Series2: 78, Series3: 18, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
14+
{Labels: "Category C", Series1: 11, Series2: 60, Series3: 8, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
15+
{Labels: "Category D", Series1: 22, Series2: 65, Series3: 14, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
16+
{Labels: "Category E", Series1: 20, Series2: 50, Series3: 10, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
17+
{Labels: "Category F", Series1: 25, Series2: 55, Series3: 15, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0}
18+
));
19+
Assert(CountRows(ColumnChart1.Items) = 6, "Verify the chart contains 6 data points");
20+
21+
- testCaseName: Verify Chart Width
22+
testCaseDescription: Ensure that the column chart width is set correctly.
23+
testSteps: |
24+
SetProperty(ColumnChart1.Width, 620);
25+
Assert(ColumnChart1.Width = 620, "Verify chart width is set correctly");
26+
27+
- testCaseName: Verify Chart Height
28+
testCaseDescription: Ensure that the column chart height is set correctly.
29+
testSteps: |
30+
SetProperty(ColumnChart1.Height, 400);
31+
Assert(ColumnChart1.Height = 400, "Verify chart height is set correctly");
32+
33+
- testCaseName: Verify Chart X Position
34+
testCaseDescription: Ensure that the column chart X position is set correctly.
35+
testSteps: |
36+
SetProperty(ColumnChart1.X, 180);
37+
Assert(ColumnChart1.X = 180, "Verify chart X position is set correctly");
38+
39+
- testCaseName: Verify Chart Y Position
40+
testCaseDescription: Ensure that the column chart Y position is set correctly.
41+
testSteps: |
42+
SetProperty(ColumnChart1.Y, 65);
43+
Assert(ColumnChart1.Y = 65, "Verify chart Y position is set correctly");
44+
45+
- testCaseName: Verify Number of Series
46+
testCaseDescription: Ensure that the column chart number of series is set correctly.
47+
testSteps: |
48+
SetProperty(ColumnChart1.NumberOfSeries, 3);
49+
Assert(ColumnChart1.NumberOfSeries = 3, "Verify number of series is set correctly");
50+
51+
- testCaseName: Verify Grid Style
52+
testCaseDescription: Ensure that the column chart grid style is set correctly.
53+
testSteps: |
54+
SetProperty(ColumnChart1.GridStyle, "Both");
55+
Assert(ColumnChart1.GridStyle = "Both", "Verify grid style is set correctly");
56+
57+
- testCaseName: Verify Column Chart Markers
58+
testCaseDescription: Ensure that the column chart markers are shown correctly for all data points when markers are enabled.
59+
testSteps: |
60+
SetProperty(ColumnChart1.Markers, true);
61+
Assert(ColumnChart1.Markers, "Verify markers are shown correctly");
62+
63+
- testCaseName: Verify OnSelect Action
64+
testCaseDescription: Ensure that the OnSelect action is triggered correctly.
65+
testSteps: |
66+
Select(ColumnChart1);
67+
Assert(Label1.Text = "Chart Clicked!", "Verify OnSelect action is triggered correctly");
68+
69+
- testCaseName: Verify Visibility
70+
testCaseDescription: Ensure that the chart visibility can be toggled.
71+
testSteps: |
72+
SetProperty(ColumnChart1.Visible, false);
73+
Assert(ColumnChart1.Visible = false, "Verify chart is hidden");
74+
SetProperty(ColumnChart1.Visible, true);
75+
Assert(ColumnChart1.Visible = true, "Verify chart is visible");
76+
77+
testSettings:
78+
headless: false
79+
locale: "en-US"
80+
recordVideo: true
81+
extensionModules:
82+
enable: true
83+
browserConfigurations:
84+
- browser: Chromium
85+
channel: msedge
86+
87+
environmentVariables:
88+
users:
89+
- personaName: User1
90+
emailKey: user1Email
91+
passwordKey: NotNeeded
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
testSuite:
2+
testSuiteName: Line Chart Controls
3+
testSuiteDescription: Verifies that the line chart controls work correctly.
4+
persona: User1
5+
appLogicalName: line_chart_controls_app
6+
7+
testCases:
8+
- testCaseName: Verify Items Property
9+
testCaseDescription: Check if the line chart correctly sets and displays the items.
10+
testSteps: |
11+
SetProperty(LineChart1.Items, Table(
12+
{Labels: "Category A", Series1: 31, Series2: 39, Series3: 12, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
13+
{Labels: "Category B", Series1: 15, Series2: 78, Series3: 18, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
14+
{Labels: "Category C", Series1: 11, Series2: 60, Series3: 8, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0},
15+
{Labels: "Category D", Series1: 22, Series2: 65, Series3: 14, Series4: 0, Series5: 0, Series6: 0, Series7: 0, Series8: 0, Series9: 0}
16+
));
17+
Assert(CountRows(LineChart1.Items) = 4, "Verify the chart contains 4 data points");
18+
19+
- testCaseName: Verify Chart Width
20+
testCaseDescription: Ensure that the line chart width is set correctly.
21+
testSteps: |
22+
SetProperty(LineChart1.Width, 620);
23+
Assert(LineChart1.Width = 620, "Verify chart width is set correctly");
24+
25+
- testCaseName: Verify Chart Height
26+
testCaseDescription: Ensure that the line chart height is set correctly.
27+
testSteps: |
28+
SetProperty(LineChart1.Height, 400);
29+
Assert(LineChart1.Height = 400, "Verify chart height is set correctly");
30+
31+
- testCaseName: Verify Chart X Position
32+
testCaseDescription: Ensure that the line chart X position is set correctly.
33+
testSteps: |
34+
SetProperty(LineChart1.X, 180);
35+
Assert(LineChart1.X = 180, "Verify chart X position is set correctly");
36+
37+
- testCaseName: Verify Chart Y Position
38+
testCaseDescription: Ensure that the line chart Y position is set correctly.
39+
testSteps: |
40+
SetProperty(LineChart1.Y, 65);
41+
Assert(LineChart1.Y = 65, "Verify chart Y position is set correctly");
42+
43+
- testCaseName: Verify Number of Series
44+
testCaseDescription: Ensure that the line chart number of series is set correctly.
45+
testSteps: |
46+
SetProperty(LineChart1.NumberOfSeries, 3);
47+
Assert(LineChart1.NumberOfSeries = 3, "Verify number of series is set correctly");
48+
49+
- testCaseName: Verify Grid Style
50+
testCaseDescription: Ensure that the line chart grid style is set correctly.
51+
testSteps: |
52+
SetProperty(LineChart1.GridStyle, "Both");
53+
Assert(LineChart1.GridStyle = "Both", "Verify grid style is set correctly");
54+
55+
- testCaseName: Verify Line Chart Markers
56+
testCaseDescription: Ensure that the line chart markers are shown correctly for all data points when markers are enabled.
57+
testSteps: |
58+
SetProperty(LineChart1.Markers, true);
59+
Assert(LineChart1.Markers, "Verify markers are shown correctly");
60+
61+
testSettings:
62+
headless: false
63+
locale: "en-US"
64+
recordVideo: true
65+
extensionModules:
66+
enable: true
67+
browserConfigurations:
68+
- browser: Chromium
69+
channel: msedge
70+
71+
environmentVariables:
72+
users:
73+
- personaName: User1
74+
emailKey: user1Email
75+
passwordKey: NotNeeded
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
testSuite:
2+
testSuiteName: Pie Chart Controls
3+
testSuiteDescription: Verifies that the pie chart controls work correctly.
4+
persona: User1
5+
appLogicalName: pie_chart_controls_app
6+
7+
testCases:
8+
- testCaseName: Verify Items Property
9+
testCaseDescription: Check if the pie chart correctly sets and displays the items.
10+
testSteps: |
11+
SetProperty(PieChart1.Items, Table(
12+
{Labels: "Category A", Series: 31},
13+
{Labels: "Category B", Series: 15},
14+
{Labels: "Category C", Series: 11},
15+
{Labels: "Category D", Series: 22}
16+
));
17+
Assert(CountRows(PieChart1.Items) = 4, "Verify the chart contains 4 data points");
18+
19+
- testCaseName: Verify Chart Width
20+
testCaseDescription: Ensure that the pie chart width is set correctly.
21+
testSteps: |
22+
SetProperty(PieChart1.Width, 620);
23+
Assert(PieChart1.Width = 620, "Verify chart width is set correctly");
24+
25+
- testCaseName: Verify Chart Height
26+
testCaseDescription: Ensure that the pie chart height is set correctly.
27+
testSteps: |
28+
SetProperty(PieChart1.Height, 400);
29+
Assert(PieChart1.Height = 400, "Verify chart height is set correctly");
30+
31+
- testCaseName: Verify Chart X Position
32+
testCaseDescription: Ensure that the pie chart X position is set correctly.
33+
testSteps: |
34+
SetProperty(PieChart1.X, 180);
35+
Assert(PieChart1.X = 180, "Verify chart X position is set correctly");
36+
37+
- testCaseName: Verify Chart Y Position
38+
testCaseDescription: Ensure that the pie chart Y position is set correctly.
39+
testSteps: |
40+
SetProperty(PieChart1.Y, 65);
41+
Assert(PieChart1.Y = 65, "Verify chart Y position is set correctly");
42+
testSettings:
43+
headless: false
44+
locale: "en-US"
45+
recordVideo: true
46+
extensionModules:
47+
enable: true
48+
browserConfigurations:
49+
- browser: Chromium
50+
channel: msedge
51+
52+
environmentVariables:
53+
users:
54+
- personaName: User1
55+
emailKey: user1Email
56+
passwordKey: NotNeeded
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
testSuite:
2+
testSuiteName: MDA Input Controls
3+
testSuiteDescription: Verifies that the classic input controls work correctly.
4+
persona: User1
5+
appLogicalName: mda_input_controls_app
6+
7+
testCases:
8+
- testCaseName: Verify Tile URL
9+
testCaseDescription: Verify that the TileUrl property can be set and retrieved correctly.
10+
testSteps: |
11+
SetProperty(PowerBI1.TileUrl, "https://www.example.com");
12+
Assert(PowerBI1.TileUrl = "https://www.example.com", "Checking the TileUrl property");
13+
14+
- testCaseName: Verify Dashboard ID
15+
testCaseDescription: Verify that the DashboardId property can be set and retrieved correctly.
16+
testSteps: |
17+
SetProperty(PowerBI1.DashboardId, "5038859c-c804-4c50-a776-25994fa7ae65");
18+
Assert(PowerBI1.DashboardId = "5038859c-c804-4c50-a776-25994fa7ae65", "Checking the DashboardId property");
19+
20+
- testCaseName: Verify Workspace ID
21+
testCaseDescription: Verify that the WorkspaceId property can be set and retrieved correctly.
22+
testSteps: |
23+
SetProperty(PowerBI1.WorkspaceId, "12345678-abcd-1234-efgh-567890abcdef");
24+
Assert(PowerBI1.WorkspaceId = "12345678-abcd-1234-efgh-567890abcdef", "Checking the WorkspaceId property");
25+
26+
- testCaseName: Verify Power BI Interactions
27+
testCaseDescription: Verify that the PowerBIInteractions property can be enabled.
28+
testSteps: |
29+
SetProperty(PowerBI1.PowerBIInteractions, true);
30+
Assert(PowerBI1.PowerBIInteractions = true, "Checking the PowerBIInteractions property");
31+
32+
- testCaseName: Verify Visibility of Power BI Control
33+
testCaseDescription: Verify that the Visible property can be set and retrieved correctly.
34+
testSteps: |
35+
SetProperty(PowerBI1.Visible, true);
36+
Assert(PowerBI1.Visible = true, "Checking the Visible property");
37+
38+
- testCaseName: Verify Display Mode
39+
testCaseDescription: Verify that the DisplayMode property can be set and retrieved correctly.
40+
testSteps: |
41+
SetProperty(PowerBI1.DisplayMode, "View");
42+
Assert(PowerBI1.DisplayMode = "View", "Checking the DisplayMode property");
43+
44+
- testCaseName: Verify Border Properties
45+
testCaseDescription: Verify that the border properties can be set and retrieved correctly.
46+
testSteps: |
47+
SetProperty(PowerBI1.BorderStyle, "Dashed");
48+
49+
- testCaseName: Verify Dimensions
50+
testCaseDescription: Verify that the Width and Height properties can be set and retrieved correctly.
51+
testSteps: |
52+
SetProperty(PowerBI1.Width, 500);
53+
SetProperty(PowerBI1.Height, 300);
54+
Assert(PowerBI1.Width = 500, "Checking the Width property");
55+
Assert(PowerBI1.Height = 300, "Checking the Height property");
56+
57+
- testCaseName: Verify Z-Index
58+
testCaseDescription: Verify that the ZIndex property can be set and retrieved correctly.
59+
testSteps: |
60+
SetProperty(PowerBI1.ZIndex, 10);
61+
Assert(PowerBI1.ZIndex = 10, "Checking the ZIndex property");
62+
63+
64+
testSettings:
65+
headless: false
66+
locale: "en-US"
67+
recordVideo: true
68+
extensionModules:
69+
enable: true
70+
browserConfigurations:
71+
- browser: Chromium
72+
channel: msedge
73+
74+
environmentVariables:
75+
users:
76+
- personaName: User1
77+
emailKey: user1Email
78+
passwordKey: NotNeeded
127 KB
Binary file not shown.

samples/mdacharts/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Overview
2+
3+
This Power Apps Test Engine sample demonstrates how to assert and interact with the values of chart controls in a model-driven application form.
4+
5+
## Usage
6+
7+
1. **Build the Test Engine Solution**
8+
Ensure the Power Apps Test Engine solution is built and ready to be executed.
9+
10+
2. **Get the URL of the Model-Driven Application Form**
11+
Acquire the URL of the specific Model-Driven Application form that you want to test.
12+
13+
3. **Modify the charts_testPlan.fx.yaml**
14+
Update the YAML file to assert expected values of the chart controls.
15+
16+
> [!NOTE] The controls are referenced using the logical name.
17+
18+
4. **Update the Domain URL for Your Model-Driven Application**
19+
20+
| URL Part | Description |
21+
|----------|-------------|
22+
| `appid=a1234567-cccc-44444-9999-a123456789123` | The unique identifier of your model-driven application. |
23+
| `etn=chart` | The name of the entity being validated. |
24+
| `id=26bafa27-ca7d-ee11-8179-0022482a91f4` | The unique identifier of the record being edited. |
25+
| `pagetype=custom` | The type of page to open. |
26+
27+
5. **Execute the Test for Custom Page**
28+
Change the example below to the URL of your organization:
29+
30+
```pwsh
31+
cd bin\Debug\PowerAppsEngine
32+
dotnet PowerAppsTestEngine.dll -i ..\..\..\samples\mdacharts\MDACloumChartControl_testPlan.fx.yaml -e 00000000-0000-0000-0000-11112223333 -t 11112222-3333-4444-5555-666677778888 -u storagestate --provider mda -d "https://contoso.crm4.dynamics.com/main.aspx?appid=9e9c25f3-1851-ef11-bfe2-6045bd8f802c&pagetype=custom&name=cr7d6_displaycontrols_7009b"
33+
```

samples/mdacharts/RunTests.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Get current directory so we can reset back to it after running the tests
5+
$currentDirectory = Get-Location
6+
7+
$config = Get-Content -Path .\config.json -Raw | ConvertFrom-Json
8+
$tenantId = $config.tenantId
9+
$environmentId = $config.environmentId
10+
$user1Email = $config.user1Email
11+
12+
if ([string]::IsNullOrEmpty($environmentId)) {
13+
Write-Error "Environment not configured. Please update config.json"
14+
return
15+
}
16+
17+
# Build the latest debug version of Test Engine from source
18+
Set-Location ..\..\src
19+
dotnet build
20+
21+
if ($config.installPlaywright) {
22+
Start-Process -FilePath "pwsh" -ArgumentList "-Command `"..\bin\Debug\PowerAppsTestEngine\playwright.ps1 install`"" -Wait
23+
} else {
24+
Write-Host "Skipped playwright install"
25+
}
26+
27+
Set-Location ..\bin\Debug\PowerAppsTestEngine
28+
$env:user1Email = $user1Email
29+
# Run the tests for each user in the configuration file.
30+
dotnet PowerAppsTestEngine.dll -u "storagestate" --provider "mda" -a "none" -i "$currentDirectory\testPlan.fx.yaml" -t $tenantId -e $environmentId
31+
32+
# Reset the location back to the original directory.
33+
Set-Location $currentDirectory

src/testengine.provider.mda/ModelDrivenApplicationProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ public string CheckTestEngineObject
213213
case "islogovisible":
214214
case "istitlevisible":
215215
case "checked":
216+
case "markers":
217+
case "powerbiinteractions":
216218
case "autoplay":
217219
case "showtitle":
218220
return (T)(object)("{PropertyValue: " + value.ToString().ToLower() + "}");

0 commit comments

Comments
 (0)