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

test: Move files to Transactions folder #12090

Merged
merged 7 commits into from
Oct 30, 2024
Merged
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
2 changes: 1 addition & 1 deletion app/components/Base/DetailsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Ionicons from 'react-native-vector-icons/Ionicons';
import { fontStyles } from '../../styles/common';
import Text from './Text';
import { useTheme } from '../../util/theme';
import { TransactionDetailsModalSelectorsIDs } from '../../../e2e/selectors/Modals/TransactionDetailsModal.selectors';
import { TransactionDetailsModalSelectorsIDs } from '../../../e2e/selectors/Transactions/TransactionDetailsModal.selectors';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { selectChainId } from '../../../../../selectors/networkController';
import ApproveTransactionHeader from '../ApproveTransactionHeader';
import { getActiveTabUrl } from '../../../../../util/transactions';
import { isEqual } from 'lodash';
import { AssetWatcherSelectorsIDs } from '../../../../../../e2e/selectors/Modals/AssetWatcher.selectors';
import { AssetWatcherSelectorsIDs } from '../../../../../../e2e/selectors/Transactions/AssetWatcher.selectors';
import { getDecimalChainId } from '../../../../../util/networks';
import { useMetrics } from '../../../../../components/hooks/useMetrics';

Expand Down
4 changes: 2 additions & 2 deletions e2e/api-specs/ConfirmationsRejectionRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TestHelpers from '../helpers';
import Matchers from '../utils/Matchers';
import Gestures from '../utils/Gestures';
import ConnectBottomSheet from '../pages/Browser/ConnectBottomSheet';
import AssetWatchModal from '../pages/modals/AssetWatchModal';
import AssetWatchBottomSheet from '../pages/Transactions/AssetWatchBottomSheet';
import SpamFilterModal from '../pages/Browser/SpamFilterModal';

