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 (5/7) #7989

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/Views/CollectibleView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CollectibleView extends PureComponent {
return (
<SafeAreaView style={styles.root}>
<ScrollView style={styles.wrapper} ref={this.scrollViewRef}>
<View style={styles.assetOverviewWrapper} testID={'asset'}>
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
<View style={styles.assetOverviewWrapper}>
<CollectibleOverview
navigation={navigation}
collectible={collectible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ const SelectQRAccounts = (props: ISelectQRAccountsProps) => {
onCheckColor={colors.background.default}
onFillColor={colors.primary.default}
onTintColor={colors.primary.default}
testID={'skip-backup-check'}
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
/>
<AccountDetails
index={item.index}
Expand Down
3 changes: 1 addition & 2 deletions app/components/Views/EnterPasswordSimple/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default class EnterPasswordSimple extends PureComponent {

return (
<SafeAreaView style={styles.mainWrapper}>
<View style={styles.wrapper} testID={'enter-password-screen'}>
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
<View style={styles.wrapper}>
<KeyboardAwareScrollView
style={styles.wrapper}
resetScrollToCoords={{ x: 0, y: 0 }}
Expand All @@ -142,7 +142,6 @@ export default class EnterPasswordSimple extends PureComponent {
<StyledButton
type={'blue'}
onPress={this.onPressConfirm}
testID={'submit-button'}
disabled={
!(
this.state.password !== '' ||
Expand Down
28 changes: 4 additions & 24 deletions app/components/Views/GasEducationCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,7 @@ const GasEducationCarousel = ({
if (key === 1) {
return (
<View style={styles.tab}>
<Text
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
noMargin
bold
black
style={styles.title}
testID={`carousel-screen-${key}`}
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
>
<Text noMargin bold black style={styles.title}>
{strings('fiat_on_ramp.gas_education_carousel.step_1.title', {
ticker: getTicker(ticker),
})}
Expand Down Expand Up @@ -283,13 +277,7 @@ const GasEducationCarousel = ({
if (key === 2) {
return (
<View style={styles.tab}>
<Text
noMargin
bold
black
style={styles.title}
testID={`carousel-screen-${key}`}
>
<Text noMargin bold black style={styles.title}>
{strings('fiat_on_ramp.gas_education_carousel.step_2.title')}
</Text>
<Text grey noMargin style={styles.subtitle}>
Expand All @@ -311,13 +299,7 @@ const GasEducationCarousel = ({
if (key === 3) {
return (
<View style={styles.tab}>
<Text
noMargin
bold
black
style={styles.title}
testID={`carousel-screen-${key}`}
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
>
<Text noMargin bold black style={styles.title}>
{strings('fiat_on_ramp.gas_education_carousel.step_3.title')}
</Text>
<Text noMargin bold style={styles.subheader}>
Expand All @@ -339,7 +321,7 @@ const GasEducationCarousel = ({
};

return (
<View style={baseStyles.flexGrow} testID={'gas-education-carousel-screen'}>
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
<View style={baseStyles.flexGrow}>
<OnboardingScreenWithBg screen={'carousel'}>
<ScrollView
style={baseStyles.flexGrow}
Expand All @@ -361,7 +343,6 @@ const GasEducationCarousel = ({
source={carousel_images[index]}
style={[styles.carouselImage, styles[imgStyleKey]]}
resizeMethod={'auto'}
testID={`carousel-${value}-image`}
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
/>
</View>
<View style={baseStyles.flexGrow}>
Expand All @@ -372,7 +353,6 @@ const GasEducationCarousel = ({
<StyledButton
type={'confirm'}
onPress={onPresGetStarted}
testID={'gas-education-fiat-on-ramp-start'}
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
>
{strings(
'fiat_on_ramp.gas_education_carousel.step_3.cta',
Expand Down
58 changes: 23 additions & 35 deletions app/components/Views/ImportFromSecretRecoveryPhrase/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@ import {
PASSCODE_DISABLED,
} from '../../../constants/storage';
import Routes from '../../../constants/navigation/Routes';
import generateTestId from '../../../../wdio/utils/generateTestId';
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
import {
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_INPUT_ID,
IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
IMPORT_FROM_SEED_SCREEN_SUBMIT_BUTTON_ID,
IMPORT_FROM_SEED_SCREEN_TITLE_ID,
IMPORT_FROM_SEED_SCREEN_NEW_PASSWORD_INPUT_ID,
IMPORT_FROM_SEED_SCREEN_PASSWORD_STRENGTH_ID,
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_CHECK_ICON_ID,
} from '../../../../wdio/screen-objects/testIDs/Screens/ImportFromSeedScreen.testIds';

import createStyles from './styles';
import { Authentication } from '../../../core';
import AUTHENTICATION_TYPE from '../../../constants/userProperties';
Expand All @@ -73,6 +64,7 @@ import {
} from '../../../util/authentication';
import navigateTermsOfUse from '../../../util/termsOfUse/termsOfUse';
import { ImportFromSeedSelectorsIDs } from '../../../../e2e/selectors/Onboarding/ImportFromSeed.selectors';
import { ChoosePasswordSelectorsIDs } from '../../../../e2e/selectors/Onboarding/ChoosePassword.selectors';

const MINIMUM_SUPPORTED_CLIPBOARD_VERSION = 9;

Expand Down Expand Up @@ -387,10 +379,9 @@ const ImportFromSecretRecoveryPhrase = ({
containerStyle={inputWidth}
inputContainerStyle={styles.padding}
placeholder={strings('import_from_seed.seed_phrase_placeholder')}
{...generateTestId(
Platform,
IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
)}
testID={
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID
}
placeholderTextColor={colors.text.muted}
returnKeyType="next"
autoCapitalize="none"
Expand Down Expand Up @@ -427,7 +418,7 @@ const ImportFromSecretRecoveryPhrase = ({
<View testID={ImportFromSeedSelectorsIDs.CONTAINER_ID}>
<Text
style={styles.title}
{...generateTestId(Platform, IMPORT_FROM_SEED_SCREEN_TITLE_ID)}
testID={ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_TITLE_ID}
>
{strings('import_from_seed.title')}
</Text>
Expand Down Expand Up @@ -510,11 +501,7 @@ const ImportFromSecretRecoveryPhrase = ({
<OutlinedTextField
style={styles.input}
containerStyle={inputWidth}
{...generateTestId(
Platform,
IMPORT_FROM_SEED_SCREEN_NEW_PASSWORD_INPUT_ID,
)}
testID={'create-password-first-input-field'}
testID={ChoosePasswordSelectorsIDs.NEW_PASSWORD_INPUT_ID}
placeholder={strings('import_from_seed.new_password')}
placeholderTextColor={colors.text.muted}
returnKeyType={'next'}
Expand All @@ -531,10 +518,9 @@ const ImportFromSecretRecoveryPhrase = ({
{(password !== '' && (
<Text
style={styles.passwordStrengthLabel}
{...generateTestId(
Platform,
IMPORT_FROM_SEED_SCREEN_PASSWORD_STRENGTH_ID,
)}
testID={
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_PASSWORD_STRENGTH_ID
}
>
{strings('choose_password.password_strength')}
<Text style={styles[`strength_${passwordStrengthWord}`]}>
Expand All @@ -552,11 +538,7 @@ const ImportFromSecretRecoveryPhrase = ({
<OutlinedTextField
style={styles.input}
containerStyle={inputWidth}
{...generateTestId(
Platform,
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_INPUT_ID,
)}
testID={'create-password-second-input-field'}
testID={ChoosePasswordSelectorsIDs.CONFIRM_PASSWORD_INPUT_ID}
onChangeText={onPasswordConfirmChange}
returnKeyType={'next'}
autoCapitalize="none"
Expand All @@ -576,10 +558,9 @@ const ImportFromSecretRecoveryPhrase = ({
name="check"
size={12}
color={colors.success.default}
{...generateTestId(
Platform,
IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_CHECK_ICON_ID,
)}
testID={
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_CONFIRM_PASSWORD_CHECK_ICON_ID
}
/>
) : null}
</View>
Expand All @@ -593,7 +574,12 @@ const ImportFromSecretRecoveryPhrase = ({
{renderSwitch()}

{!!error && (
<Text style={styles.errorMsg} testID={'invalid-seed-phrase'}>
<Text
style={styles.errorMsg}
testID={
ImportFromSeedSelectorsIDs.INVALID_SEED_PHRASE_PLACE_HOLDER_TEXT
}
>
{error}
</Text>
)}
Expand All @@ -602,7 +588,9 @@ const ImportFromSecretRecoveryPhrase = ({
<StyledButton
type={'blue'}
onPress={onPressImport}
testID={IMPORT_FROM_SEED_SCREEN_SUBMIT_BUTTON_ID}
testID={
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SUBMIT_BUTTON_ID
}
disabled={!(password !== '' && password === confirmPassword)}
>
{loading ? (
Expand Down
29 changes: 13 additions & 16 deletions app/components/Views/ImportPrivateKey/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
TextInput,
Text,
View,
Platform,
ActivityIndicator,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
Expand All @@ -19,13 +18,7 @@ import Device from '../../../util/device';
import { importAccountFromPrivateKey } from '../../../util/address';
import { useAppTheme } from '../../../util/theme';
import { createStyles } from './styles';
import generateTestId from '../../../../wdio/utils/generateTestId';
import {
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
IMPORT_ACCOUNT_SCREEN_ID,
IMPORT_PRIVATE_KEY_BUTTON_ID,
PRIVATE_KEY_INPUT_BOX_ID,
CLOSE_BUTTON_ON_IMPORT_ACCOUNT_SCREEN_ID,
} from '../../../../wdio/screen-objects/testIDs/Screens/ImportAccountScreen.testIds';
import { ImportAccountFromPrivateKeySelectorsIDs } from '../../../../e2e/selectors/ImportAccountFromPrivateKey.selectors';

/**
* View that's displayed the first time a user receives funds
Expand Down Expand Up @@ -126,22 +119,22 @@ const ImportPrivateKey = () => {
<KeyboardAwareScrollView
contentContainerStyle={styles.wrapper}
style={styles.topOverlay}
testID={'first-incoming-transaction-screen'}
resetScrollToCoords={{ x: 0, y: 0 }}
>
<View
style={styles.content}
{...generateTestId(Platform, IMPORT_ACCOUNT_SCREEN_ID)}
testID={
ImportAccountFromPrivateKeySelectorsIDs.IMPORT_ACCOUNT_SCREEN_ID
}
>
<TouchableOpacity onPress={dismiss} style={styles.navbarRightButton}>
<MaterialIcon
name="close"
size={15}
style={styles.closeIcon}
{...generateTestId(
Platform,
CLOSE_BUTTON_ON_IMPORT_ACCOUNT_SCREEN_ID,
)}
testID={
ImportAccountFromPrivateKeySelectorsIDs.CLOSE_BUTTON_ON_IMPORT_ACCOUNT_SCREEN_ID
}
/>
</TouchableOpacity>
<View style={styles.top}>
Expand Down Expand Up @@ -172,7 +165,9 @@ const ImportPrivateKey = () => {
multiline
style={[styles.input, inputWidth ? { width: inputWidth } : {}]}
onChangeText={setPrivateKey}
{...generateTestId(Platform, PRIVATE_KEY_INPUT_BOX_ID)}
testID={
ImportAccountFromPrivateKeySelectorsIDs.PRIVATE_KEY_INPUT_BOX_ID
}
blurOnSubmit
onSubmitEditing={() => goNext()}
returnKeyType={'next'}
Expand All @@ -195,7 +190,9 @@ const ImportPrivateKey = () => {
containerStyle={styles.button}
type={'confirm'}
onPress={() => goNext()}
{...generateTestId(Platform, IMPORT_PRIVATE_KEY_BUTTON_ID)}
testID={
ImportAccountFromPrivateKeySelectorsIDs.IMPORT_PRIVATE_KEY_BUTTON_ID
}
>
{loading ? (
<ActivityIndicator size="small" color={colors.primary.inverse} />
Expand Down
20 changes: 8 additions & 12 deletions app/components/Views/ImportPrivateKeySuccess/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
StyleSheet,
InteractionManager,
BackHandler,
Platform,
} from 'react-native';
import PropTypes from 'prop-types';
import { fontStyles } from '../../../styles/common';
Expand All @@ -17,11 +16,8 @@ import { strings } from '../../../../locales/i18n';
import Device from '../../../util/device';
import { ScreenshotDeterrent } from '../../UI/ScreenshotDeterrent';
import { ThemeContext, mockTheme } from '../../../util/theme';
import generateTestId from '../../../../wdio/utils/generateTestId';
sethkfman marked this conversation as resolved.
Show resolved Hide resolved
import {
IMPORT_SUCESS_SCREEN_ID,
IMPORT_SUCESS_SCREEN_CLOSE_BUTTON_ID,
} from '../../../../wdio/screen-objects/testIDs/Screens/ImportSuccessScreen.testIds';

import { ImportPrivateKeySuccessScreenSelectorsIDs } from '../../../../e2e/selectors/ImportPrivateKeySuccessScreen.selectors';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -122,19 +118,19 @@ class ImportPrivateKeySuccess extends PureComponent {
<ScrollView
contentContainerStyle={styles.wrapper}
style={styles.mainWrapper}
testID={'first-incoming-transaction-screen'}
>
<View
style={styles.content}
{...generateTestId(Platform, IMPORT_SUCESS_SCREEN_ID)}
testID={
ImportPrivateKeySuccessScreenSelectorsIDs.IMPORT_SUCESS_SCREEN_ID
}
>
<TouchableOpacity
onPress={this.dismiss}
style={styles.navbarRightButton}
{...generateTestId(
Platform,
IMPORT_SUCESS_SCREEN_CLOSE_BUTTON_ID,
)}
testID={
ImportPrivateKeySuccessScreenSelectorsIDs.IMPORT_SUCESS_SCREEN_CLOSE_BUTTON_ID
}
>
<MaterialIcon name="close" size={15} style={styles.closeIcon} />
</TouchableOpacity>
Expand Down
13 changes: 8 additions & 5 deletions e2e/pages/Onboarding/ImportWalletView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import TestHelpers from '../../helpers';

import { IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID } from '../../../wdio/screen-objects/testIDs/Screens/ImportFromSeedScreen.testIds';
import { ChoosePasswordSelectorsIDs } from '../../selectors/Onboarding/ChoosePassword.selectors';
import { ImportFromSeedSelectorsIDs } from '../../selectors/Onboarding/ImportFromSeed.selectors';

Expand All @@ -22,21 +21,25 @@ export default class ImportWalletView {
static async enterSecretRecoveryPhrase(secretRecoveryPhrase) {
if (device.getPlatform() === 'android') {
await TestHelpers.replaceTextInField(
IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
secretRecoveryPhrase,
);
await element(
by.id(IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID),
by.id(
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
),
).tapReturnKey();
} else {
await TestHelpers.typeTextAndHideKeyboard(
IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
secretRecoveryPhrase,
);
}
}
static async clearSecretRecoveryPhraseInputBox() {
await TestHelpers.clearField(IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID);
await TestHelpers.clearField(
ImportFromSeedSelectorsIDs.IMPORT_FROM_SEED_SCREEN_SEED_PHRASE_INPUT_ID,
);
}

// Assertions
Expand Down
7 changes: 7 additions & 0 deletions e2e/selectors/ImportAccountFromPrivateKey.selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// eslint-disable-next-line import/prefer-default-export
export const ImportAccountFromPrivateKeySelectorsIDs = {
IMPORT_ACCOUNT_SCREEN_ID: 'import-account-screen',
PRIVATE_KEY_INPUT_BOX_ID: 'input-private-key',
IMPORT_PRIVATE_KEY_BUTTON_ID: 'import-button',
CLOSE_BUTTON_ON_IMPORT_ACCOUNT_SCREEN_ID: 'close-button-on-account-screen',
};
Loading
Loading