Skip to content

Commit

Permalink
Fix swaps smoke flakiness (#8355)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortisiko authored Jan 20, 2024
1 parent 3525d89 commit c6e57cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions e2e/pages/TokenOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export default class TokenOverview {
}

static async tapSwapButton() {
await TestHelpers.tap(TOKEN_OVERVIEW_SWAP_BUTTON);
await TestHelpers.waitAndTap(TOKEN_OVERVIEW_SWAP_BUTTON);
}

static async scrollOnScreen() {
await TestHelpers.swipe(TOKEN_PRICE, 'up', 'fast', 0.6);
}

static async tapBackButton() {
await TestHelpers.tap(ASSET_BACK_BUTTON);
await TestHelpers.waitAndTap(ASSET_BACK_BUTTON);
}

static async isVisible() {
Expand Down
15 changes: 11 additions & 4 deletions e2e/pages/swaps/SwapView.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import TestHelpers from '../../helpers';
import { SwapsViewSelectors } from '../../selectors/swaps/SwapsView.selectors.js';

import messages from '../../../locales/languages/en.json';
import { waitFor } from 'detox';

Expand Down Expand Up @@ -28,10 +29,16 @@ export default class SwapView {
}

static async waitForSwapToComplete(sourceTokenSymbol, destTokenSymbol) {
await TestHelpers.checkIfElementByTextIsVisible(
`Swap complete (${sourceTokenSymbol} to ${destTokenSymbol})`,
60000,
);
try {
await TestHelpers.checkIfElementByTextIsVisible(
`Swap complete (${sourceTokenSymbol} to ${destTokenSymbol})`,
60000,
);
} catch (e) {
// eslint-disable-next-line no-console
console.log(`Toast message is slow to appear or did not appear: ${e}`);
}

await device.enableSynchronization();
await TestHelpers.delay(5000);
}
Expand Down

0 comments on commit c6e57cb

Please sign in to comment.