From dbeaf47ba3e5123b45fc959037f6f3d211f7ff06 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:08:23 -0400 Subject: [PATCH 01/17] SRP reveal quiz test setup --- .detoxrc.js | 2 +- .../Views/Quiz/QuizContent/QuizContent.tsx | 1 + app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 4 + app/components/Views/Quiz/types.ts | 1 + .../RevealSecretRecoveryPhrase.js | 106 ++++++++++++++++++ .../SecurityAndPrivacyView.js | 10 ++ .../RevealSeedView.selectors.js | 36 ++++++ .../reveal-secret-recovery-phrase.spec.js | 40 +++++++ index.js | 99 ++++++++-------- 9 files changed, 249 insertions(+), 50 deletions(-) create mode 100644 e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js diff --git a/.detoxrc.js b/.detoxrc.js index 67ddaec1a2f..d388aea1d66 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -76,7 +76,7 @@ module.exports = { 'android.emulator': { type: 'android.emulator', device: { - avdName: 'Pixel_5_Pro_API_30', + avdName: 'Pixel_5_API_30', }, }, }, diff --git a/app/components/Views/Quiz/QuizContent/QuizContent.tsx b/app/components/Views/Quiz/QuizContent/QuizContent.tsx index 16716a07993..146ea356b47 100644 --- a/app/components/Views/Quiz/QuizContent/QuizContent.tsx +++ b/app/components/Views/Quiz/QuizContent/QuizContent.tsx @@ -67,6 +67,7 @@ const QuizContent = ({ onPress={btn.onPress} label={btn.label} style={styles.button} + testID={btn.testID} /> ))} diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index c98f937b728..0b5ac3cd5a5 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -19,6 +19,8 @@ import { QuizContent } from '../QuizContent'; import stylesheet from './styles'; import { useMetrics } from '../../../../components/hooks/useMetrics'; +import { RevealSeedViewSelectorsIDs } from '../../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; + const introductionImg = require('../../../../images/reveal-srp.png'); const SRPQuiz = () => { @@ -91,6 +93,8 @@ const SRPQuiz = () => { trackEvent(MetaMetricsEvents.SRP_REVEAL_START_CTA_SELECTED, {}); setStage(QuizStage.questionOne); }, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID, variant: ButtonVariants.Primary, }, { diff --git a/app/components/Views/Quiz/types.ts b/app/components/Views/Quiz/types.ts index e14e9caca6c..d041bcb5832 100644 --- a/app/components/Views/Quiz/types.ts +++ b/app/components/Views/Quiz/types.ts @@ -22,6 +22,7 @@ export interface IQuizInformationProps { onPress: () => void; label: string; variant: ButtonVariants; + testID?: string; }[]; dismiss: () => void; header?: string; diff --git a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js index f745f2434ef..ce5d8348e3a 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js @@ -9,6 +9,108 @@ class RevealSecretRecoveryPhrase { ); } + get getStarted() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID, + ); + } + + get quizContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID, + ); + } + + get learnMoreButton() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID, + ); + } + + get questionOneContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID, + ); + } + + get questionOneWrongAnswer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID, + ); + } + + get responseOneWrongContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID, + ); + } + + get tryAgainOne() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID, + ); + } + + get questionOneRightAnswer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID, + ); + } + + get questionOneRightContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_CONTAINER_ID, + ); + } + + get continueOne() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID, + ); + } + + get questionTwoContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_CONTAINER_ID, + ); + } + + get questionTwoWrongAnswer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID, + ); + } + + get responseTwoWrongContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_TWO_WRONG_CONTAINER_ID, + ); + } + + get tryAgainTwo() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID, + ); + } + + get questionTwoRightAnswer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID, + ); + } + + get questionTwoRightContainer() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_CONTAINER_ID, + ); + } + + get continueTwo() { + return Matchers.getElementByID( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID, + ); + } + get passwordInput() { return Matchers.getElementByID(RevealSeedViewSelectorsIDs.PASSWORD_INPUT); } @@ -34,6 +136,10 @@ class RevealSecretRecoveryPhrase { async enterPassword(password) { await Gestures.typeTextAndHideKeyboard(this.passwordInput, password); } + + async tapGetStarted() { + await Gestures.waitAndTap(this.getStarted); + } } export default new RevealSecretRecoveryPhrase(); diff --git a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js index ad71a190f6a..328a946c89b 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js @@ -13,6 +13,12 @@ class SecurityAndPrivacy { ); } + get revealSecretRecoveryPhraseButton() { + return Matchers.getElementByID( + SecurityPrivacyViewSelectorsIDs.REVEAL_SEED_BUTTON, + ); + } + get deleteWalletButton() { return device.getPlatform() === 'ios' ? Matchers.getElementByID(SECURITY_PRIVACY_DELETE_WALLET_BUTTON) @@ -70,6 +76,10 @@ class SecurityAndPrivacy { ); } + async tapRevealSecretRecoveryPhraseButton() { + await Gestures.waitAndTap(this.revealSecretRecoveryPhraseButton); + } + async tapChangePasswordButton() { await Gestures.waitAndTap(this.changePasswordButton); } diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index bd080916fc1..6dc14ab0577 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -1,6 +1,42 @@ // eslint-disable-next-line import/prefer-default-export export const RevealSeedViewSelectorsIDs = { SECRET_RECOVERY_PHRASE_CONTAINER_ID: 'reveal-private-credential-screen', + + SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID: 'security-quiz-container', + SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID: 'get-started-button', + // SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID: + // 'security-quiz-learn-more-button', + + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID: + // 'security-quiz-question-one-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: + // 'security-quiz-question-one-wrong-answer', + // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID: + // 'security-quiz-question-one-wrong-answer-response-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID: + // 'security-quiz-question-one-wrong-answer-try-again', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID: + // 'security-quiz-question-one-right-answer', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_CONTAINER_ID: + // 'security-quiz-question-one-right-answer-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID: + // 'security-quiz-question-one-right-continue', + + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_CONTAINER_ID: + // 'security-quiz-question-two-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID: + // 'security-quiz-question-two-wrong-answer', + // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_TWO_WRONG_CONTAINER_ID: + // 'security-quiz-question-two-wrong-answer-response-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID: + // 'security-quiz-question-two-wrong-answer-try-again', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID: + // 'security-quiz-question-two-right-answer', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_CONTAINER_ID: + // 'security-quiz-question-two-right-answer-container', + // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID: + // 'security-quiz-question-two-right-continue', + PASSWORD_INPUT: 'login-password-input', PASSWORD_WARNING_ID: 'password-warning', REVEAL_SECRET_RECOVERY_PHRASE_TOUCHABLE_BOX_ID: diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js new file mode 100644 index 00000000000..13cd2fc26a4 --- /dev/null +++ b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js @@ -0,0 +1,40 @@ +'use strict'; + +import { SmokeAccounts } from '../../tags'; +import TestHelpers from '../../helpers'; +import { loginToApp } from '../../viewHelper'; + +import TabBarComponent from '../../pages/TabBarComponent'; +import SettingsView from '../../pages/Settings/SettingsView.js'; +import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; +import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; +import RevealSeedViewSelectorsIDs from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; + +import FixtureBuilder from '../../fixtures/fixture-builder'; +import { + withFixtures, + defaultGanacheOptions, +} from '../../fixtures/fixture-helper'; +// import Assertions from '../../utils/Assertions'; + +describe(SmokeAccounts('reveal secret recovery phrase'), () => { + it('completes quiz after wrong answers', async () => { + await withFixtures( + { + fixture: new FixtureBuilder().withGanacheNetwork().build(), + restartDevice: true, + completedOnboarding: true, + ganacheOptions: defaultGanacheOptions, + }, + async () => { + await loginToApp(); + + // Navigate to the settings + await TabBarComponent.tapSettings(); + await SettingsView.tapSecurityAndPrivacy(); + await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); + await RevealSecretRecoveryPhrase.tapGetStarted(); + }, + ); + }); +}); diff --git a/index.js b/index.js index 69379d6fe6b..2449d91c598 100644 --- a/index.js +++ b/index.js @@ -26,55 +26,56 @@ import { isNotificationsFeatureEnabled } from './app/util/notifications/methods' // List of warnings that we're ignoring -LogBox.ignoreLogs([ - '{}', - // Uncomment the below lines (21 and 22) to run browser-tests.spec.js in debug mode - // in e2e tests until issue https://github.com/MetaMask/metamask-mobile/issues/1395 is resolved - //"Error in RPC response", - // 'User rejected account access', - "Can't perform a React state update", - 'Error evaluating injectedJavaScript', - 'createErrorFromErrorData', - 'Encountered an error loading page', - 'Error handling userAuthorizedUpdate', - 'MaxListenersExceededWarning', - 'Expected delta of 0 for the fields', - 'The network request was invalid', - 'Require cycle', - 'ListView is deprecated', - 'WebView has been extracted from react-native core', - 'Exception was previously raised by watchStore', - 'StateUpdateController', - 'this.web3.eth', - 'collectibles.map', - 'Warning: bind(): You are binding a component method to the component', - 'AssetsDectionController._callee', - 'Accessing view manager configs directly off', - 'Function components cannot be given refs.', - 'Task orphaned for request', - 'Module RNOS requires', - 'use RCT_EXPORT_MODULE', - 'Setting a timer for a long period of time', - 'Did not receive response to shouldStartLoad in time', - 'startLoadWithResult invoked with invalid', - 'RCTBridge required dispatch_sync', - 'Remote debugger is in a background tab', - "Can't call setState (or forceUpdate) on an unmounted component", - 'No stops in gradient', - "Cannot read property 'hash' of null", - 'componentWillUpdate', - 'componentWillReceiveProps', - 'getNode()', - 'Non-serializable values were found in the navigation state.', // We are not saving navigation state so we can ignore this - 'new NativeEventEmitter', // New libraries have not yet implemented native methods to handle warnings (https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir) - 'EventEmitter.removeListener', - 'Module TcpSockets requires main queue setup', - 'Module RCTSearchApiManager requires main queue setup', - 'PushNotificationIOS has been extracted', // RNC PushNotification iOS issue - https://github.com/react-native-push-notification/ios/issues/43 - "ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.", - 'ReactImageView: Image source "null"', - 'Warning: componentWillReceiveProps has been renamed', -]); +LogBox.ignoreAllLogs(); +// LogBox.ignoreLogs([ +// '{}', +// // Uncomment the below lines (21 and 22) to run browser-tests.spec.js in debug mode +// // in e2e tests until issue https://github.com/MetaMask/metamask-mobile/issues/1395 is resolved +// //"Error in RPC response", +// // 'User rejected account access', +// "Can't perform a React state update", +// 'Error evaluating injectedJavaScript', +// 'createErrorFromErrorData', +// 'Encountered an error loading page', +// 'Error handling userAuthorizedUpdate', +// 'MaxListenersExceededWarning', +// 'Expected delta of 0 for the fields', +// 'The network request was invalid', +// 'Require cycle', +// 'ListView is deprecated', +// 'WebView has been extracted from react-native core', +// 'Exception was previously raised by watchStore', +// 'StateUpdateController', +// 'this.web3.eth', +// 'collectibles.map', +// 'Warning: bind(): You are binding a component method to the component', +// 'AssetsDectionController._callee', +// 'Accessing view manager configs directly off', +// 'Function components cannot be given refs.', +// 'Task orphaned for request', +// 'Module RNOS requires', +// 'use RCT_EXPORT_MODULE', +// 'Setting a timer for a long period of time', +// 'Did not receive response to shouldStartLoad in time', +// 'startLoadWithResult invoked with invalid', +// 'RCTBridge required dispatch_sync', +// 'Remote debugger is in a background tab', +// "Can't call setState (or forceUpdate) on an unmounted component", +// 'No stops in gradient', +// "Cannot read property 'hash' of null", +// 'componentWillUpdate', +// 'componentWillReceiveProps', +// 'getNode()', +// 'Non-serializable values were found in the navigation state.', // We are not saving navigation state so we can ignore this +// 'new NativeEventEmitter', // New libraries have not yet implemented native methods to handle warnings (https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir) +// 'EventEmitter.removeListener', +// 'Module TcpSockets requires main queue setup', +// 'Module RCTSearchApiManager requires main queue setup', +// 'PushNotificationIOS has been extracted', // RNC PushNotification iOS issue - https://github.com/react-native-push-notification/ios/issues/43 +// "ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.", +// 'ReactImageView: Image source "null"', +// 'Warning: componentWillReceiveProps has been renamed', +// ]); const IGNORE_BOXLOGS_DEVELOPMENT = process.env.IGNORE_BOXLOGS_DEVELOPMENT; // Ignore box logs, useful for QA testing in development builds From 7e4ce0b53b14e1cb867f811a3e7a026d54e573fe Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:21:42 -0400 Subject: [PATCH 02/17] add question one --- app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 2 ++ .../SecurityAndPrivacy/RevealSecretRecoveryPhrase.js | 4 ++++ .../SecurityAndPrivacy/RevealSeedView.selectors.js | 8 ++++---- e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index 0b5ac3cd5a5..7e185871f51 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -121,6 +121,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.question_one.wrong_answer'), onPress: () => setStage(QuizStage.wrongAnswerQuestionOne), variant: ButtonVariants.Secondary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID, }, { label: strings('srp_security_quiz.question_one.right_answer'), diff --git a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js index ce5d8348e3a..dcb9693ae3e 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js @@ -140,6 +140,10 @@ class RevealSecretRecoveryPhrase { async tapGetStarted() { await Gestures.waitAndTap(this.getStarted); } + + async tapQuestionOneWrongAnswer() { + await Gestures.waitAndTap(this.questionOneWrongAnswer); + } } export default new RevealSecretRecoveryPhrase(); diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index 6dc14ab0577..9cbd87c7f5a 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -7,10 +7,10 @@ export const RevealSeedViewSelectorsIDs = { // SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID: // 'security-quiz-learn-more-button', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID: - // 'security-quiz-question-one-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: - // 'security-quiz-question-one-wrong-answer', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID: + 'security-quiz-question-one-container', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: + 'security-quiz-question-one-wrong-answer', // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID: // 'security-quiz-question-one-wrong-answer-response-container', // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID: diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js index 13cd2fc26a4..e24c7e6fb87 100644 --- a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js +++ b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js @@ -34,6 +34,7 @@ describe(SmokeAccounts('reveal secret recovery phrase'), () => { await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); await RevealSecretRecoveryPhrase.tapGetStarted(); + await RevealSecretRecoveryPhrase.tapQuestionOneWrongAnswer(); }, ); }); From 9e677a3e6c6a2c448f6af7cd2b63f1f2b5c70677 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:24:29 -0400 Subject: [PATCH 03/17] assert wrong answer response --- app/components/Views/Quiz/QuizContent/QuizContent.tsx | 1 + app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 2 ++ app/components/Views/Quiz/types.ts | 1 + .../SecurityAndPrivacy/RevealSecretRecoveryPhrase.js | 4 ++-- .../SecurityAndPrivacy/RevealSeedView.selectors.js | 4 ++-- e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js | 9 ++++++++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/components/Views/Quiz/QuizContent/QuizContent.tsx b/app/components/Views/Quiz/QuizContent/QuizContent.tsx index 146ea356b47..f6846a31d67 100644 --- a/app/components/Views/Quiz/QuizContent/QuizContent.tsx +++ b/app/components/Views/Quiz/QuizContent/QuizContent.tsx @@ -49,6 +49,7 @@ const QuizContent = ({ {title.content} diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index 7e185871f51..01561244ef9 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -179,6 +179,8 @@ const SRPQuiz = () => { title={{ content: strings('srp_security_quiz.question_one.wrong_answer_title'), style: styles.wrongText, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, }} content={strings( 'srp_security_quiz.question_one.wrong_answer_description', diff --git a/app/components/Views/Quiz/types.ts b/app/components/Views/Quiz/types.ts index d041bcb5832..da74b73a051 100644 --- a/app/components/Views/Quiz/types.ts +++ b/app/components/Views/Quiz/types.ts @@ -17,6 +17,7 @@ export interface IQuizInformationProps { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any style?: any; + testID?: string; }; buttons: { onPress: () => void; diff --git a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js index dcb9693ae3e..53cd21b6c6f 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js @@ -27,9 +27,9 @@ class RevealSecretRecoveryPhrase { ); } - get questionOneContainer() { + get questionOneWrongTitle() { return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID, + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, ); } diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index 9cbd87c7f5a..c0c9811e4fe 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -7,10 +7,10 @@ export const RevealSeedViewSelectorsIDs = { // SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID: // 'security-quiz-learn-more-button', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_CONTAINER_ID: - 'security-quiz-question-one-container', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: 'security-quiz-question-one-wrong-answer', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE: + 'security-quiz-question-one-wrong-title', // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID: // 'security-quiz-question-one-wrong-answer-response-container', // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID: diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js index e24c7e6fb87..d108ef45251 100644 --- a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js +++ b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js @@ -8,7 +8,7 @@ import TabBarComponent from '../../pages/TabBarComponent'; import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; -import RevealSeedViewSelectorsIDs from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; +import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -19,6 +19,9 @@ import { describe(SmokeAccounts('reveal secret recovery phrase'), () => { it('completes quiz after wrong answers', async () => { + const wrongQuestionOneTitle = + 'Wrong! No one can help get your Secret Recovery Phrase back'; + await withFixtures( { fixture: new FixtureBuilder().withGanacheNetwork().build(), @@ -35,6 +38,10 @@ describe(SmokeAccounts('reveal secret recovery phrase'), () => { await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); await RevealSecretRecoveryPhrase.tapGetStarted(); await RevealSecretRecoveryPhrase.tapQuestionOneWrongAnswer(); + await TestHelpers.checkIfHasText( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, + wrongQuestionOneTitle, + ); }, ); }); From a9545720eb837c2185e6fed692851c3edff82d39 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:50:57 -0400 Subject: [PATCH 04/17] advance thru quiz to tap and hold --- app/components/UI/ButtonReveal/index.tsx | 4 +- app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 20 ++++++++ .../RevealPrivateCredential.tsx | 9 ++-- .../RevealSecretRecoveryPhrase.js | 38 +++++++++++++- .../RevealSeedView.selectors.js | 44 ++++++++-------- .../reveal-secret-recovery-phrase.spec.js | 51 ++++++++++++++++--- 6 files changed, 129 insertions(+), 37 deletions(-) diff --git a/app/components/UI/ButtonReveal/index.tsx b/app/components/UI/ButtonReveal/index.tsx index 06ef8ecdf29..7b6cf871fe8 100644 --- a/app/components/UI/ButtonReveal/index.tsx +++ b/app/components/UI/ButtonReveal/index.tsx @@ -85,9 +85,10 @@ const createStyles = (colors: any) => interface Props { onLongPress: () => void; label: string; + testID?: string; } -const ButtonReveal = ({ onLongPress, label }: Props) => { +const ButtonReveal = ({ onLongPress, label, testID }: Props) => { // Values for animating the stroke const progressOrigin = useSharedValue(innerRadius * 2 * Math.PI); const progressDestination = useSharedValue(0); @@ -300,6 +301,7 @@ const ButtonReveal = ({ onLongPress, label }: Props) => { onPressIn={triggerPressStart} onPressOut={triggerPressEnd} activeOpacity={1} + testID={testID} > diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index 01561244ef9..e2382d21f33 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -128,6 +128,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.question_one.right_answer'), onPress: () => setStage(QuizStage.rightAnswerQuestionOne), variant: ButtonVariants.Secondary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID, }, { label: strings('srp_security_quiz.learn_more'), @@ -149,6 +151,8 @@ const SRPQuiz = () => { title={{ content: strings('srp_security_quiz.question_one.right_answer_title'), style: styles.rightText, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE, }} content={strings( 'srp_security_quiz.question_one.right_answer_description', @@ -158,6 +162,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.continue'), onPress: () => setStage(QuizStage.questionTwo), variant: ButtonVariants.Primary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID, }, { label: strings('srp_security_quiz.learn_more'), @@ -190,6 +196,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.try_again'), onPress: () => setStage(QuizStage.questionOne), variant: ButtonVariants.Primary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID, }, { label: strings('srp_security_quiz.learn_more'), @@ -215,11 +223,15 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.question_two.right_answer'), onPress: () => setStage(QuizStage.rightAnswerQuestionTwo), variant: ButtonVariants.Secondary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID, }, { label: strings('srp_security_quiz.question_two.wrong_answer'), onPress: () => setStage(QuizStage.wrongAnswerQuestionTwo), variant: ButtonVariants.Secondary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID, }, { label: strings('srp_security_quiz.learn_more'), @@ -241,6 +253,8 @@ const SRPQuiz = () => { title={{ content: strings('srp_security_quiz.question_two.right_answer_title'), style: styles.rightText, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE, }} content={strings( 'srp_security_quiz.question_two.right_answer_description', @@ -250,6 +264,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.continue'), onPress: goToRevealPrivateCredential, variant: ButtonVariants.Primary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID, }, { label: strings('srp_security_quiz.learn_more'), @@ -276,6 +292,8 @@ const SRPQuiz = () => { title={{ content: strings('srp_security_quiz.question_two.wrong_answer_title'), style: styles.wrongText, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE, }} content={strings( 'srp_security_quiz.question_two.wrong_answer_description', @@ -285,6 +303,8 @@ const SRPQuiz = () => { label: strings('srp_security_quiz.try_again'), onPress: () => setStage(QuizStage.questionTwo), variant: ButtonVariants.Primary, + testID: + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID, }, { label: strings('srp_security_quiz.learn_more'), diff --git a/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx b/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx index 5e896bd75b8..b1f767b7842 100644 --- a/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx +++ b/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx @@ -51,7 +51,7 @@ import { isHardwareAccount } from '../../../util/address'; import AppConstants from '../../../core/AppConstants'; import { createStyles } from './styles'; import { getNavigationOptionsTitle } from '../../../components/UI/Navbar'; -import generateTestId from '../../../../wdio/utils/generateTestId'; +// import generateTestId from '../../../../wdio/utils/generateTestId'; import { RevealSeedViewSelectorsIDs } from '../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors'; import { selectSelectedInternalAccountChecksummedAddress } from '../../../selectors/accountsController'; @@ -467,10 +467,9 @@ const RevealPrivateCredential = ({ : strings('reveal_credential.srp_abbreviation_text'), })} onLongPress={() => revealCredential(privCredentialName)} - {...generateTestId( - Platform, - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID, - )} + testID={ + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID + } /> } diff --git a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js index 53cd21b6c6f..d30900137a0 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js @@ -47,7 +47,7 @@ class RevealSecretRecoveryPhrase { get tryAgainOne() { return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID, + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID, ); } @@ -144,6 +144,42 @@ class RevealSecretRecoveryPhrase { async tapQuestionOneWrongAnswer() { await Gestures.waitAndTap(this.questionOneWrongAnswer); } + + async tapTryAgainOne() { + await Gestures.waitAndTap(this.tryAgainOne); + } + + async tapQuestionOneRightAnswer() { + await Gestures.waitAndTap(this.questionOneRightAnswer); + } + + async tapContinueOne() { + await Gestures.waitAndTap(this.continueOne); + } + + async tapQuestionTwoWrongAnswer() { + await Gestures.waitAndTap(this.questionTwoWrongAnswer); + } + + async tapTryAgainTwo() { + await Gestures.waitAndTap(this.tryAgainTwo); + } + + async tapQuestionTwoRightAnswer() { + await Gestures.waitAndTap(this.questionTwoRightAnswer); + } + + async tapContinueTwo() { + await Gestures.waitAndTap(this.continueTwo); + } + + async tapTouchableBox() { + await Gestures.waitAndTap(this.touchableBox); + } + + async tapRevealRecoveryPhrase() { + await Gestures.tapAndLongPress(this.touchableBox); + } } export default new RevealSecretRecoveryPhrase(); diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index c0c9811e4fe..ffb1db8c31a 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -11,31 +11,27 @@ export const RevealSeedViewSelectorsIDs = { 'security-quiz-question-one-wrong-answer', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE: 'security-quiz-question-one-wrong-title', - // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID: - // 'security-quiz-question-one-wrong-answer-response-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_ID: - // 'security-quiz-question-one-wrong-answer-try-again', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID: - // 'security-quiz-question-one-right-answer', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_CONTAINER_ID: - // 'security-quiz-question-one-right-answer-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID: - // 'security-quiz-question-one-right-continue', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID: + 'security-quiz-question-one-wrong-answer-try-again', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID: + 'security-quiz-question-one-right-answer', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE: + 'security-quiz-question-one-right-answer-title', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID: + 'security-quiz-question-one-right-continue', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_CONTAINER_ID: - // 'security-quiz-question-two-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID: - // 'security-quiz-question-two-wrong-answer', - // SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_TWO_WRONG_CONTAINER_ID: - // 'security-quiz-question-two-wrong-answer-response-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID: - // 'security-quiz-question-two-wrong-answer-try-again', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID: - // 'security-quiz-question-two-right-answer', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_CONTAINER_ID: - // 'security-quiz-question-two-right-answer-container', - // SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID: - // 'security-quiz-question-two-right-continue', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID: + 'security-quiz-question-two-wrong-answer', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE: + 'security-quiz-question-two-wrong-answer-title', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID: + 'security-quiz-question-two-wrong-answer-try-again', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID: + 'security-quiz-question-two-right-answer', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE: + 'security-quiz-question-two-right-answer-title', + SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID: + 'security-quiz-question-two-right-continue', PASSWORD_INPUT: 'login-password-input', PASSWORD_WARNING_ID: 'password-warning', diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js index d108ef45251..9765bdec7c2 100644 --- a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js +++ b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js @@ -10,17 +10,17 @@ import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/Security import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; +// import { LoginView } from '../../pages/LoginView.js'; + import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures, defaultGanacheOptions, } from '../../fixtures/fixture-helper'; -// import Assertions from '../../utils/Assertions'; describe(SmokeAccounts('reveal secret recovery phrase'), () => { it('completes quiz after wrong answers', async () => { - const wrongQuestionOneTitle = - 'Wrong! No one can help get your Secret Recovery Phrase back'; + const PASSWORD = '123123123'; await withFixtures( { @@ -32,15 +32,54 @@ describe(SmokeAccounts('reveal secret recovery phrase'), () => { async () => { await loginToApp(); - // Navigate to the settings + // Navigate settings to the Reveal Secret Recovery Phrase screen await TabBarComponent.tapSettings(); await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); + + //Start the quiz await RevealSecretRecoveryPhrase.tapGetStarted(); + //Answer the first question wrong await RevealSecretRecoveryPhrase.tapQuestionOneWrongAnswer(); - await TestHelpers.checkIfHasText( + await TestHelpers.checkIfVisible( RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, - wrongQuestionOneTitle, + ); + //Try again + await RevealSecretRecoveryPhrase.tapTryAgainOne(); + //Answer the first question right + await RevealSecretRecoveryPhrase.tapQuestionOneRightAnswer(); + await TestHelpers.checkIfVisible( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE, + ); + await RevealSecretRecoveryPhrase.tapContinueOne(); + //Answer the second question wrong + await RevealSecretRecoveryPhrase.tapQuestionTwoWrongAnswer(); + await TestHelpers.checkIfVisible( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE, + ); + //Try again + await RevealSecretRecoveryPhrase.tapTryAgainTwo(); + //Answer the second question right + await RevealSecretRecoveryPhrase.tapQuestionTwoRightAnswer(); + await TestHelpers.checkIfVisible( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE, + ); + + await RevealSecretRecoveryPhrase.tapContinueTwo(); + + // click into password input box + await TestHelpers.waitAndTap( + RevealSeedViewSelectorsIDs.PASSWORD_INPUT_BOX_ID, + ); + //Enter password + await TestHelpers.typeTextAndHideKeyboard( + RevealSeedViewSelectorsIDs.PASSWORD_INPUT_BOX_ID, + PASSWORD, + ); + + // can see tap and hold but not activating animations and not showing the secret recovery phrase + await TestHelpers.tapAndLongPress( + RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID, ); }, ); From de05332c0be7deb0a597c412b5565ce136e35759 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:54:37 -0400 Subject: [PATCH 05/17] update steps to stop at quiz completion --- .../RevealSeedView.selectors.js | 32 +++++++-------- ...js => secret_recovery_phrase_quiz.spec.js} | 39 +++++-------------- 2 files changed, 23 insertions(+), 48 deletions(-) rename e2e/specs/accounts/{reveal-secret-recovery-phrase.spec.js => secret_recovery_phrase_quiz.spec.js} (71%) diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index ffb1db8c31a..39b3375a352 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -1,12 +1,20 @@ // eslint-disable-next-line import/prefer-default-export export const RevealSeedViewSelectorsIDs = { SECRET_RECOVERY_PHRASE_CONTAINER_ID: 'reveal-private-credential-screen', - - SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID: 'security-quiz-container', + PASSWORD_INPUT: 'login-password-input', + PASSWORD_WARNING_ID: 'password-warning', + REVEAL_SECRET_RECOVERY_PHRASE_TOUCHABLE_BOX_ID: + 'private-credential-touchable', + SECRET_RECOVERY_PHRASE_TEXT: 'private-credential-text', + SECRET_RECOVERY_PHRASE_CANCEL_BUTTON_ID: + 'reveal-private-credential-cancel-button', + SECRET_RECOVERY_PHRASE_NEXT_BUTTON_ID: + 'reveal-private-credential-next-button', + SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID: + 'reveal-private-long-press-button', + PASSWORD_INPUT_BOX_ID: 'private-credential-password-text-input', + // SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID: 'security-quiz-container', SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID: 'get-started-button', - // SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID: - // 'security-quiz-learn-more-button', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: 'security-quiz-question-one-wrong-answer', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE: @@ -19,7 +27,6 @@ export const RevealSeedViewSelectorsIDs = { 'security-quiz-question-one-right-answer-title', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID: 'security-quiz-question-one-right-continue', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID: 'security-quiz-question-two-wrong-answer', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE: @@ -32,17 +39,4 @@ export const RevealSeedViewSelectorsIDs = { 'security-quiz-question-two-right-answer-title', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID: 'security-quiz-question-two-right-continue', - - PASSWORD_INPUT: 'login-password-input', - PASSWORD_WARNING_ID: 'password-warning', - REVEAL_SECRET_RECOVERY_PHRASE_TOUCHABLE_BOX_ID: - 'private-credential-touchable', - SECRET_RECOVERY_PHRASE_TEXT: 'private-credential-text', - SECRET_RECOVERY_PHRASE_CANCEL_BUTTON_ID: - 'reveal-private-credential-cancel-button', - SECRET_RECOVERY_PHRASE_NEXT_BUTTON_ID: - 'reveal-private-credential-next-button', - SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID: - 'reveal-private-long-press-button', - PASSWORD_INPUT_BOX_ID: 'private-credential-password-text-input', }; diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js similarity index 71% rename from e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js rename to e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index 9765bdec7c2..24f38c44744 100644 --- a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -1,27 +1,22 @@ 'use strict'; -import { SmokeAccounts } from '../../tags'; -import TestHelpers from '../../helpers'; -import { loginToApp } from '../../viewHelper'; - -import TabBarComponent from '../../pages/TabBarComponent'; +import { SmokeAccounts } from '../../tags.js'; +import TestHelpers from '../../helpers.js'; +import { loginToApp } from '../../viewHelper.js'; +import TabBarComponent from '../../pages/TabBarComponent.js'; import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; -// import { LoginView } from '../../pages/LoginView.js'; - -import FixtureBuilder from '../../fixtures/fixture-builder'; +import FixtureBuilder from '../../fixtures/fixture-builder.js'; import { withFixtures, defaultGanacheOptions, -} from '../../fixtures/fixture-helper'; - -describe(SmokeAccounts('reveal secret recovery phrase'), () => { - it('completes quiz after wrong answers', async () => { - const PASSWORD = '123123123'; +} from '../../fixtures/fixture-helper.js'; +describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { + it('completes successfully after correcting wrong answers', async () => { await withFixtures( { fixture: new FixtureBuilder().withGanacheNetwork().build(), @@ -31,12 +26,10 @@ describe(SmokeAccounts('reveal secret recovery phrase'), () => { }, async () => { await loginToApp(); - // Navigate settings to the Reveal Secret Recovery Phrase screen await TabBarComponent.tapSettings(); await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); - //Start the quiz await RevealSecretRecoveryPhrase.tapGetStarted(); //Answer the first question wrong @@ -64,22 +57,10 @@ describe(SmokeAccounts('reveal secret recovery phrase'), () => { await TestHelpers.checkIfVisible( RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE, ); - await RevealSecretRecoveryPhrase.tapContinueTwo(); - - // click into password input box - await TestHelpers.waitAndTap( - RevealSeedViewSelectorsIDs.PASSWORD_INPUT_BOX_ID, - ); - //Enter password - await TestHelpers.typeTextAndHideKeyboard( + // land at reveal SRP view prompt for password + await TestHelpers.checkIfVisible( RevealSeedViewSelectorsIDs.PASSWORD_INPUT_BOX_ID, - PASSWORD, - ); - - // can see tap and hold but not activating animations and not showing the secret recovery phrase - await TestHelpers.tapAndLongPress( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID, ); }, ); From a7f6ddf0f62f041de1267398499c31232223fac4 Mon Sep 17 00:00:00 2001 From: Mike B <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:06:58 -0400 Subject: [PATCH 06/17] Update .detoxrc.js revert android emulator to default --- .detoxrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.detoxrc.js b/.detoxrc.js index d388aea1d66..67ddaec1a2f 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -76,7 +76,7 @@ module.exports = { 'android.emulator': { type: 'android.emulator', device: { - avdName: 'Pixel_5_API_30', + avdName: 'Pixel_5_Pro_API_30', }, }, }, From ba87e1a90f3f1c4719ab7d145ff1dbcebdba82e3 Mon Sep 17 00:00:00 2001 From: Mike B <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:10:47 -0400 Subject: [PATCH 07/17] Update index.js revert to original after ignoring all logs for debugging --- index.js | 99 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 49 insertions(+), 50 deletions(-) diff --git a/index.js b/index.js index 2449d91c598..69379d6fe6b 100644 --- a/index.js +++ b/index.js @@ -26,56 +26,55 @@ import { isNotificationsFeatureEnabled } from './app/util/notifications/methods' // List of warnings that we're ignoring -LogBox.ignoreAllLogs(); -// LogBox.ignoreLogs([ -// '{}', -// // Uncomment the below lines (21 and 22) to run browser-tests.spec.js in debug mode -// // in e2e tests until issue https://github.com/MetaMask/metamask-mobile/issues/1395 is resolved -// //"Error in RPC response", -// // 'User rejected account access', -// "Can't perform a React state update", -// 'Error evaluating injectedJavaScript', -// 'createErrorFromErrorData', -// 'Encountered an error loading page', -// 'Error handling userAuthorizedUpdate', -// 'MaxListenersExceededWarning', -// 'Expected delta of 0 for the fields', -// 'The network request was invalid', -// 'Require cycle', -// 'ListView is deprecated', -// 'WebView has been extracted from react-native core', -// 'Exception was previously raised by watchStore', -// 'StateUpdateController', -// 'this.web3.eth', -// 'collectibles.map', -// 'Warning: bind(): You are binding a component method to the component', -// 'AssetsDectionController._callee', -// 'Accessing view manager configs directly off', -// 'Function components cannot be given refs.', -// 'Task orphaned for request', -// 'Module RNOS requires', -// 'use RCT_EXPORT_MODULE', -// 'Setting a timer for a long period of time', -// 'Did not receive response to shouldStartLoad in time', -// 'startLoadWithResult invoked with invalid', -// 'RCTBridge required dispatch_sync', -// 'Remote debugger is in a background tab', -// "Can't call setState (or forceUpdate) on an unmounted component", -// 'No stops in gradient', -// "Cannot read property 'hash' of null", -// 'componentWillUpdate', -// 'componentWillReceiveProps', -// 'getNode()', -// 'Non-serializable values were found in the navigation state.', // We are not saving navigation state so we can ignore this -// 'new NativeEventEmitter', // New libraries have not yet implemented native methods to handle warnings (https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir) -// 'EventEmitter.removeListener', -// 'Module TcpSockets requires main queue setup', -// 'Module RCTSearchApiManager requires main queue setup', -// 'PushNotificationIOS has been extracted', // RNC PushNotification iOS issue - https://github.com/react-native-push-notification/ios/issues/43 -// "ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.", -// 'ReactImageView: Image source "null"', -// 'Warning: componentWillReceiveProps has been renamed', -// ]); +LogBox.ignoreLogs([ + '{}', + // Uncomment the below lines (21 and 22) to run browser-tests.spec.js in debug mode + // in e2e tests until issue https://github.com/MetaMask/metamask-mobile/issues/1395 is resolved + //"Error in RPC response", + // 'User rejected account access', + "Can't perform a React state update", + 'Error evaluating injectedJavaScript', + 'createErrorFromErrorData', + 'Encountered an error loading page', + 'Error handling userAuthorizedUpdate', + 'MaxListenersExceededWarning', + 'Expected delta of 0 for the fields', + 'The network request was invalid', + 'Require cycle', + 'ListView is deprecated', + 'WebView has been extracted from react-native core', + 'Exception was previously raised by watchStore', + 'StateUpdateController', + 'this.web3.eth', + 'collectibles.map', + 'Warning: bind(): You are binding a component method to the component', + 'AssetsDectionController._callee', + 'Accessing view manager configs directly off', + 'Function components cannot be given refs.', + 'Task orphaned for request', + 'Module RNOS requires', + 'use RCT_EXPORT_MODULE', + 'Setting a timer for a long period of time', + 'Did not receive response to shouldStartLoad in time', + 'startLoadWithResult invoked with invalid', + 'RCTBridge required dispatch_sync', + 'Remote debugger is in a background tab', + "Can't call setState (or forceUpdate) on an unmounted component", + 'No stops in gradient', + "Cannot read property 'hash' of null", + 'componentWillUpdate', + 'componentWillReceiveProps', + 'getNode()', + 'Non-serializable values were found in the navigation state.', // We are not saving navigation state so we can ignore this + 'new NativeEventEmitter', // New libraries have not yet implemented native methods to handle warnings (https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir) + 'EventEmitter.removeListener', + 'Module TcpSockets requires main queue setup', + 'Module RCTSearchApiManager requires main queue setup', + 'PushNotificationIOS has been extracted', // RNC PushNotification iOS issue - https://github.com/react-native-push-notification/ios/issues/43 + "ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.", + 'ReactImageView: Image source "null"', + 'Warning: componentWillReceiveProps has been renamed', +]); const IGNORE_BOXLOGS_DEVELOPMENT = process.env.IGNORE_BOXLOGS_DEVELOPMENT; // Ignore box logs, useful for QA testing in development builds From 48989a3dac75a8321091f4129f151994d1219887 Mon Sep 17 00:00:00 2001 From: Mike B <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:13:31 -0400 Subject: [PATCH 08/17] Update RevealPrivateCredential.tsx remove unused --- .../Views/RevealPrivateCredential/RevealPrivateCredential.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx b/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx index b1f767b7842..cc6570861f5 100644 --- a/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx +++ b/app/components/Views/RevealPrivateCredential/RevealPrivateCredential.tsx @@ -51,7 +51,6 @@ import { isHardwareAccount } from '../../../util/address'; import AppConstants from '../../../core/AppConstants'; import { createStyles } from './styles'; import { getNavigationOptionsTitle } from '../../../components/UI/Navbar'; -// import generateTestId from '../../../../wdio/utils/generateTestId'; import { RevealSeedViewSelectorsIDs } from '../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors'; import { selectSelectedInternalAccountChecksummedAddress } from '../../../selectors/accountsController'; From 55cba22c617d8d01bdd8756884e53226f9ed8bb2 Mon Sep 17 00:00:00 2001 From: Mike B <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:15:38 -0400 Subject: [PATCH 09/17] Update SecurityAndPrivacyView.js remove unneeded changes since SRP reveal is out of scope for quiz completion spec at this time. --- .../SecurityAndPrivacy/SecurityAndPrivacyView.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js index 328a946c89b..ad71a190f6a 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js @@ -13,12 +13,6 @@ class SecurityAndPrivacy { ); } - get revealSecretRecoveryPhraseButton() { - return Matchers.getElementByID( - SecurityPrivacyViewSelectorsIDs.REVEAL_SEED_BUTTON, - ); - } - get deleteWalletButton() { return device.getPlatform() === 'ios' ? Matchers.getElementByID(SECURITY_PRIVACY_DELETE_WALLET_BUTTON) @@ -76,10 +70,6 @@ class SecurityAndPrivacy { ); } - async tapRevealSecretRecoveryPhraseButton() { - await Gestures.waitAndTap(this.revealSecretRecoveryPhraseButton); - } - async tapChangePasswordButton() { await Gestures.waitAndTap(this.changePasswordButton); } From a04c389187327ff1d16cc94e46d271b8712709ab Mon Sep 17 00:00:00 2001 From: Mike B <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 15:48:42 -0400 Subject: [PATCH 10/17] Update RevealSeedView.selectors.js remove unused --- .../Settings/SecurityAndPrivacy/RevealSeedView.selectors.js | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index 39b3375a352..3f774e14d5c 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -13,7 +13,6 @@ export const RevealSeedViewSelectorsIDs = { SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID: 'reveal-private-long-press-button', PASSWORD_INPUT_BOX_ID: 'private-credential-password-text-input', - // SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID: 'security-quiz-container', SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID: 'get-started-button', SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: 'security-quiz-question-one-wrong-answer', From 7a93abfcced326b594fd08ec22bc228eed4c9175 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:03:01 -0400 Subject: [PATCH 11/17] add to reveal SRP back to view --- .../SecurityAndPrivacy/SecurityAndPrivacyView.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js index ad71a190f6a..328a946c89b 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js @@ -13,6 +13,12 @@ class SecurityAndPrivacy { ); } + get revealSecretRecoveryPhraseButton() { + return Matchers.getElementByID( + SecurityPrivacyViewSelectorsIDs.REVEAL_SEED_BUTTON, + ); + } + get deleteWalletButton() { return device.getPlatform() === 'ios' ? Matchers.getElementByID(SECURITY_PRIVACY_DELETE_WALLET_BUTTON) @@ -70,6 +76,10 @@ class SecurityAndPrivacy { ); } + async tapRevealSecretRecoveryPhraseButton() { + await Gestures.waitAndTap(this.revealSecretRecoveryPhraseButton); + } + async tapChangePasswordButton() { await Gestures.waitAndTap(this.changePasswordButton); } From 60320825d0e0606b94aa82b9701b2baf4e4d8e0b Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:04:43 -0400 Subject: [PATCH 12/17] revert unused button changes for reveal --- app/components/UI/ButtonReveal/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/components/UI/ButtonReveal/index.tsx b/app/components/UI/ButtonReveal/index.tsx index 7b6cf871fe8..06ef8ecdf29 100644 --- a/app/components/UI/ButtonReveal/index.tsx +++ b/app/components/UI/ButtonReveal/index.tsx @@ -85,10 +85,9 @@ const createStyles = (colors: any) => interface Props { onLongPress: () => void; label: string; - testID?: string; } -const ButtonReveal = ({ onLongPress, label, testID }: Props) => { +const ButtonReveal = ({ onLongPress, label }: Props) => { // Values for animating the stroke const progressOrigin = useSharedValue(innerRadius * 2 * Math.PI); const progressDestination = useSharedValue(0); @@ -301,7 +300,6 @@ const ButtonReveal = ({ onLongPress, label, testID }: Props) => { onPressIn={triggerPressStart} onPressOut={triggerPressEnd} activeOpacity={1} - testID={testID} > From 9a909e324d963ebf994d54c1e7bda3d3de00170e Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:48:26 -0400 Subject: [PATCH 13/17] Add reverseServerPort for fixtures --- .../accounts/secret_recovery_phrase_quiz.spec.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index 24f38c44744..58653c56dea 100644 --- a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -8,20 +8,25 @@ import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; - -import FixtureBuilder from '../../fixtures/fixture-builder.js'; +// import { getFixturesServerPort } from '../../fixtures/utils'; import { withFixtures, defaultGanacheOptions, -} from '../../fixtures/fixture-helper.js'; +} from '../../fixtures/fixture-helper'; +import FixtureBuilder from '../../fixtures/fixture-builder.js'; + +// const fixtureServer = new FixtureServer(); describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { + beforeAll(async () => { + await TestHelpers.reverseServerPort(); + }); + it('completes successfully after correcting wrong answers', async () => { await withFixtures( { fixture: new FixtureBuilder().withGanacheNetwork().build(), restartDevice: true, - completedOnboarding: true, ganacheOptions: defaultGanacheOptions, }, async () => { From e0ba14b6d77f1541618ac90bc4798cadacbe67e6 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:24:10 -0400 Subject: [PATCH 14/17] remove commented out import and const --- e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index 58653c56dea..d6f821893b0 100644 --- a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -8,15 +8,12 @@ import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; -// import { getFixturesServerPort } from '../../fixtures/utils'; import { withFixtures, defaultGanacheOptions, } from '../../fixtures/fixture-helper'; import FixtureBuilder from '../../fixtures/fixture-builder.js'; -// const fixtureServer = new FixtureServer(); - describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); From 608c1ab6c63bdaefbbf5855cf0b7532410519c85 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:30:53 -0400 Subject: [PATCH 15/17] incorporating feedback --- app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 38 +-- app/components/Views/Quiz/types.ts | 1 + .../RevealSecretRecoveryPhrase.js | 146 ------------ e2e/pages/modals/SecurityQuizModal.js | 218 ++++++++++++++++++ .../Modals/SecurityQuizModal.selectors.js | 55 +++++ .../RevealSeedView.selectors.js | 25 -- .../secret_recovery_phrase_quiz.spec.js | 63 ++--- 7 files changed, 329 insertions(+), 217 deletions(-) create mode 100644 e2e/pages/modals/SecurityQuizModal.js create mode 100644 e2e/selectors/Modals/SecurityQuizModal.selectors.js diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index e2382d21f33..f3c6077e861 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -19,8 +19,14 @@ import { QuizContent } from '../QuizContent'; import stylesheet from './styles'; import { useMetrics } from '../../../../components/hooks/useMetrics'; -import { RevealSeedViewSelectorsIDs } from '../../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; - +import { + SecurityQuizGetStartedModalSelectorsIDs, + SecurityQuizGetStartedModalSelectorsText, + SecurityQuestionOneModelSelectorsIDs, + SecurityQuizQuestionOneModalSelectorsText, + SecurityQuestionTwoModelSelectorsIDs, + SecurityQuizQuestionTwoModalSelectorsText, +} from '../../../../../e2e/selectors/Modals/SecurityQuizModal.selectors.js'; const introductionImg = require('../../../../images/reveal-srp.png'); const SRPQuiz = () => { @@ -85,6 +91,7 @@ const SRPQuiz = () => { image={introductionImg} title={{ content: strings('srp_security_quiz.introduction'), + testID: SecurityQuizGetStartedModalSelectorsText.QUIZ_INTRODUCTION, }} buttons={[ { @@ -94,7 +101,7 @@ const SRPQuiz = () => { setStage(QuizStage.questionOne); }, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID, + SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_BUTTON, variant: ButtonVariants.Primary, }, { @@ -115,6 +122,7 @@ const SRPQuiz = () => { header={`1 ${strings('srp_security_quiz.of')} 2`} title={{ content: strings('srp_security_quiz.question_one.question'), + testId: SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE, }} buttons={[ { @@ -122,14 +130,14 @@ const SRPQuiz = () => { onPress: () => setStage(QuizStage.wrongAnswerQuestionOne), variant: ButtonVariants.Secondary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER, }, { label: strings('srp_security_quiz.question_one.right_answer'), onPress: () => setStage(QuizStage.rightAnswerQuestionOne), variant: ButtonVariants.Secondary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_RIGHT_ANSWER, }, { label: strings('srp_security_quiz.learn_more'), @@ -152,7 +160,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_one.right_answer_title'), style: styles.rightText, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE, }} content={strings( 'srp_security_quiz.question_one.right_answer_description', @@ -163,7 +171,7 @@ const SRPQuiz = () => { onPress: () => setStage(QuizStage.questionTwo), variant: ButtonVariants.Primary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_RIGHT_CONTINUE, }, { label: strings('srp_security_quiz.learn_more'), @@ -186,7 +194,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_one.wrong_answer_title'), style: styles.wrongText, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER, }} content={strings( 'srp_security_quiz.question_one.wrong_answer_description', @@ -197,7 +205,7 @@ const SRPQuiz = () => { onPress: () => setStage(QuizStage.questionOne), variant: ButtonVariants.Primary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON, }, { label: strings('srp_security_quiz.learn_more'), @@ -224,14 +232,14 @@ const SRPQuiz = () => { onPress: () => setStage(QuizStage.rightAnswerQuestionTwo), variant: ButtonVariants.Secondary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID, + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_RIGHT_ANSWER, }, { label: strings('srp_security_quiz.question_two.wrong_answer'), onPress: () => setStage(QuizStage.wrongAnswerQuestionTwo), variant: ButtonVariants.Secondary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID, + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_WRONG_ANSWER, }, { label: strings('srp_security_quiz.learn_more'), @@ -254,7 +262,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_two.right_answer_title'), style: styles.rightText, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE, }} content={strings( 'srp_security_quiz.question_two.right_answer_description', @@ -265,7 +273,7 @@ const SRPQuiz = () => { onPress: goToRevealPrivateCredential, variant: ButtonVariants.Primary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID, + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_RIGHT_CONTINUE, }, { label: strings('srp_security_quiz.learn_more'), @@ -293,7 +301,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_two.wrong_answer_title'), style: styles.wrongText, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE, }} content={strings( 'srp_security_quiz.question_two.wrong_answer_description', @@ -304,7 +312,7 @@ const SRPQuiz = () => { onPress: () => setStage(QuizStage.questionTwo), variant: ButtonVariants.Primary, testID: - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID, + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_BUTTON, }, { label: strings('srp_security_quiz.learn_more'), diff --git a/app/components/Views/Quiz/types.ts b/app/components/Views/Quiz/types.ts index da74b73a051..93a4af37687 100644 --- a/app/components/Views/Quiz/types.ts +++ b/app/components/Views/Quiz/types.ts @@ -32,4 +32,5 @@ export interface IQuizInformationProps { // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any icon?: any; + testID?: string; } diff --git a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js index d30900137a0..f745f2434ef 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js @@ -9,108 +9,6 @@ class RevealSecretRecoveryPhrase { ); } - get getStarted() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID, - ); - } - - get quizContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_CONTAINER_ID, - ); - } - - get learnMoreButton() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_LEARN_MORE_BUTTON_ID, - ); - } - - get questionOneWrongTitle() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, - ); - } - - get questionOneWrongAnswer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID, - ); - } - - get responseOneWrongContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_ONE_WRONG_CONTAINER_ID, - ); - } - - get tryAgainOne() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID, - ); - } - - get questionOneRightAnswer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID, - ); - } - - get questionOneRightContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_CONTAINER_ID, - ); - } - - get continueOne() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID, - ); - } - - get questionTwoContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_CONTAINER_ID, - ); - } - - get questionTwoWrongAnswer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID, - ); - } - - get responseTwoWrongContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_RESPONSE_TWO_WRONG_CONTAINER_ID, - ); - } - - get tryAgainTwo() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID, - ); - } - - get questionTwoRightAnswer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID, - ); - } - - get questionTwoRightContainer() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_CONTAINER_ID, - ); - } - - get continueTwo() { - return Matchers.getElementByID( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID, - ); - } - get passwordInput() { return Matchers.getElementByID(RevealSeedViewSelectorsIDs.PASSWORD_INPUT); } @@ -136,50 +34,6 @@ class RevealSecretRecoveryPhrase { async enterPassword(password) { await Gestures.typeTextAndHideKeyboard(this.passwordInput, password); } - - async tapGetStarted() { - await Gestures.waitAndTap(this.getStarted); - } - - async tapQuestionOneWrongAnswer() { - await Gestures.waitAndTap(this.questionOneWrongAnswer); - } - - async tapTryAgainOne() { - await Gestures.waitAndTap(this.tryAgainOne); - } - - async tapQuestionOneRightAnswer() { - await Gestures.waitAndTap(this.questionOneRightAnswer); - } - - async tapContinueOne() { - await Gestures.waitAndTap(this.continueOne); - } - - async tapQuestionTwoWrongAnswer() { - await Gestures.waitAndTap(this.questionTwoWrongAnswer); - } - - async tapTryAgainTwo() { - await Gestures.waitAndTap(this.tryAgainTwo); - } - - async tapQuestionTwoRightAnswer() { - await Gestures.waitAndTap(this.questionTwoRightAnswer); - } - - async tapContinueTwo() { - await Gestures.waitAndTap(this.continueTwo); - } - - async tapTouchableBox() { - await Gestures.waitAndTap(this.touchableBox); - } - - async tapRevealRecoveryPhrase() { - await Gestures.tapAndLongPress(this.touchableBox); - } } export default new RevealSecretRecoveryPhrase(); diff --git a/e2e/pages/modals/SecurityQuizModal.js b/e2e/pages/modals/SecurityQuizModal.js new file mode 100644 index 00000000000..a027283c396 --- /dev/null +++ b/e2e/pages/modals/SecurityQuizModal.js @@ -0,0 +1,218 @@ +import { + SecurityQuizGetStartedModalSelectorsIDs, + SecurityQuizGetStartedModalSelectorsText, + SecurityQuestionOneModelSelectorsIDs, + SecurityQuizQuestionOneModalSelectorsText, + SecurityQuestionTwoModelSelectorsIDs, + SecurityQuizQuestionTwoModalSelectorsText, +} from '../../selectors/Modals/SecurityQuizModal.selectors'; +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; + +class SecurityQuizModal { + get getStartedContainer() { + return Matchers.getElementByID( + SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_CONTAINER, + ); + } + + get getStartedDismiss() { + return Matchers.getElementByID( + SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_DISMISS_BUTTON, + ); + } + + get modalIntroduction() { + return Matchers.getElementByText( + SecurityQuizGetStartedModalSelectorsText.QUIZ_INTRODUCTION, + ); + } + + get getStartedButton() { + return Matchers.getElementByID( + SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_BUTTON, + ); + } + + get questionOneContainer() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_CONTAINER, + ); + } + + get questionOneDismiss() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_DISMISS_BUTTON, + ); + } + + get getQuizQuestionOne() { + return Matchers.getElementByText( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE, + ); + } + + get questionOneWrongAnswer() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER, + ); + } + + get questionOneWrongAnswerTitle() { + return Matchers.getElementByText( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_TITLE, + ); + } + + get questionOneWrongAnswerResponse() { + return Matchers.getElementByText( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE, + ); + } + + get questionOneWrongAnswerTryAgainButton() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON, + ); + } + + get questionOneRightAnswer() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_RIGHT_ANSWER, + ); + } + + get questionOneRightAnswerTitle() { + return Matchers.getElementByText( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE, + ); + } + + get questionOneRightAnswerResponse() { + return Matchers.getElementByText( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE, + ); + } + + get questionOneRightContinueButton() { + return Matchers.getElementByID( + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_RIGHT_CONTINUE, + ); + } + + get questionTwoContainer() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_CONTAINER, + ); + } + + get questionTwoDismiss() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_DISMISS_BUTTON, + ); + } + + get getQuizQuestionTwo() { + return Matchers.getElementByText( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO, + ); + } + + get questionTwoWrongAnswer() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_WRONG_ANSWER, + ); + } + + get questionTwoWrongAnswerTitle() { + return Matchers.getElementByText( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE, + ); + } + + get questionTwoWrongAnswerResponse() { + return Matchers.getElementByText( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE, + ); + } + + get questionTwoWrongAnswerTryAgainButton() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_BUTTON, + ); + } + + get questionTwoRightAnswer() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_RIGHT_ANSWER, + ); + } + + get questionTwoRightAnswerTitle() { + return Matchers.getElementByText( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE, + ); + } + + get questionTwoRightAnswerResponse() { + return Matchers.getElementByText( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE, + ); + } + + get questionTwoRightContinueButton() { + return Matchers.getElementByID( + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_RIGHT_CONTINUE, + ); + } + + async tapGetStartedDismiss() { + await Gestures.waitAndTap(this.getStartedDismiss); + } + + async tapGetStartedButton() { + await Gestures.waitAndTap(this.getStartedButton); + } + + async tapQuestionOneDismiss() { + await Gestures.waitAndTap(this.questionOneDismiss); + } + + async tapQuestionOneWrongAnswerButton() { + await Gestures.waitAndTap(this.questionOneWrongAnswer); + } + + async tapQuestionOneWrongAnswerTryAgainButton() { + await Gestures.waitAndTap(this.questionOneWrongAnswerTryAgainButton); + } + + async tapQuestionOneRightAnswerButton() { + await Gestures.waitAndTap(this.questionOneRightAnswer); + } + + async tapQuestionOneContinueButton() { + await Gestures.waitAndTap(this.questionOneRightContinueButton); + } + + async tapQuestionTwoDismiss() { + await Gestures.waitAndTap(this.questionTwoDismiss); + } + + async tapQuestionTwoWrongAnswerButton() { + await Gestures.waitAndTap(this.questionTwoWrongAnswer); + } + + async tapQuestionTwoWrongAnswerTryAgainButton() { + await Gestures.waitAndTap(this.questionTwoWrongAnswerTryAgainButton); + } + + async tapQuestionTwoRightAnswerButton() { + await Gestures.waitAndTap(this.questionTwoRightAnswer); + } + + async tapQuestionTwoContinueButton() { + await Gestures.waitAndTap(this.questionTwoRightContinueButton); + } +} + +export default new SecurityQuizModal(); diff --git a/e2e/selectors/Modals/SecurityQuizModal.selectors.js b/e2e/selectors/Modals/SecurityQuizModal.selectors.js new file mode 100644 index 00000000000..5b0f9699810 --- /dev/null +++ b/e2e/selectors/Modals/SecurityQuizModal.selectors.js @@ -0,0 +1,55 @@ +import enContent from '../../../locales/languages/en.json'; + +export const SecurityQuizGetStartedModalSelectorsIDs = { + QUIZ_GET_STARTED_CONTAINER: 'quiz-get-started-modal', + QUIZ_GET_STARTED_BUTTON: 'quiz-get-started-button', + QUIZ_GET_STARTED_DISMISS_BUTTON: 'quiz-get-started-dismiss-button', +}; + +export const SecurityQuizGetStartedModalSelectorsText = { + QUIZ_INTRODUCTION: enContent.srp_security_quiz.introduction, +}; + +export const SecurityQuestionOneModelSelectorsIDs = { + QUIZ_QUESTION_ONE_CONTAINER: 'quiz-question-one-modal', + QUIZ_QUESTION_ONE_DISMISS_BUTTON: 'quiz-question-one-dismiss-button', + QUIZ_QUESTION_ONE_WRONG_ANSWER: 'quiz-question-one-wrong-answer', + QUIZ_QUESTION_ONE_RIGHT_ANSWER: 'quiz-question-one-right-answer', + QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON: + 'quiz-question-one-wrong-answer-try-again', + QUIZ_QUESTION_ONE_RIGHT_CONTINUE: 'quiz-question-one-right-continue', +}; + +export const SecurityQuizQuestionOneModalSelectorsText = { + QUIZ_QUESTION_ONE: enContent.srp_security_quiz.question_one.question, + QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE: + enContent.srp_security_quiz.question_one.right_answer_description, + QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE: + enContent.srp_security_quiz.question_one.right_answer_title, + QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE: + enContent.srp_security_quiz.question_one.wrong_answer_description, + QUIZ_QUESTION_ONE_WRONG_ANSWER_TITLE: + enContent.srp_security_quiz.question_one.wrong_answer_title, +}; + +export const SecurityQuestionTwoModelSelectorsIDs = { + QUIZ_QUESTION_TWO_CONTAINER: 'quiz-question-two-modal', + QUIZ_QUESTION_TWO_DISMISS_BUTTON: 'quiz-question-two-dismiss-button', + QUIZ_QUESTION_TWO_WRONG_ANSWER: 'quiz-question-two-wrong-answer', + QUIZ_QUESTION_TWO_RIGHT_ANSWER: 'quiz-question-two-right-answer', + QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_BUTTON: + 'quiz-question-two-wrong-answer-try-again', + QUIZ_QUESTION_TWO_RIGHT_CONTINUE: 'quiz-question-two-right-continue', +}; + +export const SecurityQuizQuestionTwoModalSelectorsText = { + QUIZ_QUESTION_TWO: enContent.srp_security_quiz.question_two.question, + QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE: + enContent.srp_security_quiz.question_two.right_answer_description, + QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE: + enContent.srp_security_quiz.question_two.right_answer_title, + QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE: + enContent.srp_security_quiz.question_two.wrong_answer_description, + QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE: + enContent.srp_security_quiz.question_two.wrong_answer_title, +}; diff --git a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js index 3f774e14d5c..bd080916fc1 100644 --- a/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js +++ b/e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js @@ -13,29 +13,4 @@ export const RevealSeedViewSelectorsIDs = { SECRET_RECOVERY_PHRASE_LONG_PRESS_BUTTON_ID: 'reveal-private-long-press-button', PASSWORD_INPUT_BOX_ID: 'private-credential-password-text-input', - SECRET_RECOVERY_PHRASE_QUIZ_GET_STARTED_BUTTON_ID: 'get-started-button', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_ID: - 'security-quiz-question-one-wrong-answer', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE: - 'security-quiz-question-one-wrong-title', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON_ID: - 'security-quiz-question-one-wrong-answer-try-again', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_ANSWER_ID: - 'security-quiz-question-one-right-answer', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE: - 'security-quiz-question-one-right-answer-title', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_CONTINUE_ID: - 'security-quiz-question-one-right-continue', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_ID: - 'security-quiz-question-two-wrong-answer', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE: - 'security-quiz-question-two-wrong-answer-title', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_ID: - 'security-quiz-question-two-wrong-answer-try-again', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_ANSWER_ID: - 'security-quiz-question-two-right-answer', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE: - 'security-quiz-question-two-right-answer-title', - SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_CONTINUE_ID: - 'security-quiz-question-two-right-continue', }; diff --git a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index d6f821893b0..6ac51ecffe1 100644 --- a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -6,20 +6,25 @@ import { loginToApp } from '../../viewHelper.js'; import TabBarComponent from '../../pages/TabBarComponent.js'; import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; -import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase.js'; +import SecurityQuizModal from '../../pages/modals/SecurityQuizModal.js'; import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; +import { + SecurityQuizQuestionOneModalSelectorsText, + SecurityQuizQuestionTwoModalSelectorsText, +} from '../../selectors/Modals/SecurityQuizModal.selectors'; import { withFixtures, defaultGanacheOptions, } from '../../fixtures/fixture-helper'; import FixtureBuilder from '../../fixtures/fixture-builder.js'; +import Assertions from '../../utils/Assertions'; describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); }); - it('completes successfully after correcting wrong answers', async () => { + it('completes quiz after correcting wrong answers', async () => { await withFixtures( { fixture: new FixtureBuilder().withGanacheNetwork().build(), @@ -28,42 +33,38 @@ describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { }, async () => { await loginToApp(); - // Navigate settings to the Reveal Secret Recovery Phrase screen + + // Navigate to Reveal Secret Recovery Phrase screen await TabBarComponent.tapSettings(); await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.tapRevealSecretRecoveryPhraseButton(); - //Start the quiz - await RevealSecretRecoveryPhrase.tapGetStarted(); - //Answer the first question wrong - await RevealSecretRecoveryPhrase.tapQuestionOneWrongAnswer(); - await TestHelpers.checkIfVisible( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_WRONG_TITLE, - ); - //Try again - await RevealSecretRecoveryPhrase.tapTryAgainOne(); - //Answer the first question right - await RevealSecretRecoveryPhrase.tapQuestionOneRightAnswer(); - await TestHelpers.checkIfVisible( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_ONE_RIGHT_TITLE, + + // Start the quiz + await SecurityQuizModal.tapGetStartedButton(); + + // Question 1 + await SecurityQuizModal.tapQuestionOneWrongAnswerButton(); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE, ); - await RevealSecretRecoveryPhrase.tapContinueOne(); - //Answer the second question wrong - await RevealSecretRecoveryPhrase.tapQuestionTwoWrongAnswer(); - await TestHelpers.checkIfVisible( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_WRONG_TITLE, + await SecurityQuizModal.tapQuestionOneWrongAnswerTryAgainButton(); + await SecurityQuizModal.tapQuestionOneRightAnswerButton(); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE, ); - //Try again - await RevealSecretRecoveryPhrase.tapTryAgainTwo(); - //Answer the second question right - await RevealSecretRecoveryPhrase.tapQuestionTwoRightAnswer(); - await TestHelpers.checkIfVisible( - RevealSeedViewSelectorsIDs.SECRET_RECOVERY_PHRASE_QUIZ_QUESTION_TWO_RIGHT_TITLE, + await SecurityQuizModal.tapQuestionOneContinueButton(); + + // // // Question 2 + await SecurityQuizModal.tapQuestionTwoWrongAnswerButton(); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE, ); - await RevealSecretRecoveryPhrase.tapContinueTwo(); - // land at reveal SRP view prompt for password - await TestHelpers.checkIfVisible( - RevealSeedViewSelectorsIDs.PASSWORD_INPUT_BOX_ID, + await SecurityQuizModal.tapQuestionTwoWrongAnswerTryAgainButton(); + await SecurityQuizModal.tapQuestionTwoRightAnswerButton(); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE, ); + await SecurityQuizModal.tapQuestionTwoContinueButton(); }, ); }); From 39a459eb0e6ecc30b08a5bf2449f20dae411adf0 Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:37:51 -0400 Subject: [PATCH 16/17] linting- remove unused import --- e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index 6ac51ecffe1..253acbcad55 100644 --- a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -7,7 +7,6 @@ import TabBarComponent from '../../pages/TabBarComponent.js'; import SettingsView from '../../pages/Settings/SettingsView.js'; import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView.js'; import SecurityQuizModal from '../../pages/modals/SecurityQuizModal.js'; -import { RevealSeedViewSelectorsIDs } from '../../selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors.js'; import { SecurityQuizQuestionOneModalSelectorsText, SecurityQuizQuestionTwoModalSelectorsText, From a411acc61545e2429f37378217cb3c5f39c733ee Mon Sep 17 00:00:00 2001 From: Plasma Corral <32695229+plasmacorral@users.noreply.github.com> Date: Fri, 19 Jul 2024 02:48:27 -0400 Subject: [PATCH 17/17] more assertions --- app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx | 8 ++-- e2e/pages/modals/SecurityQuizModal.js | 44 +++++++++---------- .../Modals/SecurityQuizModal.selectors.js | 22 +++++----- .../secret_recovery_phrase_quiz.spec.js | 30 +++++++++++-- 4 files changed, 63 insertions(+), 41 deletions(-) diff --git a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx index f3c6077e861..6ed78c81c85 100644 --- a/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx +++ b/app/components/Views/Quiz/SRPQuiz/SRPQuiz.tsx @@ -160,7 +160,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_one.right_answer_title'), style: styles.rightText, testID: - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_TITLE, }} content={strings( 'srp_security_quiz.question_one.right_answer_description', @@ -194,7 +194,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_one.wrong_answer_title'), style: styles.wrongText, testID: - SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_WRONG_ANSWER, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_TITLE, }} content={strings( 'srp_security_quiz.question_one.wrong_answer_description', @@ -262,7 +262,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_two.right_answer_title'), style: styles.rightText, testID: - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_TITLE, }} content={strings( 'srp_security_quiz.question_two.right_answer_description', @@ -301,7 +301,7 @@ const SRPQuiz = () => { content: strings('srp_security_quiz.question_two.wrong_answer_title'), style: styles.wrongText, testID: - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_TITLE, }} content={strings( 'srp_security_quiz.question_two.wrong_answer_description', diff --git a/e2e/pages/modals/SecurityQuizModal.js b/e2e/pages/modals/SecurityQuizModal.js index a027283c396..1b2ff396d63 100644 --- a/e2e/pages/modals/SecurityQuizModal.js +++ b/e2e/pages/modals/SecurityQuizModal.js @@ -18,7 +18,7 @@ class SecurityQuizModal { get getStartedDismiss() { return Matchers.getElementByID( - SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_DISMISS_BUTTON, + SecurityQuizGetStartedModalSelectorsIDs.QUIZ_GET_STARTED_DISMISS, ); } @@ -42,7 +42,7 @@ class SecurityQuizModal { get questionOneDismiss() { return Matchers.getElementByID( - SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_DISMISS_BUTTON, + SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_DISMISS, ); } @@ -58,15 +58,15 @@ class SecurityQuizModal { ); } - get questionOneWrongAnswerTitle() { + get questionOneWrongAnswerResponseTitle() { return Matchers.getElementByText( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_TITLE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_TITLE, ); } - get questionOneWrongAnswerResponse() { + get questionOneWrongAnswerResponseDescription() { return Matchers.getElementByText( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_DESCRIPTION, ); } @@ -76,21 +76,21 @@ class SecurityQuizModal { ); } - get questionOneRightAnswer() { + get questionOneRightAnswerButton() { return Matchers.getElementByID( SecurityQuestionOneModelSelectorsIDs.QUIZ_QUESTION_ONE_RIGHT_ANSWER, ); } - get questionOneRightAnswerTitle() { - return Matchers.getElementByText( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE, + get questionOneRightAnswerResponseDescription() { + return Matchers.getElementByID( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_DESCRIPTION, ); } - get questionOneRightAnswerResponse() { + get questionOneRightAnswerResponseTitle() { return Matchers.getElementByText( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_TITLE, ); } @@ -108,7 +108,7 @@ class SecurityQuizModal { get questionTwoDismiss() { return Matchers.getElementByID( - SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_DISMISS_BUTTON, + SecurityQuestionTwoModelSelectorsIDs.QUIZ_QUESTION_TWO_DISMISS, ); } @@ -124,15 +124,15 @@ class SecurityQuizModal { ); } - get questionTwoWrongAnswerTitle() { + get questionTwoWrongAnswerResponseTitle() { return Matchers.getElementByText( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_TITLE, ); } - get questionTwoWrongAnswerResponse() { + get questionTwoWrongAnswerResponseDescription() { return Matchers.getElementByText( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_DESCRIPTION, ); } @@ -148,15 +148,15 @@ class SecurityQuizModal { ); } - get questionTwoRightAnswerTitle() { + get questionTwoRightAnswerResponseTitle() { return Matchers.getElementByText( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_TITLE, ); } - get questionTwoRightAnswerResponse() { + get questionTwoRightAnswerResponseDescription() { return Matchers.getElementByText( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_DESCRIPTION, ); } @@ -187,7 +187,7 @@ class SecurityQuizModal { } async tapQuestionOneRightAnswerButton() { - await Gestures.waitAndTap(this.questionOneRightAnswer); + await Gestures.waitAndTap(this.questionOneRightAnswerButton); } async tapQuestionOneContinueButton() { diff --git a/e2e/selectors/Modals/SecurityQuizModal.selectors.js b/e2e/selectors/Modals/SecurityQuizModal.selectors.js index 5b0f9699810..4f0e3017227 100644 --- a/e2e/selectors/Modals/SecurityQuizModal.selectors.js +++ b/e2e/selectors/Modals/SecurityQuizModal.selectors.js @@ -3,7 +3,7 @@ import enContent from '../../../locales/languages/en.json'; export const SecurityQuizGetStartedModalSelectorsIDs = { QUIZ_GET_STARTED_CONTAINER: 'quiz-get-started-modal', QUIZ_GET_STARTED_BUTTON: 'quiz-get-started-button', - QUIZ_GET_STARTED_DISMISS_BUTTON: 'quiz-get-started-dismiss-button', + QUIZ_GET_STARTED_DISMISS: 'quiz-get-started-dismiss-button', }; export const SecurityQuizGetStartedModalSelectorsText = { @@ -12,7 +12,7 @@ export const SecurityQuizGetStartedModalSelectorsText = { export const SecurityQuestionOneModelSelectorsIDs = { QUIZ_QUESTION_ONE_CONTAINER: 'quiz-question-one-modal', - QUIZ_QUESTION_ONE_DISMISS_BUTTON: 'quiz-question-one-dismiss-button', + QUIZ_QUESTION_ONE_DISMISS: 'quiz-question-one-dismiss-button', QUIZ_QUESTION_ONE_WRONG_ANSWER: 'quiz-question-one-wrong-answer', QUIZ_QUESTION_ONE_RIGHT_ANSWER: 'quiz-question-one-right-answer', QUIZ_QUESTION_ONE_WRONG_ANSWER_TRY_AGAIN_BUTTON: @@ -22,19 +22,19 @@ export const SecurityQuestionOneModelSelectorsIDs = { export const SecurityQuizQuestionOneModalSelectorsText = { QUIZ_QUESTION_ONE: enContent.srp_security_quiz.question_one.question, - QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE: + QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_DESCRIPTION: enContent.srp_security_quiz.question_one.right_answer_description, - QUIZ_QUESTION_ONE_RIGHT_ANSWER_TITLE: + QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_TITLE: enContent.srp_security_quiz.question_one.right_answer_title, - QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE: + QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_DESCRIPTION: enContent.srp_security_quiz.question_one.wrong_answer_description, - QUIZ_QUESTION_ONE_WRONG_ANSWER_TITLE: + QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_TITLE: enContent.srp_security_quiz.question_one.wrong_answer_title, }; export const SecurityQuestionTwoModelSelectorsIDs = { QUIZ_QUESTION_TWO_CONTAINER: 'quiz-question-two-modal', - QUIZ_QUESTION_TWO_DISMISS_BUTTON: 'quiz-question-two-dismiss-button', + QUIZ_QUESTION_TWO_DISMISS: 'quiz-question-two-dismiss-button', QUIZ_QUESTION_TWO_WRONG_ANSWER: 'quiz-question-two-wrong-answer', QUIZ_QUESTION_TWO_RIGHT_ANSWER: 'quiz-question-two-right-answer', QUIZ_QUESTION_TWO_WRONG_ANSWER_TRY_AGAIN_BUTTON: @@ -44,12 +44,12 @@ export const SecurityQuestionTwoModelSelectorsIDs = { export const SecurityQuizQuestionTwoModalSelectorsText = { QUIZ_QUESTION_TWO: enContent.srp_security_quiz.question_two.question, - QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE: + QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_DESCRIPTION: enContent.srp_security_quiz.question_two.right_answer_description, - QUIZ_QUESTION_TWO_RIGHT_ANSWER_TITLE: + QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_TITLE: enContent.srp_security_quiz.question_two.right_answer_title, - QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE: + QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_DESCRIPTION: enContent.srp_security_quiz.question_two.wrong_answer_description, - QUIZ_QUESTION_TWO_WRONG_ANSWER_TITLE: + QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_TITLE: enContent.srp_security_quiz.question_two.wrong_answer_title, }; diff --git a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js index 253acbcad55..fa8cf82654b 100644 --- a/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js +++ b/e2e/specs/accounts/secret_recovery_phrase_quiz.spec.js @@ -42,28 +42,50 @@ describe(SmokeAccounts('Secret Recovery Phrase Quiz'), () => { await SecurityQuizModal.tapGetStartedButton(); // Question 1 + await Assertions.checkIfVisible(SecurityQuizModal.getQuizQuestionOne); await SecurityQuizModal.tapQuestionOneWrongAnswerButton(); await Assertions.checkIfTextIsDisplayed( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_TITLE, + ); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_WRONG_ANSWER_RESPONSE_DESCRIPTION, ); await SecurityQuizModal.tapQuestionOneWrongAnswerTryAgainButton(); + await Assertions.checkIfVisible(SecurityQuizModal.getQuizQuestionOne); await SecurityQuizModal.tapQuestionOneRightAnswerButton(); await Assertions.checkIfTextIsDisplayed( - SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE, + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_TITLE, + ); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionOneModalSelectorsText.QUIZ_QUESTION_ONE_RIGHT_ANSWER_RESPONSE_DESCRIPTION, ); await SecurityQuizModal.tapQuestionOneContinueButton(); + await Assertions.checkIfNotVisible( + SecurityQuizModal.questionOneRightContinueButton, + ); // // // Question 2 + await Assertions.checkIfVisible(SecurityQuizModal.getQuizQuestionTwo); await SecurityQuizModal.tapQuestionTwoWrongAnswerButton(); await Assertions.checkIfTextIsDisplayed( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_TITLE, + ); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_WRONG_ANSWER_RESPONSE_DESCRIPTION, ); await SecurityQuizModal.tapQuestionTwoWrongAnswerTryAgainButton(); + await Assertions.checkIfVisible(SecurityQuizModal.getQuizQuestionTwo); await SecurityQuizModal.tapQuestionTwoRightAnswerButton(); await Assertions.checkIfTextIsDisplayed( - SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE, + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_TITLE, + ); + await Assertions.checkIfTextIsDisplayed( + SecurityQuizQuestionTwoModalSelectorsText.QUIZ_QUESTION_TWO_RIGHT_ANSWER_RESPONSE_DESCRIPTION, ); await SecurityQuizModal.tapQuestionTwoContinueButton(); + await Assertions.checkIfNotVisible( + SecurityQuizModal.questionTwoRightContinueButton, + ); }, ); });