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: 1453 refactor modal pages batch 3 #8909

Merged
merged 24 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
26cb807
Refactor the third 5 page files from Modals folder to follow page obj…
SamuelSalas Jan 8, 2024
4aaed1f
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 3, 2024
5275419
Fix flaky test
SamuelSalas Mar 5, 2024
9fbd63a
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 5, 2024
97c6570
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 11, 2024
e13bf98
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 13, 2024
49d3838
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 14, 2024
c5e0b46
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 14, 2024
671be38
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 14, 2024
6753d1d
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 14, 2024
7f0ad72
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Mar 19, 2024
fa0bfd3
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 17, 2024
bd32847
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 17, 2024
f8eae0b
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 18, 2024
b3c74dd
Unify changeNetworkTo method
SamuelSalas Apr 18, 2024
dc47e3d
Rename to testNetToggle. Comments added to custom network matcher on ios
SamuelSalas Apr 18, 2024
2655427
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 18, 2024
ed0f0b8
Fix unit test error
SamuelSalas Apr 18, 2024
79819b3
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 20, 2024
c745381
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 22, 2024
5363983
Fix flaky tests
SamuelSalas Apr 24, 2024
d019f96
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 24, 2024
84834d1
Merge branch 'main' into test/1453-refactor-modal-pages-batch-3
SamuelSalas Apr 25, 2024
86d2a37
TODO comment added to re add external swap steps
SamuelSalas Apr 25, 2024
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
15 changes: 4 additions & 11 deletions app/components/UI/NetworkInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
/* eslint-disable no-mixed-spaces-and-tabs */
import React, { useMemo } from 'react';
import { View, Text, StyleSheet, Platform } from 'react-native';
import { View, Text, StyleSheet } from 'react-native';
import StyledButton from '../StyledButton';
import { strings } from '../../../../locales/i18n';
import { RPC } from '../../../constants/network';
import { connect, useSelector } from 'react-redux';
import Description from './InfoDescription';
import { useTheme } from '../../../util/theme';
import {
NETWORK_EDUCATION_MODAL_CONTAINER_ID,
NETWORK_EDUCATION_MODAL_NETWORK_NAME_ID,
} from '../../../../wdio/screen-objects/testIDs/Components/NetworkEducationModalTestIds';
import { fontStyles } from '../../../styles/common';
import { isTokenDetectionSupportedForNetwork } from '@metamask/assets-controllers/dist/assetsUtil';
import { NETWORK_EDUCATION_MODAL_CLOSE_BUTTON } from '../../../../wdio/screen-objects/testIDs/Screens/NetworksScreen.testids.js';
Expand All @@ -23,7 +19,7 @@ import {
import Avatar, {
AvatarVariant,
} from '../../../component-library/components/Avatars/Avatar';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { NetworkEducationModalSelectorsIDs } from '../../../../e2e/selectors/Modals/NetworkEducationModal.selectors';

const createStyles = (colors: {
background: { default: string };
Expand Down Expand Up @@ -148,7 +144,7 @@ const NetworkInfo = (props: NetworkInfoProps) => {
<View style={styles.wrapper}>
<View
style={styles.modalContentView}
{...generateTestId(Platform, NETWORK_EDUCATION_MODAL_CONTAINER_ID)}
testID={NetworkEducationModalSelectorsIDs.CONTAINER}
>
<Text style={styles.title}>
{strings('network_information.switched_network')}
Expand All @@ -162,10 +158,7 @@ const NetworkInfo = (props: NetworkInfoProps) => {
/>
<Text
style={styles.tokenText}
{...generateTestId(
Platform,
NETWORK_EDUCATION_MODAL_NETWORK_NAME_ID,
)}
testID={NetworkEducationModalSelectorsIDs.NETWORK_NAME}
>
{networkName}
</Text>
Expand Down
21 changes: 6 additions & 15 deletions app/components/UI/OnboardingWizard/Coachmark/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Animated, Platform, StyleSheet, Text, View } from 'react-native';
import { Animated, StyleSheet, Text, View } from 'react-native';
import {
colors as importedColors,
fontStyles,
Expand All @@ -20,13 +20,7 @@ import {
ButtonWidthTypes,
} from '../../../../component-library/components/Buttons/Button';
import Button from '../../../../component-library/components/Buttons/Button/Button';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import {
ONBOARDING_WIZARD_BACK_BUTTON,
ONBOARDING_WIZARD_NEXT_GOT_IT_BUTTON,
ONBOARDING_WIZARD_STEP_1_NO_THANKS_ID,
ONBOARDING_WIZARD_STEP_1_TAKE_THE_TOUR_ID,
} from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -336,7 +330,7 @@ export default class Coachmark extends PureComponent {
containerStyle={[styles.progressButton, styles.rightProgessButton]}
type={'inverse'}
onPress={this.onNext}
testID={ONBOARDING_WIZARD_NEXT_GOT_IT_BUTTON}
testID={OnboardingWizardModalSelectorsIDs.GOT_IT_BUTTON}
>
{strings('onboarding_wizard_new.coachmark.progress_next')}
</StyledButton>
Expand All @@ -361,7 +355,7 @@ export default class Coachmark extends PureComponent {
label={strings('onboarding_wizard_new.coachmark.action_back')}
style={styles.actionButtonPrimary}
variant={ButtonVariants.Primary}
{...generateTestId(Platform, ONBOARDING_WIZARD_STEP_1_NO_THANKS_ID)}
testID={OnboardingWizardModalSelectorsIDs.NO_THANKS_BUTTON}
/>

<Button
Expand All @@ -371,10 +365,7 @@ export default class Coachmark extends PureComponent {
label={strings('onboarding_wizard_new.coachmark.action_next')}
variant={ButtonVariants.Secondary}
style={styles.actionButtonSecondary}
{...generateTestId(
Platform,
ONBOARDING_WIZARD_STEP_1_TAKE_THE_TOUR_ID,
)}
testID={OnboardingWizardModalSelectorsIDs.TAKE_TOUR_BUTTON}
/>
</View>
);
Expand Down Expand Up @@ -410,7 +401,7 @@ export default class Coachmark extends PureComponent {
size={IconSize.Sm}
onPress={this.onBack}
iconColorOverride={colors.primary.inverse}
{...generateTestId(Platform, ONBOARDING_WIZARD_BACK_BUTTON)}
testID={OnboardingWizardModalSelectorsIDs.BACK_BUTTON}
/>
) : (
<View />
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/OnboardingWizard/Step1/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { View, Text, StyleSheet, Platform } from 'react-native';
import { View, Text, StyleSheet } from 'react-native';
import Coachmark from '../Coachmark';
import Device from '../../../../util/device';
import setOnboardingWizardStep from '../../../../actions/wizard';
Expand All @@ -13,8 +13,7 @@ import {
} from '../../../../core/Analytics';

import { ThemeContext, mockTheme } from '../../../../util/theme';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_STEP_1_CONTAINER_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { withMetricsAwareness } from '../../../../components/hooks/useMetrics';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -90,7 +89,7 @@ class Step1 extends PureComponent {
return (
<View
style={styles.main}
{...generateTestId(Platform, ONBOARDING_WIZARD_STEP_1_CONTAINER_ID)}
testID={OnboardingWizardModalSelectorsIDs.STEP_ONE_CONTAINER}
>
<View style={styles.coachmarkContainer}>
<Coachmark
Expand Down
10 changes: 3 additions & 7 deletions app/components/UI/OnboardingWizard/Step2/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
import Coachmark from '../Coachmark';
import setOnboardingWizardStep from '../../../../actions/wizard';
import { strings } from '../../../../../locales/i18n';
Expand All @@ -11,8 +11,7 @@ import {
ONBOARDING_WIZARD_STEP_DESCRIPTION,
} from '../../../../core/Analytics';
import { mockTheme, ThemeContext } from '../../../../util/theme';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_SECOND_STEP_CONTENT_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { withMetricsAwareness } from '../../../../components/hooks/useMetrics';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -121,10 +120,7 @@ class Step2 extends PureComponent {
<View style={dynamicOnboardingStyles.contentContainer}>
<Text
style={dynamicOnboardingStyles.content}
{...generateTestId(
Platform,
ONBOARDING_WIZARD_SECOND_STEP_CONTENT_ID,
)}
testID={OnboardingWizardModalSelectorsIDs.STEP_TWO_CONTAINER}
>
{strings('onboarding_wizard_new.step2.content1')}
</Text>
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/OnboardingWizard/Step3/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native';
import { Dimensions, StyleSheet, Text, View } from 'react-native';
import Coachmark from '../Coachmark';
import setOnboardingWizardStep from '../../../../actions/wizard';
import { strings } from '../../../../../locales/i18n';
Expand All @@ -11,14 +11,13 @@ import {
ONBOARDING_WIZARD_STEP_DESCRIPTION,
} from '../../../../core/Analytics';
import { useTheme } from '../../../../util/theme';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_THIRD_STEP_CONTENT_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { selectCurrentCurrency } from '../../../../selectors/currencyRateController';
import { selectAccounts } from '../../../../selectors/accountTrackerController';
import {
selectIdentities,
selectSelectedAddress,
} from '../../../../selectors/preferencesController';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { useMetrics } from '../../../../components/hooks/useMetrics';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -94,7 +93,7 @@ const Step3 = ({ setOnboardingWizardStep, coachmarkRef, onClose }) => {
<View style={dynamicOnboardingStyles.contentContainer}>
<Text
style={dynamicOnboardingStyles.content}
{...generateTestId(Platform, ONBOARDING_WIZARD_THIRD_STEP_CONTENT_ID)}
testID={OnboardingWizardModalSelectorsIDs.STEP_THREE_CONTAINER}
>
{strings('onboarding_wizard_new.step3.content1')}
</Text>
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/OnboardingWizard/Step4/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native';
import { Dimensions, StyleSheet, Text, View } from 'react-native';
import Coachmark from '../Coachmark';
import setOnboardingWizardStep from '../../../../actions/wizard';
import { strings } from '../../../../../locales/i18n';
Expand All @@ -11,8 +11,7 @@ import {
ONBOARDING_WIZARD_STEP_DESCRIPTION,
} from '../../../../core/Analytics';
import { useTheme } from '../../../../util/theme';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_FOURTH_STEP_CONTENT_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { useMetrics } from '../../../../components/hooks/useMetrics';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -82,7 +81,7 @@ const Step4 = (props) => {
<View style={dynamicOnboardingStyles.contentContainer}>
<Text
style={dynamicOnboardingStyles.content}
{...generateTestId(Platform, ONBOARDING_WIZARD_FOURTH_STEP_CONTENT_ID)}
testID={OnboardingWizardModalSelectorsIDs.STEP_FOUR_CONTAINER}
>
{strings('onboarding_wizard_new.step4.content1')}
</Text>
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/OnboardingWizard/Step5/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native';
import { Dimensions, StyleSheet, Text, View } from 'react-native';
import { colors as importedColors } from '../../../../styles/common';
import Coachmark from '../Coachmark';
import setOnboardingWizardStep from '../../../../actions/wizard';
Expand All @@ -13,8 +13,7 @@ import {
} from '../../../../core/Analytics';
import { useTheme } from '../../../../util/theme';
import { createBrowserNavDetails } from '../../../Views/Browser';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_FIFTH_STEP_CONTENT_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { useMetrics } from '../../../../components/hooks/useMetrics';

const WIDTH = Dimensions.get('window').width;
Expand Down Expand Up @@ -81,7 +80,7 @@ const Step5 = (props) => {
<View style={dynamicOnboardingStyles.contentContainer}>
<Text
style={dynamicOnboardingStyles.content}
{...generateTestId(Platform, ONBOARDING_WIZARD_FIFTH_STEP_CONTENT_ID)}
testID={OnboardingWizardModalSelectorsIDs.STEP_FIVE_CONTAINER}
>
{strings('onboarding_wizard_new.step5.content1')}
</Text>
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/OnboardingWizard/Step6/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, View } from 'react-native';
import Coachmark from '../Coachmark';
import setOnboardingWizardStep from '../../../../actions/wizard';
import { strings } from '../../../../../locales/i18n';
Expand All @@ -13,8 +13,7 @@ import {
} from '../../../../core/Analytics';
import { useTheme } from '../../../../util/theme';
import Routes from '../../../../constants/navigation/Routes';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import { ONBOARDING_WIZARD_SIXTH_STEP_CONTENT_ID } from '../../../../../wdio/screen-objects/testIDs/Components/OnboardingWizard.testIds';
import { OnboardingWizardModalSelectorsIDs } from '../../../../../e2e/selectors/Modals/OnboardingWizardModal.selectors';
import { useMetrics } from '../../../../components/hooks/useMetrics';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -81,7 +80,7 @@ const Step6 = (props) => {
<View style={dynamicOnboardingStyles.contentContainer}>
<Text
style={dynamicOnboardingStyles.content}
{...generateTestId(Platform, ONBOARDING_WIZARD_SIXTH_STEP_CONTENT_ID)}
testID={OnboardingWizardModalSelectorsIDs.STEP_SIX_CONTAINER}
>
{strings('onboarding_wizard_new.step6.content1')}
</Text>
Expand Down
15 changes: 5 additions & 10 deletions app/components/Views/NetworkSelector/NetworkSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Third party dependencies.
import React, { useRef } from 'react';
import { Platform, Switch, View } from 'react-native';
import { Switch, View } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import images from 'images/image-icons';
import { useNavigation } from '@react-navigation/native';
Expand Down Expand Up @@ -39,12 +39,7 @@ import {
import Engine from '../../../core/Engine';
import { MetaMetricsEvents } from '../../../core/Analytics';
import Routes from '../../../constants/navigation/Routes';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { ADD_NETWORK_BUTTON } from '../../../../wdio/screen-objects/testIDs/Screens/NetworksScreen.testids';
import {
NETWORK_SCROLL_ID,
NETWORK_TEST_SWITCH_ID,
} from '../../../../wdio/screen-objects/testIDs/Components/NetworkListModal.TestIds';
import { NetworkListModalSelectorsIDs } from '../../../../e2e/selectors/Modals/NetworkListModal.selectors';
import { useTheme } from '../../../util/theme';
import Text from '../../../component-library/components/Texts/Text/Text';
import {
Expand Down Expand Up @@ -233,7 +228,7 @@ const NetworkSelector = () => {
}}
thumbColor={theme.brandColors.white['000']}
ios_backgroundColor={colors.border.muted}
{...generateTestId(Platform, NETWORK_TEST_SWITCH_ID)}
testID={NetworkListModalSelectorsIDs.TEST_SWITCH}
disabled={isTestNet(providerConfig.chainId)}
/>
</View>
Expand All @@ -242,7 +237,7 @@ const NetworkSelector = () => {
return (
<BottomSheet ref={sheetRef}>
<SheetHeader title={strings('networks.select_network')} />
<ScrollView {...generateTestId(Platform, NETWORK_SCROLL_ID)}>
<ScrollView testID={NetworkListModalSelectorsIDs.SCROLL}>
{renderMainnet()}
{renderLineaMainnet()}
{renderRpcNetworks()}
Expand All @@ -257,7 +252,7 @@ const NetworkSelector = () => {
width={ButtonWidthTypes.Full}
size={ButtonSize.Lg}
style={styles.addNetworkButton}
{...generateTestId(Platform, ADD_NETWORK_BUTTON)}
testID={NetworkListModalSelectorsIDs.ADD_BUTTON}
/>
</BottomSheet>
);
Expand Down
5 changes: 5 additions & 0 deletions e2e/pages/Settings/Contacts/AddContactView.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class AddContactView {
return Matchers.getElementByID(AddContactViewSelectorsIDs.NAME_INPUT);
}

get memoLabel() {
return Matchers.getElementByText(AddContactViewSelectorsText.MEMO);
}

get memoInput() {
return Matchers.getElementByID(AddContactViewSelectorsIDs.MEMO_INPUT);
}
Expand Down Expand Up @@ -66,6 +70,7 @@ class AddContactView {

async typeInMemo(memo) {
await Gestures.replaceTextInField(this.memoInput, memo);
await Gestures.waitAndTap(this.memoLabel);
}

async typeInAddress(address) {
Expand Down
3 changes: 2 additions & 1 deletion e2e/pages/modals/ConnectModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import {
} from '../../selectors/Modals/ConnectAccountModal.selectors';
import Matchers from '../../utils/Matchers';
import Gestures from '../../utils/Gestures';
import { CommonSelectorsIDs } from '../../selectors/Common.selectors';

class ConnectModal {
get container() {
return Matchers.getElementByID(ConnectAccountModalSelectorsIDs.CONTAINER);
}

get connectButton() {
return Matchers.getElementByID(ConnectAccountModalSelectorsIDs.CONTAINER);
return Matchers.getElementByID(CommonSelectorsIDs.CONNECT_BUTTON);
}

get connectAccountsButton() {
Expand Down
Loading
Loading