1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Fix flaky test by stop estimating gas when starting a draft transaction in the send flow (#19897)

* Stop estimating gas when starting a draft transaction in the send flow, because other estimates will happen later

* fix: test fixing overlay dom issue

* Stop estimating gas when starting a draft transaction in the send flow, because other estimates will happen later

* fix: remove extra await delays

---------

Co-authored-by: Danica Shen <zhaodanica@gmail.com>
This commit is contained in:
Dan J Miller 2023-07-06 17:27:02 -02:30 committed by GitHub
parent 2c22e85947
commit e8bd57fd13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -291,13 +291,12 @@ describe('MetaMask', function () {
it('transitions to the confirm screen', async function () {
// Continue to next screen
await driver.delay(largeDelayMs);
await driver.waitForElementNotPresent('.loading-overlay');
await driver.clickElement({ text: 'Next', tag: 'button' });
await driver.delay(largeDelayMs);
});
it('displays the token transfer data', async function () {
await driver.delay(largeDelayMs);
await driver.waitForElementNotPresent('.loading-overlay');
await driver.clickElement({ text: 'Hex', tag: 'button' });
await driver.delay(regularDelayMs);
@ -481,7 +480,7 @@ describe('MetaMask', function () {
});
it('submits the transaction', async function () {
await driver.delay(largeDelayMs * 2);
await driver.waitForElementNotPresent('.loading-overlay');
await driver.clickElement({ text: 'Confirm', tag: 'button' });
await driver.delay(largeDelayMs * 2);
});

View File

@ -2015,10 +2015,11 @@ export function updateSendAmount(amount) {
* @param {object} payload - action payload
* @param {string} payload.type - type of asset to send
* @param {TokenDetails} [payload.details] - ERC20 details if sending TOKEN asset
* @param payload.skipComputeEstimatedGasLimit
* @returns {ThunkAction<void>}
*/
export function updateSendAsset(
{ type, details: providedDetails },
{ type, details: providedDetails, skipComputeEstimatedGasLimit },
{ initialAssetSet = false } = {},
) {
return async (dispatch, getState) => {
@ -2149,7 +2150,7 @@ export function updateSendAsset(
await dispatch(actions.updateAsset({ asset, initialAssetSet }));
}
if (initialAssetSet === false) {
if (initialAssetSet === false && !skipComputeEstimatedGasLimit) {
await dispatch(computeEstimatedGasLimit());
}
};
@ -2393,6 +2394,7 @@ export function startNewDraftTransaction(asset) {
updateSendAsset({
type: asset.type ?? AssetType.native,
details: asset.details,
skipComputeEstimatedGasLimit: true,
}),
);