下表概述了 Power Apps 测试引擎中提供的各种模块及其专用功能。
| 功能 | Description | 模块链接 |
|---|---|---|
ConsentDialogFunction |
检查模型驱动应用的自定义页面以获取同意对话框,并在测试执行期间自动处理它们。 | testengine.module.mda |
PauseFunction |
暂停当前测试,并允许用户在无外设模式为 false 时与浏览器交互并检查状态。 可用于调试测试。 | testengine.module.pause |
PlaywrightActionFunction |
为当前页执行 Playwright作,允许使用 CSS 和 XPath 选择器直接作 DOM 元素。 | testengine.module.playwrightaction |
PlaywrightActionValueFunction |
执行需要额外值参数的 Playwright作,例如填写表单字段或选择下拉列表选项。 | testengine.module.playwrightaction |
PlaywrightScriptFunction |
启用与 Playwright API 交互的自定义 C# 脚本的执行,为复杂的自动化方案提供最大的灵活性。 | testengine.module.playwrightscript |
CheckConnectionExistsFunction |
使用 Power Apps 门户提供程序检查 Power Platform 中是否存在特定连接。 | testengine.module.powerapps.portal |
CreateConnectionFunction |
在测试执行期间创建 Power Platform 连接。 注意:此方法应被视为备份,因为最好尽可能使用服务主体创建连接。 | testengine.module.powerapps.portal |
ExportConnectionsFunction |
将连接信息导出到 JSON 文件以供文档或重复使用。 与 PowerApps 门户提供程序兼容。 | testengine.module.powerapps.portal |
GetConnectionsFunction |
从 Power Platform 查询和检索可用的连接信息。 与 PowerApps 门户提供程序兼容。 | testengine.module.powerapps.portal |
UpdateConnectionReferencesFunction |
更新 Power Platform 连接引用。 应用作备份方法,因为理想情况下应由服务主体管理连接。 | testengine.module.powerapps.portal |
SampleFunction |
一个简单的示例函数,演示如何实现基本的 ReflectionFunction。 用作新函数开发的起始模板。 | testengine.module.sample |
SimulateConnectorFunction |
启用连接器响应模拟,允许测试在没有实际外部服务依赖项的情况下运行。 | testengine.module.simulation |
SimulateDataverseFunction |
提供模拟 Dataverse 响应的功能,无需实际 Dataverse 依赖项即可启用测试。 | testengine.module.simulation |
VisualCompareFunction |
使用 OpenCV 在屏幕截图之间执行视觉比较,从而启用基于图像的 UI 元素验证。 | testengine.module.visualcompare |
如何使用这些函数
启用相应的模块时,可通过 Power Fx Preview 命名空间使用这些函数。 若要在测试设置中启用模块,请将以下内容添加到 YAML 配置:
testSettings:
extensionModules:
enable: true
allowPowerFxNamespaces:
- Preview
例如,若要在测试中使用 PlaywrightAction 函数:
Preview.PlaywrightAction("//button[@id='submit']", "click")
贡献过程
若要为测试引擎开发更多模块和函数,请参阅 功能生命周期 文档,了解有关从开放源代码贡献到正式版的功能进度的信息。