-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
108 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import {by, element} from 'detox' | ||
|
||
export const mnemonic15WordTypeCard = () => element(by.id('mnemonic-15-word')) | ||
export const mnemonic24wordTypeCard = () => element(by.id('mnemonic-24-word')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
import {by, element} from 'detox' | ||
|
||
export const restoreNormalWalletButton = () => element(by.id('restoreNormalWalletButton')) | ||
export const restore24WordWalletButton = () => element(by.id('restore24WordWalletButton')) | ||
export const restoreReadOnlyWalletButton = () => element(by.id('importReadOnlyWalletButton')) | ||
export const step1Title = () => element(by.text('Enter recovery phrase')) | ||
|
||
export const mnemonicInputsView = () => element(by.id('mnemonicInputsView')) | ||
export const mnemonicByIndexInput = (wordIndex: number, platform: string) => | ||
platform === 'android' | ||
? element(by.type(`android.widget.EditText`)).atIndex(wordIndex) | ||
: element(by.id(`mnemonicInput${wordIndex}`)) | ||
export const mnemonicRestoreWalletButton = () => element(by.id('restoreButton')) | ||
|
||
export const walletChecksumText = () => element(by.id('walletChecksum')) | ||
export const verifyWalletContinueButton = () => element(by.id('verifyWalletContinueButton')) | ||
export const step1RecoveryPhraseSuccessMessage = () => element(by.text('The recovery phrase is verified')) | ||
export const step1Clear_AllButton = () => element(by.id('clearAll-button')) | ||
export const step1NextButton = () => element(by.id('setup-restore-step1-next-button')) | ||
|
||
export const credentialsView = () => element(by.id('credentialsView')) | ||
export const walletNameInput = () => element(by.id('walletNameInput')) | ||
export const spendingPasswordInput = () => element(by.id('walletPasswordInput')) | ||
export const repeatSpendingPasswordInput = () => element(by.id('walletRepeatPasswordInput')) | ||
export const credentialsContinueButton = () => element(by.id('walletFormContinueButton')) | ||
export const step2Title1OnModal = () => element(by.text('What is wallet name')) | ||
export const step2Title2OnModal = () => element(by.text('What is password')) | ||
export const step2ModalContinueButton = () => element(by.id('setup-modal-continue-button')) | ||
|
||
export const walletPlateNumber = () => element(by.id('wallet-plate-number')) | ||
|
||
export const step2WalletNameInput = () => element(by.id('walletNameInput')) | ||
export const step2SpendingPasswordInput = () => element(by.id('walletPasswordInput')) | ||
export const step2RepeatSpendingPasswordInput = () => element(by.id('walletRepeatPasswordInput')) | ||
export const step2NextButton = () => element(by.id('setup-restore-step2-next-button')) | ||
|
||
export const praparingYourWalletMessage = () => element(by.text('Preparing your wallet...')) | ||
|
||
export const enterRecoveryPhrase = async (phraseArray: string[], platform: string): Promise<void> => { | ||
for (let wordIndex = 0; wordIndex < phraseArray.length; wordIndex++) { | ||
const wordElementInput = mnemonicByIndexInput(wordIndex, platform) | ||
await wordElementInput.typeText(`${phraseArray[wordIndex]}\n`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,54 @@ | ||
import {device, expect} from 'detox' | ||
|
||
import * as constants from '../../general/constants' | ||
import * as myWalletsScreen from '../../screens/myWallets.screen' | ||
import * as restoreWalletFlow from '../../screens/restoreWalletFlow.screen' | ||
import * as utils from '../../general/utils' | ||
import * as chooseSetupTypeScreen from '../../screens/chooseSetupType.screen' | ||
import * as chooseNetworkTypeScreen from '../../screens/chooseNetworkType.screen' | ||
import * as chooseMnemonicTypeScreen from '../../screens/chooseMnemonicType.screen' | ||
|
||
describe('Restore a wallet', () => { | ||
let platform: string | ||
|
||
beforeAll(async () => { | ||
const vars: any = await utils.initialize() | ||
platform = vars.platform | ||
await device.launchApp({newInstance: true}) | ||
await utils.prepareApp(constants.valid_Pin) | ||
}) | ||
|
||
it('should be able to initiate the "restore wallet" process from home screen', async () => { | ||
await myWalletsScreen.addWalletTestnetButton().tap() | ||
await myWalletsScreen.restoreWalletButton().tap() | ||
await restoreWalletFlow.restoreNormalWalletButton().tap() | ||
it('should be able to select "restore wallet"', async () => { | ||
await chooseSetupTypeScreen.restoreWalletButton().tap() | ||
await expect(chooseNetworkTypeScreen.pageTitleCreateFlow()).toBeVisible() | ||
}) | ||
|
||
it('should be able to select "preprod" network', async () => { | ||
await chooseNetworkTypeScreen.networkTestnetButton().tap() | ||
await expect(chooseMnemonicTypeScreen.mnemonic15WordTypeCard()).toBeVisible() | ||
}) | ||
|
||
it('should be able to enter the 15-word recovery phrase', async () => { | ||
await utils.enterRecoveryPhrase(constants.normal_15_Word_Wallet.phrase, platform) | ||
await restoreWalletFlow.mnemonicRestoreWalletButton().tap() | ||
it('should be able to select "15 word" mnemonic type wallet', async () => { | ||
await chooseMnemonicTypeScreen.mnemonic15WordTypeCard().tap() | ||
await expect(restoreWalletFlow.step1Title()).toBeVisible() | ||
}) | ||
|
||
await expect(restoreWalletFlow.walletChecksumText()).toBeVisible() | ||
await expect(restoreWalletFlow.walletChecksumText()).toHaveText(constants.normal_15_Word_Wallet.checksum) | ||
await restoreWalletFlow.verifyWalletContinueButton().tap() | ||
await expect(restoreWalletFlow.credentialsView()).toBeVisible() | ||
it('should be able to complete "step1: 15-word recovery phrase"', async () => { | ||
await restoreWalletFlow.enterRecoveryPhrase(constants.normal_15_Word_Wallet.phrase, platform) | ||
await utils.takeScreenshot('Recovery Phrase entered') | ||
await expect(restoreWalletFlow.step1RecoveryPhraseSuccessMessage()).toBeVisible() | ||
await restoreWalletFlow.step1NextButton().tap() | ||
await expect(restoreWalletFlow.walletPlateNumber()).toBeVisible() | ||
}) | ||
|
||
it('should be able to set the spending password', async () => { | ||
await restoreWalletFlow.walletNameInput().typeText(constants.normal_15_Word_Wallet.name) | ||
await device.disableSynchronization() | ||
await restoreWalletFlow.spendingPasswordInput().typeText(constants.spending_Password) | ||
await restoreWalletFlow.repeatSpendingPasswordInput().typeText(`${constants.spending_Password}\n`) | ||
await device.enableSynchronization() | ||
await restoreWalletFlow.credentialsContinueButton().tap() | ||
await expect(myWalletsScreen.pageTitle()).toBeVisible() | ||
await expect(myWalletsScreen.walletByNameButton(constants.normal_15_Word_Wallet.name)).toBeVisible() | ||
it('should be able to complete "step2 : set credentials"', async () => { | ||
await expect(restoreWalletFlow.walletPlateNumber()).toHaveText(constants.normal_15_Word_Wallet.checksum) | ||
await restoreWalletFlow.step2WalletNameInput().tap() | ||
await restoreWalletFlow.step2WalletNameInput().typeText(constants.wallet_Name) | ||
await restoreWalletFlow.step2SpendingPasswordInput().tap() | ||
await restoreWalletFlow.step2SpendingPasswordInput().typeText(`${constants.spending_Password}\n`) | ||
await restoreWalletFlow.step2RepeatSpendingPasswordInput().tap() | ||
await restoreWalletFlow.step2RepeatSpendingPasswordInput().typeText(constants.spending_Password) | ||
await utils.takeScreenshot('Set the spending password') | ||
await restoreWalletFlow.step2NextButton().tap() | ||
await expect(restoreWalletFlow.praparingYourWalletMessage()).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters