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 Receive folder #12093

Merged
merged 8 commits into from
Oct 30, 2024
6 changes: 3 additions & 3 deletions app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import PickerNetwork from '../../../component-library/components/Pickers/PickerN
import BrowserUrlBar from '../BrowserUrlBar';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { NAV_ANDROID_BACK_BUTTON } from '../../../../wdio/screen-objects/testIDs/Screens/NetworksScreen.testids';
import { REQUEST_SEARCH_RESULTS_BACK_BUTTON } from '../../../../wdio/screen-objects/testIDs/Screens/RequestToken.testIds';
import { BACK_BUTTON_SIMPLE_WEBVIEW } from '../../../../wdio/screen-objects/testIDs/Components/SimpleWebView.testIds';
import Routes from '../../../constants/navigation/Routes';

Expand All @@ -43,7 +42,7 @@ import {
import { CommonSelectorsIDs } from '../../../../e2e/selectors/Common.selectors';
import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletView.selectors';
import { NetworksViewSelectorsIDs } from '../../../../e2e/selectors/Settings/NetworksView.selectors';
import { SendLinkViewSelectorsIDs } from '../../../../e2e/selectors/SendLinkView.selectors';
import { SendLinkViewSelectorsIDs } from '../../../../e2e/selectors/Receive/SendLinkView.selectors';
import { SendViewSelectorsIDs } from '../../../../e2e/selectors/SendView.selectors';
import { getBlockaidTransactionMetricsParams } from '../../../util/blockaid';
import Icon, {
Expand All @@ -52,6 +51,7 @@ import Icon, {
IconColor,
} from '../../../component-library/components/Icons/Icon';
import { AddContactViewSelectorsIDs } from '../../../../e2e/selectors/Settings/Contacts/AddContactView.selectors';
import { RequestPaymentViewSelectors } from '../../../../e2e/selectors/Receive/RequestPaymentView.selectors';

const trackEvent = (event, params = {}) => {
MetaMetrics.getInstance().trackEvent(event, params);
Expand Down Expand Up @@ -360,7 +360,7 @@ export function getPaymentRequestOptionsTitle(
<TouchableOpacity
onPress={goBack}
style={styles.backButton}
{...generateTestId(Platform, REQUEST_SEARCH_RESULTS_BACK_BUTTON)}
testID={RequestPaymentViewSelectors.BACK_BUTTON_ID}
>
<IonicIcon
name={Device.isAndroid() ? 'md-arrow-back' : 'ios-arrow-back'}
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/PaymentRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { selectTokens } from '../../../selectors/tokensController';
import { selectContractExchangeRates } from '../../../selectors/tokenRatesController';
import { selectSelectedInternalAccountChecksummedAddress } from '../../../selectors/accountsController';

import { RequestPaymentViewSelectors } from '../../../../e2e/selectors/RequestPaymentView.selectors';
import { RequestPaymentViewSelectors } from '../../../../e2e/selectors/Receive/RequestPaymentView.selectors';

const KEYBOARD_OFFSET = 120;
const createStyles = (colors) =>
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/PaymentRequestSuccess/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { protectWalletModalVisible } from '../../../actions/user';
import ClipboardManager from '../../../core/ClipboardManager';
import { ThemeContext, mockTheme } from '../../../util/theme';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { SendLinkViewSelectorsIDs } from '../../../../e2e/selectors/SendLinkView.selectors';
import { SendLinkViewSelectorsIDs } from '../../../../e2e/selectors/Receive/SendLinkView.selectors';

const isIos = Device.isIos();

Expand Down
4 changes: 2 additions & 2 deletions app/components/UI/ReceiveRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { isNetworkRampSupported } from '../Ramp/utils';
import { createBuyNavigationDetails } from '../Ramp/routes/utils';
import { selectSelectedInternalAccountChecksummedAddress } from '../../../selectors/accountsController';
import { getRampNetworks } from '../../../reducers/fiatOrders';
import { RequestPaymentModalSelectorsIDs } from '../../../../e2e/selectors/Modals/RequestPaymentModal.selectors';
import { RequestPaymentBottomSheetSelectorsIDs } from '../../../../e2e/selectors/Receive/RequestPaymentBottomSheet.selectors';
import { withMetricsAwareness } from '../../../components/hooks/useMetrics';
import { getDecimalChainId } from '../../../util/networks';
import QRAccountDisplay from '../../Views/QRAccountDisplay';
Expand Down Expand Up @@ -251,7 +251,7 @@ class ReceiveRequest extends PureComponent {
type={'normal'}
onPress={this.onReceive}
containerStyle={styles.actionButton}
testID={RequestPaymentModalSelectorsIDs.REQUEST_BUTTON}
testID={RequestPaymentBottomSheetSelectorsIDs.REQUEST_BUTTON}
>
{strings('receive_request.request_payment')}
</StyledButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Matchers from '../../utils/Matchers';
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
import Gestures from '../../utils/Gestures';
import { SendLinkViewSelectorsIDs } from '../../selectors/SendLinkView.selectors';
import { SendLinkViewSelectorsIDs } from '../../selectors/Receive/SendLinkView.selectors';

class PaymentRequestQrModal {
class PaymentRequestQrBottomSheet {
get container() {
return Matchers.getElementByID(SendLinkViewSelectorsIDs.QR_MODAL);
}
Expand All @@ -16,4 +16,4 @@ class PaymentRequestQrModal {
}
}

export default new PaymentRequestQrModal();
export default new PaymentRequestQrBottomSheet();
19 changes: 19 additions & 0 deletions e2e/pages/Receive/RequestPaymentBottomSheet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { RequestPaymentBottomSheetSelectorsIDs } from '../../selectors/Receive/RequestPaymentBottomSheet.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

class RequestPaymentBottomSheet {
get requestPaymentButton() {
return device.getPlatform() === 'android'
? Matchers.getElementByLabel(
RequestPaymentBottomSheetSelectorsIDs.REQUEST_BUTTON,
)
: Matchers.getElementByID(RequestPaymentBottomSheetSelectorsIDs.REQUEST_BUTTON);
}

async tapRequestPaymentButton() {
await Gestures.waitAndTap(this.requestPaymentButton);
}
}

export default new RequestPaymentBottomSheet();
19 changes: 0 additions & 19 deletions e2e/pages/Receive/RequestPaymentModal.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestPaymentViewSelectors } from '../selectors/RequestPaymentView.selectors';
import Matchers from '../utils/Matchers';
import Gestures from '../utils/Gestures';
import { RequestPaymentViewSelectors } from '../../selectors/Receive/RequestPaymentView.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

class RequestPaymentView {
get backButton() {
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/Receive/SendLinkView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';
import { SendLinkViewSelectorsIDs } from '../../selectors/SendLinkView.selectors';
import { SendLinkViewSelectorsIDs } from '../../selectors/Receive/SendLinkView.selectors';

class SendLinkView {
get container() {
Expand Down
6 changes: 0 additions & 6 deletions e2e/selectors/Modals/RequestPaymentModal.selectors.js

This file was deleted.

3 changes: 3 additions & 0 deletions e2e/selectors/Receive/RequestPaymentBottomSheet.selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const RequestPaymentBottomSheetSelectorsIDs = {
REQUEST_BUTTON: 'request-payment-button',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export const RequestPaymentViewSelectors = {
REQUEST_ASSET_LIST_ID: 'searched-asset-results',
REQUEST_AMOUNT_INPUT_BOX_ID: 'request-amount-input',
TOKEN_SEARCH_INPUT_BOX: 'request-search-asset-input',
PAYMENT_REQUEST_CLOSE_BUTTON: 'send-link-close-button',
};
12 changes: 6 additions & 6 deletions e2e/specs/wallet/request-token-flow.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
import { SmokeCore } from '../../tags';
import RequestPaymentModal from '../../pages/Receive/RequestPaymentModal';
import RequestPaymentBottomSheet from '../../pages/Receive/RequestPaymentBottomSheet';
import SendLinkView from '../../pages/Receive/SendLinkView';
import PaymentRequestQrModal from '../../pages/Receive/PaymentRequestQrModal';
import RequestPaymentView from '../../pages/RequestPaymentView';
import PaymentRequestQrBottomSheet from '../../pages/Receive/PaymentRequestQrBottomSheet';
import RequestPaymentView from '../../pages/Receive/RequestPaymentView';
import TabBarComponent from '../../pages/TabBarComponent';
import WalletActionsModal from '../../pages/modals/WalletActionsModal';
import ProtectYourWalletModal from '../../pages/modals/ProtectYourWalletModal';
Expand Down Expand Up @@ -48,7 +48,7 @@ describe(SmokeCore('Request Token Flow with Unprotected Wallet'), () => {
await Assertions.checkIfVisible(WalletView.container);
await TabBarComponent.tapActions();
await WalletActionsModal.tapReceiveButton();
await RequestPaymentModal.tapRequestPaymentButton();
await RequestPaymentBottomSheet.tapRequestPaymentButton();
await Assertions.checkIfVisible(RequestPaymentView.requestPaymentContainer);
});

Expand All @@ -69,11 +69,11 @@ describe(SmokeCore('Request Token Flow with Unprotected Wallet'), () => {

it('should see DAI request QR code', async () => {
await SendLinkView.tapQRCodeButton();
await Assertions.checkIfVisible(PaymentRequestQrModal.container);
await Assertions.checkIfVisible(PaymentRequestQrBottomSheet.container);
});

it('should close request', async () => {
await PaymentRequestQrModal.tapCloseButton();
await PaymentRequestQrBottomSheet.tapCloseButton();
await SendLinkView.tapCloseSendLinkButton();
});

Expand Down
15 changes: 5 additions & 10 deletions wdio/screen-objects/RequestTokenScreen.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import Selectors from '../helpers/Selectors';
import Gestures from '../helpers/Gestures';
import {
REQUEST_AMOUNT_INPUT,
REQUEST_SEARCH_ASSET_INPUT,
REQUEST_SEARCH_RESULTS_BACK_BUTTON,
REQUEST_SEARCH_SCREEN,
} from './testIDs/Screens/RequestToken.testIds';
import { RequestPaymentViewSelectors } from '../../e2e/selectors/Receive/RequestPaymentView.selectors';

class RequestTokenScreen {
get requestAmount() {
return Selectors.getElementByPlatform(REQUEST_AMOUNT_INPUT);
return Selectors.getElementByPlatform(RequestPaymentViewSelectors.REQUEST_AMOUNT_INPUT_BOX_ID);
}

get requestSearchInput() {
return Selectors.getElementByPlatform(REQUEST_SEARCH_ASSET_INPUT);
return Selectors.getElementByPlatform(RequestPaymentViewSelectors.TOKEN_SEARCH_INPUT_BOX);
}

get requestSearchBackButton() {
return Selectors.getElementByPlatform(REQUEST_SEARCH_RESULTS_BACK_BUTTON);
return Selectors.getElementByPlatform(RequestPaymentViewSelectors.BACK_BUTTON_ID);
}

get requestSearchScreen() {
return Selectors.getElementByPlatform(REQUEST_SEARCH_SCREEN);
return Selectors.getElementByPlatform(RequestPaymentViewSelectors.REQUEST_PAYMENT_CONTAINER_ID);
}

async typeAmountInRequest(amount) {
Expand Down
9 changes: 3 additions & 6 deletions wdio/screen-objects/SendLinkScreen.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import Selectors from '../helpers/Selectors';
import Gestures from '../helpers/Gestures';
import {
PAYMENT_REQUEST_CLOSE_BUTTON,
PAYMENT_REQUEST_QR_CODE_CLOSE_ICON,
} from './testIDs/Screens/RequestToken.testIds';
import { SendLinkViewSelectorsIDs } from '../../e2e/selectors/Receive/SendLinkView.selectors';

class SendLinkScreen {
get requestCloseButton() {
return Selectors.getElementByPlatform(PAYMENT_REQUEST_CLOSE_BUTTON);
return Selectors.getElementByPlatform(SendLinkViewSelectorsIDs.CLOSE_SEND_LINK_VIEW_BUTTON);
}

get closeRequestPaymentQRIcon() {
return Selectors.getElementByPlatform(PAYMENT_REQUEST_QR_CODE_CLOSE_ICON);
return Selectors.getElementByPlatform(SendLinkViewSelectorsIDs.CLOSE_QR_MODAL_BUTTON);
}

async closePaymentRequest() {
Expand Down
8 changes: 0 additions & 8 deletions wdio/screen-objects/testIDs/Screens/RequestToken.testIds.js

This file was deleted.

Loading