Skip to content

BottomSheet: tell the header buttons of two stacked sheets apart in UI tests #86

Done

Description

@romchornyi-pitcrew

Expected Behavior

When one BottomSheet is presented over another, a UI test can tell their header close buttons apart, and their back buttons.

Current Behavior

BottomSheet draws its header buttons with NavigationBarElement.back.button and NavigationBarElement.close.button, so both sheets' close buttons answer to navigationbar-close:

NavigationBarElement.close.button {

#85 adds NavigationBarElement.button(accessibilityIdentifier:action:), which lets a host name a bar button it draws itself. The sheet's header does not pass one, and BottomSheet takes no identifier of its own. A host can wrap a sheet's content in .accessibilityElement(children: .contain) with an identifier and query inside it, if the header is part of that element.

Possible Solution

  • An optional identifier for the header's back and close buttons on BottomSheet, passed to the new overload; nil keeps the fixed ones. Additive.
  • Or document scoping the query to a container per sheet, after checking that it reaches the header.

Steps to Reproduce

  1. Present a BottomSheet with its close button, and from it a second BottomSheet with its own.
  2. In XCUITest, query app.buttons["navigationbar-close"]: two elements match.

Context

Found in the review of #85 (#49).

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions