一键导入
uno-testing-assertions
Provides assertion and validation patterns for UI testing of Uno Platform applications with the Uno App MCP server tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Provides assertion and validation patterns for UI testing of Uno Platform applications with the Uno App MCP server tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create and use commands in MVUX for user interactions.
Create and use IFeed<T> for async data in MVUX.
Display async feed data with FeedView control.
Create and use IListFeed<T> for reactive collections in MVUX.
Create and use IListState<T> for mutable reactive collections in MVUX.
Use messaging to sync MVUX states with entity changes.
| name | uno-testing-assertions |
| description | Provides assertion and validation patterns for UI testing of Uno Platform applications with the Uno App MCP server tools. |
| when_to_use | Use this skill when you need to validate UI state, verify element properties, compare screenshots, or assert on data binding values during automated testing. Complements the ui-testing skill with validation-specific guidance. |
| compatibility | Requires the Uno App MCP server to be configured. Use alongside the ui-testing skill for complete test coverage. |
| metadata | {"author":"uno-platform","version":"1.3","category":"testing"} |
Prerequisite: This skill requires the Uno App MCP (the
uno_app_*tools), provided by the Uno tooling. It is a separate server from the documentation MCP used by other skills. Before proceeding, confirm theuno_app_*tools are available; if they are not, stop and tell the user to enable the Uno tooling rather than attempting to test without them.
This skill provides patterns for validating UI state and asserting test conditions when testing Uno Platform applications with the Uno App MCP tools.
Use uno_app_get_screenshot to capture visual state:
uno_app_get_screenshot(fileType: "png", quality: 100, path: "/path/to/screenshot.png")
Validation approaches:
Use uno_app_visualtree_snapshot to verify UI structure:
Assert element exists:
Assert element not visible:
includeHidden: falseAssert element visible:
includeHidden: falseFrom visual tree, check element properties:
| Property | What to Check |
|---|---|
IsEnabled | Element can be interacted with |
IsChecked | Checkbox/Toggle state |
Content | Button/Label text |
Text | TextBox/TextBlock content |
SelectedIndex | ComboBox/List selection |
Value | Slider/ProgressBar value |
Use uno_app_get_element_datacontext to validate bound data:
uno_app_get_element_datacontext(elementRef: "element_handle")
Verify:
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Search for expected page/view element
3. Verify page-specific elements exist
4. Optionally capture screenshot for visual confirmation
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Find button by name or AutomationId
3. Check IsEnabled property
4. Verify Content matches expected text
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Find TextBlock/TextBox element
3. Verify Text property matches expected value
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Find ListView/ItemsRepeater element
3. Count child items
4. Verify expected count
5. Check item content if needed
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Search for ContentDialog or Popup element
3. Verify dialog-specific content exists
4. Capture screenshot for visual confirmation
1. Enter invalid data in form
2. Attempt to submit
3. uno_app_visualtree_snapshot(justMyCode: true)
4. Look for validation error TextBlocks
5. Verify error messages match expected text
1. Trigger navigation action
2. uno_app_visualtree_snapshot(justMyCode: true)
3. Verify previous page elements are gone
4. Verify new page elements are present
uno_app_get_screenshot(
fileType: "png",
quality: 100,
path: "/tests/screenshots/test_case_name.png"
)
Pixel-perfect comparison:
Region comparison:
Semantic comparison:
When screenshots contain dynamic data:
1. Get element handle from visual tree
2. uno_app_get_element_datacontext(elementRef: "handle")
3. Parse returned XML
4. Assert property values match expected state
Assert user is logged in:
IsLoggedIn: trueUsername has valueAssert item count:
Assert computed state:
When UI updates asynchronously:
Loop (max N attempts):
1. Get visual tree snapshot
2. Check for expected condition
3. If condition met, break
4. Wait brief interval
5. Retry
Fail if condition not met after all attempts
Retry up to 10 times:
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Search for expected element
3. If found, return success
4. Wait 500ms
5. Retry
Fail with "Element not found" if all retries exhausted
Retry until no loading indicators:
1. uno_app_visualtree_snapshot(justMyCode: true)
2. Search for ProgressRing, ProgressBar, loading text
3. If none found, loading complete
4. Wait 500ms
5. Retry
On assertion failure:
| Failure | Likely Cause | Resolution |
|---|---|---|
| Element not found | Timing issue | Add retry/wait |
| Wrong property value | State not updated | Wait for async complete |
| Screenshot mismatch | Dynamic content | Use data seeding or masking |
| Stale handle | Tree changed | Refresh visual tree |
uno_app_get_runtime_info