Skip to content

tests: Add board qualification tests for A/B/Menu buttons.#92

Merged
nedseb merged 4 commits intofeature/board-qualification-frameworkfrom
feature/board-buttons
Mar 13, 2026
Merged

tests: Add board qualification tests for A/B/Menu buttons.#92
nedseb merged 4 commits intofeature/board-qualification-frameworkfrom
feature/board-buttons

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 13, 2026

Summary

Closes #86
Depends on #89 (framework extension)

Adds board qualification tests for the A, B, and Menu buttons (directly connected to STM32WB55 GPIO, not via I/O expander).

Note: D-PAD buttons (UP/DOWN/LEFT/RIGHT) are already tested in mcp23009e.yaml via the MCP23009E I/O expander.

Scenario: tests/scenarios/board_buttons.yaml

Test Pin Type
Button A press detection A_BUTTON (PA7) hardware_script (interactive)
Button B press detection B_BUTTON (PA8) hardware_script (interactive)
Button MENU press detection MENU_BUTTON (PA0) hardware_script (interactive)

Each test lights up the green LED and polls the button for 5 seconds. The operator must press the button while the LED is on.

How to test

# Mock tests (no regression)
pytest tests/ -k mock

# Collect button board tests
pytest tests/ -k board_buttons --collect-only

# Run on hardware (requires STeaMi board, interactive)
pytest tests/ --port /dev/ttyACM0 -k board_buttons -s

Test results

$ pytest tests/ -k mock -q
41 passed, 95 deselected

$ pytest tests/ -k board_buttons --collect-only -q
3 tests collected (Button A, Button B, Button MENU)

$ pytest tests/ -k board_buttons -q  # (sans --port)
3 skipped  # correctly skipped without hardware

$ pytest tests/ --port /dev/ttyACM0 -k board_buttons -s -v
============================== test session starts ==============================
platform linux -- Python 3.13.7, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/nedjar/sandbox/micropython-steami-lib
configfile: pytest.ini
plugins: typeguard-4.4.2
collected 113 items / 103 deselected / 10 selected                                                                                                                                                                                                                          

tests/test_scenarios.py::test_scenario[board_buttons/Button A press (polling)/hardware]   [INTERACTIVE] Test polling boutons : appuyez sur chaque bouton quand la LED verte s'allume (5s). Commençons par A.
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/Button B press (polling)/hardware]   [INTERACTIVE] Bouton B
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/Button MENU press (polling)/hardware]   [INTERACTIVE] Bouton MENU
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/D-PAD UP press (polling)/hardware]   [INTERACTIVE] Test polling D-PAD : appuyez sur chaque bouton quand la LED verte s'allume (5s). Commençons par UP.
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/D-PAD DOWN press (polling)/hardware]   [INTERACTIVE] Bouton DOWN
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/D-PAD LEFT press (polling)/hardware]   [INTERACTIVE] Bouton LEFT
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/D-PAD RIGHT press (polling)/hardware]   [INTERACTIVE] Bouton RIGHT
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/Button A press (interrupt)/hardware]   [INTERACTIVE] Test interrupt boutons : appuyez brièvement sur chaque bouton quand la LED verte s'allume (5s). Commençons par A.
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/Button B press (interrupt)/hardware]   [INTERACTIVE] Bouton B
True
PASSED
tests/test_scenarios.py::test_scenario[board_buttons/Button MENU press (interrupt)/hardware]   [INTERACTIVE] Bouton MENU
True
PASSED

====================== 10 passed, 103 deselected in 14.76s ======================

Hardware test results will be added after board validation.

Test plan

  • ruff check tests/ — passed
  • pytest tests/ -k mock — 41 passed (no regression)
  • 3 button board tests correctly collected and skipped without --port
  • Hardware validation on STeaMi board (pending)

@nedseb nedseb requested a review from Copilot March 13, 2026 09:08
@nedseb nedseb self-assigned this Mar 13, 2026
@nedseb nedseb added enhancement New feature or request test labels Mar 13, 2026
@nedseb nedseb linked an issue Mar 13, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new board-level qualification scenario to validate that the STeaMi board’s A, B, and MENU buttons (direct GPIO, active-low w/ pull-up) can be detected during an interactive hardware test run.

Changes:

  • Adds tests/scenarios/board_buttons.yaml as a type: board scenario.
  • Implements three hardware_script tests that light LED_GREEN and poll each button for up to 5 seconds.
  • Marks all tests as mode: [hardware] so they are skipped unless run with --port (and interactive -s).

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

Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml Outdated
@nedseb nedseb force-pushed the feature/board-buttons branch from 8135db7 to 6cc871e Compare March 13, 2026 09:14
@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 13, 2026

Corrections suite à la review Copilot (fd3334d) :

  • Vérification de l'état relâché : chaque test attend maintenant que le bouton soit relâché (btn.value() == 1) avant d'allumer la LED et de démarrer la détection. Cela évite les faux positifs si le bouton est stuck-low ou maintenu.
  • `wait: false` : le prompt s'affiche sans attendre Entrée, la LED verte sert de signal de démarrage (même pattern que les tests D-PAD dans `mcp23009e.yaml`).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new board qualification scenario to validate STeaMi’s A/B/MENU buttons via interactive MicroPython scripts executed directly on hardware (no driver required), aligning with the recently introduced type: board scenario support.

Changes:

  • Add tests/scenarios/board_buttons.yaml with hardware-only button press detection scripts.
  • Provide both polling-based and interrupt-based detection variants per button.

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

Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
Comment thread tests/scenarios/board_buttons.yaml
@nedseb nedseb merged commit 0aaac6b into feature/board-qualification-framework Mar 13, 2026
@nedseb nedseb deleted the feature/board-buttons branch March 13, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Add board qualification tests for A/B/Menu buttons.

2 participants