From 7e1753bfd983f13f53def027b51790c631d510d0 Mon Sep 17 00:00:00 2001 From: Malcolm Nixon Date: Thu, 23 Jul 2026 20:15:44 -0400 Subject: [PATCH] test: assert Query dialog actually closes; document automation-id coverage - QueryDialogMenuItem round-trip test now waits for AddTypeFilterButton to disappear after clicking QueryDialogCloseButton, confirming the dialog actually closes rather than just clicking the button. - Query dialog scenario added to docs/verification/ots/appium.md and traceability entry added to docs/reqstream/ots/appium.yaml. - docs/design/ots/appium.md's AutomationProperties.AutomationId feature list now mentions the Query dialog's controls alongside the About dialog, Workspace panel, and Predefined Views panel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/design/ots/appium.md | 5 ++- docs/reqstream/ots/appium.yaml | 1 + docs/verification/ots/appium.md | 19 ++++++-- .../MainWindowShellIntegrationTests.cs | 44 ++++++++++++++++++- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/docs/design/ots/appium.md b/docs/design/ots/appium.md index c2aa892..7155264 100644 --- a/docs/design/ots/appium.md +++ b/docs/design/ots/appium.md @@ -30,8 +30,9 @@ drive the same application on all three desktop platforms through a common otherwise-inaccessible base constructor. - **`AutomationProperties.AutomationId`** — added to `MainWindowView.axaml`'s menu items and dock control, and to the interactive controls of the About - dialog, Workspace panel, and Predefined Views panel, giving - `MobileBy.AccessibilityId` lookups a stable, Appium-reliable target + dialog, Query dialog (shared `ElementFilterView`'s type-filter controls plus + the dialog's own close button), Workspace panel, and Predefined Views panel, + giving `MobileBy.AccessibilityId` lookups a stable, Appium-reliable target independent of `Name`/`x:Name`. - **`MobileBy.Name`/`MobileBy.AccessibilityId`** — locate top-level menus and automation-id-tagged controls in the real accessibility tree. diff --git a/docs/reqstream/ots/appium.yaml b/docs/reqstream/ots/appium.yaml index 6855e13..1b5a999 100644 --- a/docs/reqstream/ots/appium.yaml +++ b/docs/reqstream/ots/appium.yaml @@ -26,5 +26,6 @@ sections: - 'DesktopApp_ViewMenu_DiagnosticsMenuItem_IsDiscoverableAndEnabled' - 'DesktopApp_ViewMenu_ViewBuilderDialogMenuItem_IsDiscoverableAndEnabled' - 'DesktopApp_QueryMenu_QueryDialogMenuItem_IsDiscoverableAndEnabled' + - 'DesktopApp_QueryMenu_QueryDialogMenuItem_OpensAndClosesQueryDialog' - 'DesktopApp_HelpMenu_AboutMenuItem_OpensAndClosesAboutDialog' - 'DesktopApp_FileMenu_CloseAllMenuItem_IsDiscoverableAndEnabled' diff --git a/docs/verification/ots/appium.md b/docs/verification/ots/appium.md index 3f3e4a6..da0b4e5 100644 --- a/docs/verification/ots/appium.md +++ b/docs/verification/ots/appium.md @@ -54,9 +54,14 @@ one child menu item by automation id, asserting it is both displayed and enabled, then closes the menu via Escape without clicking the item. These extend automation-id coverage breadth-first across every subsystem's top-level entry point (workspace panel, predefined views, diagnostics, -custom view builder, query dialog, close-all) without needing to click -through to a dialog or native OS surface that this tier cannot yet reliably -tear down. +custom view builder, query dialog, close-all). The View menu's toggle items +and the Query dialog now also have dedicated click-through round-trip +tests (see below); the others are not yet clicked because they open a +dialog whose controls don't carry automation ids yet +(`ViewBuilderDialogMenuItem`) or a native OS surface outside Avalonia's own +accessibility tree (`AddFileSourceMenuItem`/`AddFolderSourceMenuItem`), or +because a menu item click here would leave the shared `AppFixture` session +in a different state for whichever test runs next (`CloseAllMenuItem`). **DesktopApp_HelpMenu_AboutMenuItem_OpensAndClosesAboutDialog**: Opens the Help menu, clicks "About" (`AboutMenuItem`), confirms the modal About @@ -64,6 +69,14 @@ dialog's `AboutDialogOkButton` becomes visible, then dismisses it - proving a full menu-click-to-modal-dialog round trip works end-to-end through the real windowed application. +**DesktopApp_QueryMenu_QueryDialogMenuItem_OpensAndClosesQueryDialog**: The +same open/click/assert/close round-trip shape as the About dialog test +above, applied to the Query dialog - opens the Query menu, clicks "Run +Query..." (`QueryDialogMenuItem`), confirms the dialog's own +`AddTypeFilterButton` (part of the shared `ElementFilterView`) becomes +visible, then dismisses it via `QueryDialogCloseButton`, reusing the same +close button already exercised by the inspection-screenshot tests below. + **DesktopApp_ViewMenu_WorkspacePanelMenuItem_TogglesWorkspacePanel**, **DesktopApp_ViewMenu_PredefinedViewsMenuItem_TogglesPredefinedViewsPanel**, and **DesktopApp_ViewMenu_DiagnosticsMenuItem_TogglesDiagnosticsPanel**: Unlike the diff --git a/test/DemaConsulting.SysML2Workbench.IntegrationTests/MainWindowShellIntegrationTests.cs b/test/DemaConsulting.SysML2Workbench.IntegrationTests/MainWindowShellIntegrationTests.cs index 174b9a9..3e16b19 100644 --- a/test/DemaConsulting.SysML2Workbench.IntegrationTests/MainWindowShellIntegrationTests.cs +++ b/test/DemaConsulting.SysML2Workbench.IntegrationTests/MainWindowShellIntegrationTests.cs @@ -229,8 +229,9 @@ public void DesktopApp_ViewMenu_ViewBuilderDialogMenuItem_IsDiscoverableAndEnabl /// /// Validates that the Query menu's "Run Query..." item, found by the QueryDialogMenuItem - /// automation id, is discoverable and enabled. Not clicked, for the same reason as - /// . + /// automation id, is discoverable and enabled. Not clicked here (see + /// for the full + /// open/close round trip through the real dialog). /// [Fact] public void DesktopApp_QueryMenu_QueryDialogMenuItem_IsDiscoverableAndEnabled() @@ -238,6 +239,45 @@ public void DesktopApp_QueryMenu_QueryDialogMenuItem_IsDiscoverableAndEnabled() AssertMenuItemIsDiscoverableAndEnabled("Query", "QueryDialogMenuItem"); } + /// + /// Validates that clicking the Query menu's "Run Query..." item, found by the + /// QueryDialogMenuItem automation id, opens the modal Query dialog, discoverable by its own + /// AddTypeFilterButton automation id (part of the shared ElementFilterView), and that + /// dismissing it via its QueryDialogCloseButton actually closes the dialog again (confirmed by + /// waiting for AddTypeFilterButton to disappear from the accessibility tree) - the same + /// open/click/assert/close round-trip shape as + /// , using the close button + /// already exercised by . + /// + [Fact] + public void DesktopApp_QueryMenu_QueryDialogMenuItem_OpensAndClosesQueryDialog() + { + // Arrange + var queryMenu = _session.FindElement(MobileBy.Name("Query")); + queryMenu.Click(); + var queryDialogMenuItem = _session.FindElement(MobileBy.AccessibilityId("QueryDialogMenuItem")); + queryDialogMenuItem.Click(); + + try + { + // Act + var addTypeFilterButton = _session.FindElement(MobileBy.AccessibilityId("AddTypeFilterButton")); + + // Assert + Assert.True(addTypeFilterButton.Displayed); + + _session.FindElement(MobileBy.AccessibilityId("QueryDialogCloseButton")).Click(); + + var closed = WaitUntil(() => _session.FindElements(MobileBy.AccessibilityId("AddTypeFilterButton")).Count == 0); + Assert.True(closed, "The Query dialog's 'AddTypeFilterButton' was still present after closing it via 'QueryDialogCloseButton'."); + } + catch + { + TryCloseAnyOpenDialogWithEscape(); + throw; + } + } + /// /// Opens the named top-level menu, locates the child item by automation id, asserts it is displayed and /// enabled, then closes the menu via Escape without clicking the item itself - proving the item is