Commit 9af8fdc
authored
test: add performance test for loading available balance on Predict Market List screen (MetaMask#24041)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Adding new performance test that measures the loading times for the
available balance on the Predict Market List screen. The test tracks the
time taken to navigate to the Predict tab, display the balance card, and
fully load the available balance text. Additionally, it enhances the
`PredictMarketListScreen` class by adding methods to check the
visibility of the balance card and available balance text, improving the
overall testing framework.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MMQA-1193
## **Manual testing steps**
```gherkin
Feature: Predict Available Balance Performance
As a user with an existing balance on Polygon
I want the available balance to load quickly on the Predict Market List screen
So that I can see my funds without waiting
Background:
Given I have an existing wallet with balance on Polygon
And I am logged into the MetaMask Mobile app
@performance @predict @balance
Scenario: Measure time to navigate to Predict tab
Given I am on the Wallet Main screen
When I tap the action button in the tab bar
And I tap the Predict button in the wallet action modal
Then the Predict Market List container should be displayed
And the navigation time should be recorded
@performance @predict @balance
Scenario: Measure time for balance card to appear
Given I am on the Predict Market List screen
When the container is displayed
Then the Balance Card should become visible
And the balance card load time should be recorded
@performance @predict @balance
Scenario: Measure time for available balance text to load
Given I am on the Predict Market List screen
And the Balance Card is visible
When the balance data is fetched from the network
Then the "Available balance" text should be displayed
And the balance text load time should be recorded
@performance @predict @balance @e2e
Scenario: Complete available balance load time performance test
Given I am logged into the app with an account that has Polygon balance
When I tap the action button in the tab bar
And I tap the Predict button
Then the Predict Market List container should be displayed within acceptable time
And the Balance Card should become visible
And the "Available balance" text should appear indicating the balance is fully loaded
And all performance metrics should be recorded:
| Metric | Description |
| Navigate to Predict | Time from tapping Predict button to container displayed |
| Balance Card Visible | Time from container displayed to balance card visible |
| Available Balance Loaded | Time from balance card visible to balance text displayed |
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds a performance test for time-to-available-balance on Predict
Market List and extends the screen object with balance card/available
balance selectors and visibility checks.
>
> - **Tests**:
> - Add
`appwright/tests/performance/login/predict/predict-available-balance.spec.js`
to measure time from tapping Predict to when `Available balance` is
shown, recording metrics via `performanceTracker`.
> - **Screen Objects**
(`wdio/screen-objects/PredictMarketListScreen.js`):
> - Import `PredictBalanceSelectorsIDs` and add `balanceCard` getter.
> - Add `isBalanceCardDisplayed()`, `getAvailableBalanceText()`, and
`isAvailableBalanceDisplayed()` for both WDIO and Appwright flows.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6605ff1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 3009287 commit 9af8fdc
2 files changed
Lines changed: 103 additions & 1 deletion
File tree
- appwright/tests/performance/login/predict
- wdio/screen-objects
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
101 | 147 | | |
102 | 148 | | |
103 | 149 | | |
| |||
0 commit comments