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: Removing test selector strings within app code #7967

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ exports[`AssetList should render correctly 1`] = `
"padding": 20,
}
}
testID="add-searched-token-screen"
/>
`;
6 changes: 2 additions & 4 deletions app/components/UI/AssetList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ export default class AssetList extends PureComponent {
const { searchResults = [], handleSelectAsset, selectedAsset } = this.props;

return (
<View style={styles.rowWrapper} testID={'add-searched-token-screen'}>
<View style={styles.rowWrapper}>
{searchResults.length > 0 ? (
<Text style={styles.normalText} testID={'select-token-title'}>
{strings('token.select_token')}
</Text>
<Text style={styles.normalText}>{strings('token.select_token')}</Text>
) : null}
{searchResults.length === 0 && this.props.searchQuery.length ? (
<Text style={styles.normalText}>
Expand Down
10 changes: 3 additions & 7 deletions app/components/UI/BrowserUrlBar/BrowserUrlBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Platform, TouchableOpacity, View } from 'react-native';
import { TouchableOpacity, View } from 'react-native';

import { useStyles } from '../../../component-library/hooks';
import { getURLProtocol } from '../../../util/general';
Expand All @@ -14,8 +14,7 @@ import Text from '../../../component-library/components/Texts/Text';

import { BrowserUrlBarProps } from './BrowserUrlBar.types';
import stylesheet from './BrowserUrlBar.styles';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { NAVBAR_TITLE_NETWORK } from '../../../../wdio/screen-objects/testIDs/BrowserScreen/BrowserScreen.testIds';
import { BrowserViewSelectorsIDs } from '../../../../e2e/selectors/BrowserView.selectors';
import Url from 'url-parse';
import { regex } from '../../../../app/util/regex';

Expand Down Expand Up @@ -47,10 +46,7 @@ const BrowserUrlBar = ({ url, route, onPress }: BrowserUrlBarProps) => {

return (
<TouchableOpacity onPress={onPress}>
<View
style={styles.main}
{...generateTestId(Platform, NAVBAR_TITLE_NETWORK)}
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
>
<View style={styles.main} testID={BrowserViewSelectorsIDs.URL_INPUT}>
<Icon
color={theme.colors.icon.alternative}
name={secureConnectionIcon}
Expand Down
13 changes: 3 additions & 10 deletions app/components/UI/NavbarTitle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { scale } from 'react-native-size-matters';
import {
TouchableOpacity,
View,
StyleSheet,
Text,
Platform,
} from 'react-native';
import { TouchableOpacity, View, StyleSheet, Text } from 'react-native';
import { fontStyles, colors as importedColors } from '../../../styles/common';
import Networks from '../../../util/networks';
import { strings } from '../../../../locales/i18n';
import Device from '../../../util/device';
import { ThemeContext, mockTheme } from '../../../util/theme';
import { NAVBAR_TITLE_NETWORKS_TEXT } from '../../../../wdio/screen-objects/testIDs/Screens/WalletScreen-testIds';
import generateTestId from '../../../../wdio/utils/generateTestId';
import Routes from '../../../constants/navigation/Routes';
import { MetaMetricsEvents } from '../../../core/Analytics';
import Analytics from '../../../core/Analytics/Analytics';
Expand Down Expand Up @@ -135,7 +128,7 @@ class NavbarTitle extends PureComponent {
onPress={this.openNetworkList}
style={styles.wrapper}
activeOpacity={this.props.disableNetwork ? 1 : 0.2}
testID={'navbar-title-text'}
// testID={'navbar-title-text'}
>
{title ? (
<Text numberOfLines={1} style={styles.title}>
Expand All @@ -152,7 +145,7 @@ class NavbarTitle extends PureComponent {
<Text
numberOfLines={1}
style={styles.networkName}
{...generateTestId(Platform, NAVBAR_TITLE_NETWORKS_TEXT)}
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
testID={NAVBAR_TITLE_NETWORKS_TEXT}
>
{name}
</Text>
Expand Down
8 changes: 3 additions & 5 deletions app/components/UI/Notification/BaseNotification/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { TouchableOpacity, StyleSheet, View, Platform } from 'react-native';
import { TouchableOpacity, StyleSheet, View } from 'react-native';
import PropTypes from 'prop-types';
import { fontStyles, baseStyles } from '../../../../styles/common';
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
Expand All @@ -9,8 +9,7 @@ import IonicIcon from 'react-native-vector-icons/Ionicons';
import AntIcon from 'react-native-vector-icons/AntDesign';
import Text from '../../../Base/Text';
import { useTheme } from '../../../../util/theme';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { NOTIFICATION_TITLE } from '../../../../../wdio/screen-objects/testIDs/Components/Notification.testIds';
import { CommonSelectorsIDs } from '../../../../../e2e/selectors/Common.selectors';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -168,7 +167,6 @@ const BaseNotification = ({
<View style={styles.floatingBackground}>
<TouchableOpacity
style={styles.defaultFlashFloating}
testID={'press-notification-button'}
onPress={onPress}
activeOpacity={0.8}
>
Expand All @@ -178,7 +176,7 @@ const BaseNotification = ({
<View style={styles.flashLabel}>
<Text
style={styles.flashTitle}
{...generateTestId(Platform, NOTIFICATION_TITLE)}
testID={CommonSelectorsIDs.TOAST_NOTIFICATION_TITLE}
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
>
{!title ? getTitle(status, data) : title}
</Text>
Expand Down
27 changes: 15 additions & 12 deletions app/components/UI/PaymentRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
TouchableOpacity,
KeyboardAvoidingView,
InteractionManager,
Platform,
} from 'react-native';
import { connect } from 'react-redux';
import { fontStyles, baseStyles } from '../../../styles/common';
Expand Down Expand Up @@ -60,12 +59,8 @@ import { selectTokenListArray } from '../../../selectors/tokenListController';
import { selectTokens } from '../../../selectors/tokensController';
import { selectContractExchangeRates } from '../../../selectors/tokenRatesController';
import { selectSelectedAddress } from '../../../selectors/preferencesController';
import generateTestId from '../../../../wdio/utils/generateTestId';
import {
REQUEST_AMOUNT_INPUT,
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
REQUEST_SEARCH_ASSET_INPUT,
REQUEST_SEARCH_SCREEN,
} from '../../../../wdio/screen-objects/testIDs/Screens/RequestToken.testIds';

cortisiko marked this conversation as resolved.
Show resolved Hide resolved
import { RequestPaymentViewSelectors } from '../../../../e2e/selectors/RequestPaymentView.selectors';

const KEYBOARD_OFFSET = 120;
const createStyles = (colors) =>
Expand Down Expand Up @@ -462,7 +457,7 @@ class PaymentRequest extends PureComponent {
return (
<View
style={baseStyles.flexGrow}
{...generateTestId(Platform, REQUEST_SEARCH_SCREEN)}
testID={RequestPaymentViewSelectors.REQUEST_PAYMENT_CONTAINER_ID}
>
<View>
<Text style={styles.title}>
Expand All @@ -489,7 +484,7 @@ class PaymentRequest extends PureComponent {
returnKeyType="go"
value={this.state.searchInputValue}
blurOnSubmit
{...generateTestId(Platform, REQUEST_SEARCH_ASSET_INPUT)}
testID={RequestPaymentViewSelectors.TOKEN_SEARCH_INPUT_BOX}
keyboardAppearance={themeAppearance}
/>
{this.state.searchInputValue ? (
Expand All @@ -506,7 +501,10 @@ class PaymentRequest extends PureComponent {
) : null}
</View>
)}
<View style={styles.assetsWrapper} testID={'searched-asset-results'}>
<View
style={styles.assetsWrapper}
testID={RequestPaymentViewSelectors.REQUEST_ASSET_LIST_ID}
>
<Text style={styles.assetsTitle}>
{this.state.searchInputValue
? strings('payment_request.search_results')
Expand Down Expand Up @@ -759,7 +757,10 @@ class PaymentRequest extends PureComponent {
switchable = false;
}
return (
<View style={styles.enterAmountWrapper} testID={'request-amount-screen'}>
<View
style={styles.enterAmountWrapper}
testID={RequestPaymentViewSelectors.REQUEST_PAYMENT_CONTAINER_ID}
>
<View>
<Text style={styles.title}>
{strings('payment_request.enter_amount')}
Expand All @@ -786,7 +787,9 @@ class PaymentRequest extends PureComponent {
value={amount}
onSubmitEditing={this.onNext}
ref={this.amountInput}
{...generateTestId(Platform, REQUEST_AMOUNT_INPUT)}
testID={
RequestPaymentViewSelectors.REQUEST_AMOUNT_INPUT_BOX_ID
}
keyboardAppearance={themeAppearance}
/>
<Text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ exports[`BuildQuote View Crypto Currency Data renders a special error page if cr
"justifyContent": "center",
}
}
testID="navbar-title-text"
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -895,7 +894,6 @@ exports[`BuildQuote View Crypto Currency Data renders a special error page if cr
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -1629,7 +1627,6 @@ exports[`BuildQuote View Crypto Currency Data renders an error page when there i
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -2334,7 +2331,6 @@ exports[`BuildQuote View Crypto Currency Data renders the loading page when cryp
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -3231,7 +3227,6 @@ exports[`BuildQuote View Fiat Currency Data renders an error page when there is
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -3936,7 +3931,6 @@ exports[`BuildQuote View Fiat Currency Data renders the loading page when fiats
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -4833,7 +4827,6 @@ exports[`BuildQuote View Payment Method Data renders an error page when there is
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -5538,7 +5531,6 @@ exports[`BuildQuote View Payment Method Data renders the loading page when payme
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -6435,7 +6427,6 @@ exports[`BuildQuote View Regions data renders an error page when there is a regi
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -7140,7 +7131,6 @@ exports[`BuildQuote View Regions data renders the loading page when regions are
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -8037,7 +8027,6 @@ exports[`BuildQuote View renders correctly 1`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -11262,7 +11251,6 @@ exports[`BuildQuote View renders correctly 2`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -14434,7 +14422,6 @@ exports[`BuildQuote View renders correctly when sdkError is present 1`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -15139,7 +15126,6 @@ exports[`BuildQuote View renders correctly when sdkError is present 2`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ exports[`GetStarted renders correctly 1`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -809,7 +808,6 @@ exports[`GetStarted renders correctly 2`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -1480,7 +1478,6 @@ exports[`GetStarted renders correctly when getStarted is true 1`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down Expand Up @@ -1921,7 +1918,6 @@ exports[`GetStarted renders correctly when sdkError is present 1`] = `
"justifyContent": "center",
}
}
testID="navbar-title-text"
>
<Text
numberOfLines={1}
Expand Down
Loading
Loading