Skip to content

Commit

Permalink
flakiness fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seaona committed Feb 19, 2025
1 parent fad21cd commit ce43301
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class Confirmation {
}

async clickFooterConfirmButton() {
await this.driver.clickElement(this.footerConfirmButton);
await this.driver.clickElementAndWaitForWindowToClose(
this.footerConfirmButton,
);
}

async clickHeaderAccountDetailsButton() {
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/page-objects/pages/home/activity-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ class ActivityListPage {
}

async click_confirmTransactionReplacement() {
await this.driver.clickElement(this.confirmTransactionReplacementButton);
await this.driver.clickElementAndWaitToDisappear(
this.confirmTransactionReplacementButton,
);
}

async check_waitForTransactionStatus(status: 'confirmed' | 'cancelled') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { createDappTransaction } from '../../../page-objects/flows/transaction';
import Confirmation from '../../../page-objects/pages/confirmations/redesign/confirmation';
import ActivityListPage from '../../../page-objects/pages/home/activity-list';
import HomePage from '../../../page-objects/pages/home/homepage';
import { SMART_CONTRACTS } from '../../../seeder/smart-contracts';
import { TestSuiteArguments } from './shared';

const { WINDOW_TITLES, withFixtures } = require('../../../helpers');
Expand All @@ -28,10 +27,9 @@ describe('Speed Up and Cancel Transaction Tests', function () {
.withPermissionControllerConnectedToTestDapp()
.build(),
localNodeOptions: defaultGanacheOptionsForType2Transactions,
smartContract: SMART_CONTRACTS.PIGGYBANK,
title: this.test?.fullTitle(),
},
async ({ driver }: TestSuiteArguments) => {
async ({ driver, ganacheServer }: TestSuiteArguments) => {
await unlockWallet(driver);

// Create initial stuck transaction
Expand All @@ -43,7 +41,6 @@ describe('Speed Up and Cancel Transaction Tests', function () {
});

// Wait for confirmation dialog and confirm initial transaction
await driver.waitUntilXWindowHandles(3);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

const confirmationPage = new Confirmation(driver);
Expand All @@ -53,6 +50,7 @@ describe('Speed Up and Cancel Transaction Tests', function () {
await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
);
await ganacheServer?.mineBlock();

const homePage = new HomePage(driver);
await homePage.goToActivityList();
Expand All @@ -63,6 +61,7 @@ describe('Speed Up and Cancel Transaction Tests', function () {
await activityListPage.click_transactionListItem();
await activityListPage.click_speedUpTransaction();
await activityListPage.click_confirmTransactionReplacement();
await ganacheServer?.mineBlock();

await activityListPage.check_waitForTransactionStatus('confirmed');
},
Expand All @@ -79,10 +78,9 @@ describe('Speed Up and Cancel Transaction Tests', function () {
.withPermissionControllerConnectedToTestDapp()
.build(),
localNodeOptions: defaultGanacheOptionsForType2Transactions,
smartContract: SMART_CONTRACTS.PIGGYBANK,
title: this.test?.fullTitle(),
},
async ({ driver }: TestSuiteArguments) => {
async ({ driver, ganacheServer }: TestSuiteArguments) => {
await unlockWallet(driver);

// Create initial stuck transaction
Expand All @@ -93,11 +91,11 @@ describe('Speed Up and Cancel Transaction Tests', function () {
to: DEFAULT_FIXTURE_ACCOUNT,
});

await driver.waitUntilXWindowHandles(3);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

const confirmationPage = new Confirmation(driver);
await confirmationPage.clickFooterConfirmButton();
await ganacheServer?.mineBlock();

await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
Expand All @@ -111,6 +109,7 @@ describe('Speed Up and Cancel Transaction Tests', function () {

await activityListPage.click_cancelTransaction();
await activityListPage.click_confirmTransactionReplacement();
await ganacheServer?.mineBlock();

await activityListPage.check_waitForTransactionStatus('cancelled');
},
Expand Down

0 comments on commit ce43301

Please sign in to comment.