Skip to content

chore(test): Android test-stack-toolbar-nested-menu-android coverage - #4448

Merged
LKuchno merged 8 commits into
mainfrom
@lkuchno/e2e-test-stack-toolbar-nested-menu-android
Aug 10, 2026
Merged

chore(test): Android test-stack-toolbar-nested-menu-android coverage#4448
LKuchno merged 8 commits into
mainfrom
@lkuchno/e2e-test-stack-toolbar-nested-menu-android

Conversation

@LKuchno

@LKuchno LKuchno commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1715

Adds full Detox e2e coverage for the test-stack-toolbar-nested-menu-android
scenario — Android toolbar menus with nested submenus. The scenario screen
already existed with e2eCoverage: 'tbd'; this PR implements the automation
for every step and flips the coverage to full.

The new spec exercises the four things the scenario describes:

  • submenu structure and header resolution (menuTitle, with a fallback to
    title) at every nesting level, including a doubly nested submenu,
  • click handling for items at every nesting level,
  • imperative commands targeting leaf items, submenu containers, and items two
    levels down (title, hidden, menuTitle),
  • props-update rebuild semantics — a single prop change drops all
    command-applied state and rebuilds the tree.

Two scenario steps (19 and 27) leave a submenu entry with no text for Detox to
match, so they are reached by row position within the overflow menu instead;
the absence of a submenu header is asserted indirectly, since a header would
otherwise show up as an extra match for the text it renders.

Changes

  • Added FabricExample/e2e/single-feature-tests/stack-v5/test-stack-toolbar-nested-menu-android.e2e.ts
    (37 test cases across 9 describe blocks).
  • e2e-utils.ts:
    • getMatches/countMatches accept an orEmpty option so an expected
      absence resolves to []/0 instead of throwing. It is opt-in precisely
      because it also swallows a crashed app or a dropped Detox connection.
    • Extracted waitUntil(predicate, { timeout, interval, message }) for
      conditions Detox's waitFor cannot express. On Android waitFor is one
      native call retrying inside the app, so it asserts one property of one view
      and the matcher needs a literal atIndex — which rules out waiting on a
      match count, or on the last match while the count is still settling. Both
      come up here; the full rationale is in the function's JSDoc. message
      accepts a builder function so the timeout error can report what the last
      poll observed.
    • Documented that tapTopmost needs a freshly built matcher — Detox's
      atIndex rewrites the matcher in place on Android.
  • native-class-names.ts: added ListMenuItemView (a popup menu row, the
    anchor for addressing widgets by item title) and AppCompatImageView
    (group_divider / submenuarrow).
  • test-stack-simple-nav.e2e.ts: rewrote its two local polling helpers on top
    of the shared waitUntil. No behavior change.
  • Test screen: added testIDs to the pickers, switches, send-command button
    and result text, and exported the option types the e2e spec reuses.
  • scenario.md: documented the e2e coverage and the phone-form-factor
    prerequisite — from 720dp smallest-width up, AppCompat opens submenus as
    cascading popups next to their parent rather than replacing it, which the
    test does not account for.

@LKuchno LKuchno added platform:android Issue related to Android part of the library type:chore A general maintenance task, that does not fall into other categories. type:e2e Actions related to e2e maintenance and development, especially automation. area:stack-v5 Issues related to Native Stack v5 implementation labels Aug 4, 2026
@LKuchno
LKuchno requested a review from Copilot August 4, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds comprehensive Android-only Detox e2e coverage for the existing “stack toolbar nested menu” scenario in the example app, including nested submenu navigation, command-driven mutations, and props-driven rebuild semantics.

Changes:

  • Added a new Android e2e spec that exercises nested overflow-menu/submenu behavior, click handling, imperative commands, and props-update rebuild resets.
  • Extended shared e2e utilities with waitUntil(...) polling and an opt-in orEmpty mode for getMatches/countMatches.
  • Updated the scenario screen and docs to support stable e2e targeting (testIDs + exported option types) and to document device/form-factor constraints.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
FabricExample/e2e/single-feature-tests/stack-v5/test-stack-toolbar-nested-menu-android.e2e.ts New Android Detox spec covering nested toolbar overflow menu/submenus, commands, and props rebuild behavior.
FabricExample/e2e/single-feature-tests/stack-v5/test-stack-simple-nav.e2e.ts Refactors local polling helpers to reuse shared waitUntil (no intended behavior change).
FabricExample/e2e/native-class-names.ts Adds Android class-name constants needed to match popup menu rows and submenu arrows.
FabricExample/e2e/e2e-utils.ts Adds waitUntil and extends getMatches/countMatches with optional orEmpty behavior.
apps/src/tests/single-feature-tests/stack-v5/test-stack-toolbar-nested-menu-android/scenario.md Updates scenario docs to reflect full e2e coverage and the phone form-factor prerequisite.
apps/src/tests/single-feature-tests/stack-v5/test-stack-toolbar-nested-menu-android/scenario-description.ts Flips e2eCoverage from tbd to full.
apps/src/tests/single-feature-tests/stack-v5/test-stack-toolbar-nested-menu-android/index.tsx Adds testIDs for e2e automation and exports option/id types reused by the new spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LKuchno LKuchno changed the title test(e2e): Android stack toolbar nested menu coverage chore(test): Android test-stack-toolbar-nested-menu-android coverage Aug 4, 2026
@LKuchno
LKuchno marked this pull request as ready for review August 5, 2026 07:38
@LKuchno
LKuchno requested a review from t0maboro August 10, 2026 09:15
@LKuchno
LKuchno merged commit 4174a5a into main Aug 10, 2026
6 checks passed
@LKuchno
LKuchno deleted the @lkuchno/e2e-test-stack-toolbar-nested-menu-android branch August 10, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:stack-v5 Issues related to Native Stack v5 implementation platform:android Issue related to Android part of the library type:chore A general maintenance task, that does not fall into other categories. type:e2e Actions related to e2e maintenance and development, especially automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants