Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check balance switching networks e2e tests #29345

Open
wants to merge 64 commits into
base: main
Choose a base branch
from

Conversation

javiergarciavera
Copy link
Contributor

@javiergarciavera javiergarciavera commented Dec 19, 2024

Description

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@metamaskbot
Copy link
Collaborator

Builds ready [daa63b4]
Page Load Metrics (1696 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15001937169210852
domContentLoaded14881853166410148
load15001940169611053
domInteractive24105462412
backgroundConnect1087352512
firstReactRender16102493316
getState579212311
initialActions01000
loadScripts1084137312387737
setupStore790232311
uiStartup174526182055247119

import { withSolanaAccountSnap } from './common-solana';

describe('Check balance', function (this: Suite) {
this.timeout(300000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this big timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is an open bug which basically takes long time to make the "getBalance" call, hence this big timeout

Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause any flakiness when executing locally, as you mentioned it takes time to load and the spinner appears? Could we mock this call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is not flaky at the moment, but I will keep an eye on it.
I am mocking the call, but the issue comes in because the Solana snap takes a while to make the call (this is the open bug), so even mocking it, I need to wait until this call is made

@hjetpoluru
Copy link
Contributor

Did you check that there are lint failures.

@@ -206,6 +209,41 @@ class AccountListPage {
}
}

async addNewSolanaAccount({
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you write tsdoc for this function and is this function used in the test? I was trying to understand what is the solanaAccountCreationEnabled, is it to create default account?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing! thanks!

}
}

async isTrancsactionDetailDisplayed(text: string): Promise<boolean> {
Copy link
Contributor

@hjetpoluru hjetpoluru Jan 10, 2025

Choose a reason for hiding this comment

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

minor typo here isTransactionDetailDisplayed and format should be check_isTransactionDetailDisplayed

}
}

async checkTransactionStatus(sent: boolean): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit the format should be check_TransactionStatus

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done! thanks!

this.driver = driver;
}

async isViewTransactionLinkDisplayed() {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: format should be check_isViewTransactionLinkDisplayed

assert.equal(
await sendSolanaPage.isInsufficientBalanceDisplayed(),
false,
'Insufficiente balance text is displayed',
Copy link
Contributor

Choose a reason for hiding this comment

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

minor typo

Suggested change
'Insufficiente balance text is displayed',
'Insufficient balance text is displayed',

await withSolanaAccountSnap(
{ title: this.test?.fullTitle(), showNativeTokenAsMainBalance: true },
async (driver) => {
await driver.refresh();
Copy link
Contributor

@hjetpoluru hjetpoluru Jan 10, 2025

Choose a reason for hiding this comment

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

Do we need this?

await driver.refresh();

Copy link
Contributor

Choose a reason for hiding this comment

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

I validated it locally its not needed and works fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we actually do, I opened a ticket for the solana team, there are some exceptions thrown from the Solana snap, so that's the work around to get the test working :(

@hjetpoluru
Copy link
Contributor

Nice effort, overview looks good to me. I have documented some minor suggestion please check them and lint errors needs to be fixed. Could you add description and the commands used in the execution it would help.

@metamaskbot
Copy link
Collaborator

Builds ready [519d104]
Page Load Metrics (1665 ± 65 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14501942166913565
domContentLoaded14431917163812861
load14521935166513565
domInteractive2594452010
backgroundConnect868282110
firstReactRender1675362311
getState45916168
initialActions01000
loadScripts10381488122312158
setupStore637973
uiStartup16462296188716479

@metamaskbot
Copy link
Collaborator

Builds ready [fc792c5]
Page Load Metrics (1588 ± 34 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1420179015927837
domContentLoaded1412172915656632
load1420174215887134
domInteractive22179473617
backgroundConnect85625189
firstReactRender1592362914
getState478202211
initialActions01000
loadScripts1042135111696230
setupStore65011126
uiStartup17262319188117082
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-sol PRs from the Solana snap team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants