Skip to content

Commit

Permalink
test: Move files to Receive folder (#12093)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

We currently have a few of our page object files lingering outside of a
specific folder. As part of our ongoing efforts to improve the
organization and maintainability of our test automation codebase, we
need to move Page Object files into their respective folders. This will
help streamline the project structure, making it easier for team members
to locate and manage the files. The folder where each of the remaining
files should be moved have to reflect the functionality or feature on
the app. This same structure should be reflected on the selectors
folder.

Files to relocate to the Receive folder:

- e2e/pages/RequestPaymentView.js

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

Regression test run:
https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/06900b33-0e68-4207-8a36-9f893db76609?tab=workflows

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
SamuelSalas authored Oct 30, 2024
1 parent f54acb6 commit 83d3247
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 50 deletions.
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
2 changes: 1 addition & 1 deletion 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 { RequestPaymentModalSelectorsIDs } from '../../../../e2e/selectors/Receive/RequestPaymentModal.selectors';
import { withMetricsAwareness } from '../../../components/hooks/useMetrics';
import { getDecimalChainId } from '../../../util/networks';
import QRAccountDisplay from '../../Views/QRAccountDisplay';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Matchers from '../../utils/Matchers';
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();
4 changes: 2 additions & 2 deletions e2e/pages/Receive/RequestPaymentModal.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { RequestPaymentModalSelectorsIDs } from '../../selectors/Modals/RequestPaymentModal.selectors';
import { RequestPaymentModalSelectorsIDs } from '../../selectors/Receive/RequestPaymentModal.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';

class RequestPaymentModal {
get requestPaymentButton() {
return device.getPlatform() === 'android'
? Matchers.getElementByLabel(
RequestPaymentModalSelectorsIDs.REQUEST_BUTTON,
RequestPaymentModalSelectorsIDs.REQUEST_BUTTON,
)
: Matchers.getElementByID(RequestPaymentModalSelectorsIDs.REQUEST_BUTTON);
}
Expand Down
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/RequestPaymentModal.selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const RequestPaymentModalSelectorsIDs = {
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',
};
File renamed without changes.
8 changes: 4 additions & 4 deletions e2e/specs/wallet/request-token-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { SmokeCore } from '../../tags';
import RequestPaymentModal from '../../pages/Receive/RequestPaymentModal';
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 @@ -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.

0 comments on commit 83d3247

Please sign in to comment.