test(amm-ui): add swap UI test - #237
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an end-to-end UI-driven swap test for the AMM QML app (apps/amm) and introduces stable QML objectName hooks plus documentation/config scaffolding to make the UI test runnable and debuggable.
Changes:
- Add
apps/amm/tests/swap.mjsto drive the live AMM UI via the QML inspector and assert on-chain pool reserve changes after a swap. - Add stable
objectNamehooks across Swap UI QML components to enable deterministic inspector targeting. - Update docs and configuration templates for token list setup, and gitignore local token config + test screenshot artifacts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates TOKENS_CONFIG example path to apps/amm/amm-tokens.json. |
| apps/amm/README.md | Documents token list template workflow and adds a “Running the UI tests” section. |
| apps/amm/tests/swap.mjs | New inspector-driven swap test with screenshots and on-chain reserve assertions. |
| apps/amm/qml/pages/SwapPage.qml | Adds objectName to the SwapCard instance for test targeting. |
| apps/amm/qml/components/swap/TokenSelectorModal.qml | Adds objectName hooks for the modal and token list delegates. |
| apps/amm/qml/components/swap/TokenInput.qml | Exposes objectName forwarding aliases for deterministic input/button selection in tests. |
| apps/amm/qml/components/swap/SwapConfirmationDialog.qml | Adds objectName hooks for the dialog and confirm button. |
| apps/amm/qml/components/swap/SwapCard.qml | Wires objectName hooks into sell/buy inputs/buttons and the submit CTA container. |
| apps/amm/amm-tokens.json.example | Adds a checked-in template token list for local configuration. |
| apps/amm/.gitignore | Ignores personal amm-tokens.json and test screenshot PNG artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b88323b to
8f6e39f
Compare
8f6e39f to
2ccc732
Compare
0x-r4bbit
left a comment
There was a problem hiding this comment.
I tried running this one headlessly via:
nix build .#integration-test -L
But it fails.
Anything else missing for the headless run?
| "holding": "REPLACE_WITH_YOUR_TOKEN_B_HOLDING_ACCOUNT", | ||
| "decimals": 18 | ||
| } | ||
| ] |
There was a problem hiding this comment.
We probably want to make this an app-config.json or something like that, I could imagine adding other things here that the app wants to show by default (like a list of pools etc)
| "name": "Token B", | ||
| "definitionId": "REPLACE_WITH_TOKEN_B_DEFINITION_ID", | ||
| "holding": "REPLACE_WITH_YOUR_TOKEN_B_HOLDING_ACCOUNT", | ||
| "decimals": 18 |
There was a problem hiding this comment.
The decimals don't exist in the program. Is this used anywhere? Otherwise we can get rid off it.
No description provided.