Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scenarios/MockUI/src/MockUI/basic/navigation_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def show_menu(self, target_menu_id=None):
# refresh the UI
self.refresh_ui()

# If this was a start_intro_tour action, launch the tour overlay now
# If this was a start_intro_tour action, launch the tour overlay now.
# Reset current_menu_id to "main" BEFORE starting the tour so that
# "start_intro_tour" is never left in the history stack. Without this,
# navigating away from the main menu (e.g. into WalletMenu) pushes
# "start_intro_tour" onto history, and popping back triggers the tour
# again even if the user already skipped it.
if self.ui_state.current_menu_id == "start_intro_tour":
self.ui_state.current_menu_id = "main"
GuidedTour(self, GuidedTour.resolve_steps(self.INTRO_TOUR_STEPS, self)).start()
33 changes: 21 additions & 12 deletions scenarios/MockUI/tests_device/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ def soft_reset(wait: float = 12.0):
_wait_for_device_responsive(wait=wait)


def flash_firmware(wait: float = 55.0, settle: float = 45.0) -> None:
"""Flash bin/mockui.bin onto the device and wait until it is responsive.

The board resets automatically at the end of flashing, so this function
just blocks until MicroPython is reachable again (up to *wait* seconds,
with an initial *settle* delay for the USB re-enumeration).
"""
print("[device-tests] Flashing firmware ...")
subprocess.run(
[*_CMD, "flash", "program", os.path.abspath(_FIRMWARE)],
check=True,
)
print("[device-tests] Flash done — polling until board is responsive ...")
_wait_for_device_responsive(wait=wait, settle=settle)


def ensure_main_menu(max_depth: int = 5):
"""Navigate back until we're on the main menu.

Expand Down Expand Up @@ -426,18 +442,11 @@ def _require_device(request):
cwd=_REPO_ROOT,
check=True,
)
print("[device-tests] Flashing firmware (blocking until done) ...")
subprocess.run(
[*_CMD, "flash", "program", os.path.abspath(_FIRMWARE)],
check=True,
)
# Flash is complete. The board resets automatically at end of flashing.
# Poll until MicroPython is responsive (up to 30s) rather than fixed sleep.
print("[device-tests] Flash done — polling until board is responsive ...")

# Always wait for the device to be responsive (covers both the build/flash
# path and --no-build-flash with a freshly-flashed or already-running board).
_wait_for_device_responsive(wait=60, settle=45, poll_interval=5)
flash_firmware()
else:
# Always wait for the device to be responsive (covers --no-build-flash
# with a freshly-flashed or already-running board).
_wait_for_device_responsive(wait=60, settle=45, poll_interval=5)

# Navigate to main menu and ensure English — device may be in any state
# from a previous (possibly failed) run.
Expand Down
Loading
Loading