// eslint-disable-next-line import/no-nodejs-modules
Expand Down Expand Up @@ -147,7 +147,7 @@ export default class ConfirmationsRejectRule {
let cancelButton;
await TestHelpers.delay(3000);
if (this.allCapsCancel.includes(call.methodName)) {
await AssetWatchModal.tapCancelButton();
await AssetWatchBottomSheet.tapCancelButton();
} else {
cancelButton = await Matchers.getElementByText('Cancel');
await Gestures.waitAndTap(cancelButton);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { ActivitiesViewSelectorsText } from '../selectors/ActivitiesView.selectors';
import Matchers from '../utils/Matchers';
import Gestures from '../utils/Gestures';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

class ActivitiesView {
get title() {
return Matchers.getElementByText(ActivitiesViewSelectorsText.TITLE);
}

get confirmedLabel() {
return Matchers.getElementByText(ActivitiesViewSelectorsText.CONFIRM_TEXT);
}

generateSwapActivityLabel(sourceToken, destinationToken) {
let title = ActivitiesViewSelectorsText.SWAP;
title = title.replace('{{sourceToken}}', sourceToken);
Expand Down
15 changes: 15 additions & 0 deletions e2e/pages/Transactions/AssetWatchBottomSheet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AssetWatcherSelectorsIDs } from '../../selectors/Transactions/AssetWatcher.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

class AssetWatchBottomSheet {
get cancelButton() {
return Matchers.getElementByID(AssetWatcherSelectorsIDs.CANCEL_BUTTON);
}

async tapCancelButton() {
await Gestures.waitAndTap(this.cancelButton);
}
}

export default new AssetWatchBottomSheet();
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
TransactionDetailsModalSelectorsText,
TransactionDetailsModalSelectorsIDs,
} from '../../selectors/Modals/TransactionDetailsModal.selectors';
} from '../../selectors/Transactions/TransactionDetailsModal.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';
import { CommonSelectorsIDs } from '../../selectors/Common.selectors';

class DetailsModal {
class TransactionDetailsModal {
get title() {
return Matchers.getElementByID(TransactionDetailsModalSelectorsIDs.TITLE);
}
Expand Down Expand Up @@ -40,4 +40,4 @@ class DetailsModal {
}
}

export default new DetailsModal();
export default new TransactionDetailsModal();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TransactionProtectionModalSelectorText } from '../../selectors/Modals/TransactionProtectionModal.selectors';
import { TransactionProtectionModalSelectorText } from '../../selectors/Transactions/TransactionProtectionModal.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

Expand Down
21 changes: 0 additions & 21 deletions e2e/pages/modals/AssetWatchModal.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import enContent from '../../locales/languages/en.json';
import enContent from '../../../locales/languages/en.json';

function getSentUnitMessage(unit) {
return enContent.transactions.sent_unit.replace('{{unit}}', unit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import enContent from '../../../locales/languages/en.json';

export const TransactionDetailsModalSelectorsText = {
TITLE: enContent.swaps.transaction_label.swap,
CONFIRMED: enContent.transaction.confirmed,
};

export const TransactionDetailsModalSelectorsIDs = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/approve-custom-erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TestDApp from '../../pages/Browser/TestDApp';
import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts';
import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet';
import Assertions from '../../utils/Assertions';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';

const HST_CONTRACT = SMART_CONTRACTS.HST;

Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/approve-default-erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts';
import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';

import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet';
import Assertions from '../../utils/Assertions';
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/increase-allowance-erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TestDApp from '../../pages/Browser/TestDApp';
import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts';
import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet';
import Assertions from '../../utils/Assertions';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';

const HST_CONTRACT = SMART_CONTRACTS.HST;

Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/send-erc20-with-dapp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
SMART_CONTRACTS,
contractConfiguration,
} from '../../../app/util/test/smart-contracts';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';

import TabBarComponent from '../../pages/TabBarComponent';
import TestDApp from '../../pages/Browser/TestDApp';
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/send-erc721.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
defaultGanacheOptions,
} from '../../fixtures/fixture-helper';
import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';
import Assertions from '../../utils/Assertions';

describe(SmokeConfirmations('ERC721 tokens'), () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
defaultGanacheOptions,
} from '../../fixtures/fixture-helper';
import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts';
import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.selectors';
import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors';
import Assertions from '../../utils/Assertions';
import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors';
import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet';
Expand Down
20 changes: 10 additions & 10 deletions e2e/specs/quarantine/swap-token-chart.failing.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import FixtureServer from '../../fixtures/fixture-server';
import { getFixturesServerPort } from '../../fixtures/utils';
import { Regression } from '../../tags';
import Assertions from '../../utils/Assertions';
import ActivitiesView from '../../pages/ActivitiesView';
import DetailsModal from '../../pages/modals/DetailsModal';
import ActivitiesView from '../../pages/Transactions/ActivitiesView';
import DetailsBottomSheet from '../../pages/Transactions/TransactionDetailsModal';

const fixtureServer = new FixtureServer();
const sourceTokenSymbol = 'USDT';
Expand Down Expand Up @@ -95,22 +95,22 @@ describe(Regression('Swap from Token view'), () => {
await ActivitiesView.tapOnSwapActivity(sourceTokenSymbol, destTokenSymbol);

try {
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
}

await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
DetailsBottomSheet.title,
DetailsBottomSheet.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.statusConfirmed);
await DetailsBottomSheet.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsBottomSheet.title);
});
});
20 changes: 10 additions & 10 deletions e2e/specs/swaps/swap-action-regression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Onboarding from '../../pages/swaps/OnBoarding';
import QuoteView from '../../pages/swaps/QuoteView';
import SwapView from '../../pages/swaps/SwapView';
import TabBarComponent from '../../pages/TabBarComponent';
import ActivitiesView from '../../pages/ActivitiesView';
import DetailsModal from '../../pages/modals/DetailsModal';
import ActivitiesView from '../../pages/Transactions/ActivitiesView';
import DetailsBottomSheet from '../../pages/Transactions/TransactionDetailsModal';
import WalletActionsModal from '../../pages/modals/WalletActionsModal';
import WalletView from '../../pages/wallet/WalletView';
import FixtureBuilder from '../../fixtures/fixture-builder';
Expand Down Expand Up @@ -116,23 +116,23 @@ describe(SmokeSwaps('Multiple Swaps from Actions'), () => {
);

try {
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
}

await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
DetailsBottomSheet.title,
DetailsBottomSheet.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.statusConfirmed);
await DetailsBottomSheet.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsBottomSheet.title);
},
);
});
18 changes: 9 additions & 9 deletions e2e/specs/swaps/swap-action-smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Onboarding from '../../pages/swaps/OnBoarding';
import QuoteView from '../../pages/swaps/QuoteView';
import SwapView from '../../pages/swaps/SwapView';
import TabBarComponent from '../../pages/TabBarComponent';
import ActivitiesView from '../../pages/ActivitiesView';
import DetailsModal from '../../pages/modals/DetailsModal';
import ActivitiesView from '../../pages/Transactions/ActivitiesView';
import DetailsBottomSheet from '../../pages/Transactions/TransactionDetailsModal';
import WalletActionsModal from '../../pages/modals/WalletActionsModal';
import FixtureBuilder from '../../fixtures/fixture-builder';
import {
Expand Down Expand Up @@ -115,21 +115,21 @@ describe(SmokeSwaps('Swap from Actions'), () => {
);

try {
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
} catch (e) {
await ActivitiesView.tapOnSwapActivity(
sourceTokenSymbol,
destTokenSymbol,
);
await Assertions.checkIfVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.title);
}
await Assertions.checkIfElementToHaveText(
DetailsModal.title,
DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
DetailsBottomSheet.title,
DetailsBottomSheet.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol),
);
await Assertions.checkIfVisible(DetailsModal.statusConfirmed);
await DetailsModal.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsModal.title);
await Assertions.checkIfVisible(DetailsBottomSheet.statusConfirmed);
await DetailsBottomSheet.tapOnCloseIcon();
await Assertions.checkIfNotVisible(DetailsBottomSheet.title);
},
);
});
Loading