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(test): detox: add BasePage for views to extend from #6909

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e/pages/AddCustomTokenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import {
} from '../../wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds';

import messages from '../../locales/languages/en.json';
import BasePage from './BasePage';

const TOKEN_SYMBOL_TEXT = messages.token.token_symbol;
export default class AddCustomTokenView {

export default class AddCustomTokenView extends BasePage {
static async tapImportButton() {
//await TestHelpers.swipe(TOKEN_ADDRESS_SYMBOL_ID, 'up', 'slow', 0.6);
await TestHelpers.waitAndTapText('IMPORT');
Expand Down
11 changes: 11 additions & 0 deletions e2e/pages/BasePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import TestHelpers from '../helpers';

export default class BasePage {
static async waitForToastMessageVisible(text) {
await TestHelpers.checkIfElementByTextIsVisible(text);
}

static async waitForToastMessageToGoAway(text) {
await TestHelpers.checkIfElementWithTextIsNotVisible(text);
}
}
3 changes: 2 additions & 1 deletion e2e/pages/TransactionConfirmView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../../wdio/screen-objects/testIDs/Screens/EditGasFeeScreen.testids.js';

import messages from '../../locales/languages/en.json';
import BasePage from './BasePage';

const EDIT_GAS_FEE_AGGRESSIVE_TEXT = messages.edit_gas_fee_eip1559.aggressive;
const EDIT_GAS_FEE_ADVANCE_OPTIONS_TEXT =
Expand All @@ -23,7 +24,7 @@ const EDIT_GAS_FEE_LOW_TEXT = messages.edit_gas_fee_eip1559.low;

const TRANSACTION_CONFIRMATION_CANCEL_BUTTON_TEXT = messages.transaction.cancel;

export default class TransactionConfirmationView {
export default class TransactionConfirmationView extends BasePage {
static async tapConfirmButton() {
if (device.getPlatform() === 'ios') {
await TestHelpers.waitAndTap(CONFIRM_TRANSACTION_BUTTON_ID);
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/send-ERC-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe(Smoke('Send ERC Token'), () => {
await AddCustomTokenView.tapTokenSymbolText();
await AddCustomTokenView.scrollDownOnImportCustomTokens();
await AddCustomTokenView.tapImportButton();
await AddCustomTokenView.waitForToastMessageVisible('Imported Token');
await WalletView.isVisible();
});

Expand All @@ -66,6 +67,5 @@ describe(Smoke('Send ERC Token'), () => {
await AmountView.tapNextButton();
await TransactionConfirmationView.isAmountVisible('< 0.00001 LINK');
await TransactionConfirmationView.tapConfirmButton();
TestHelpers.checkIfElementWithTextIsNotVisible('Transaction submitted');
});
});
Loading