Skip to content

Commit

Permalink
refactor: removed newAccount param from setupWallet
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad committed Jun 10, 2024
1 parent 6aaee51 commit b22be79
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 24 deletions.
17 changes: 2 additions & 15 deletions commands/keplr.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,31 +178,20 @@ const keplr = {
async importWallet(
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
selectedChains,
) {
await module.exports.goToRegistration();
await playwright.waitAndClickByText(
newAccount
? onboardingElements.createWalletButton
: onboardingElements.existingWalletButton,
onboardingElements.existingWalletButton,
await playwright.keplrWindow(),
);

await playwright.waitAndClickByText(
newAccount
? onboardingElements.importRecoveryPhraseButton
: onboardingElements.useRecoveryPhraseButton,
onboardingElements.useRecoveryPhraseButton,
await playwright.keplrWindow(),
);

newAccount &&
(await playwright.waitAndClickByText(
onboardingElements.useRecoveryPhraseButton,
await playwright.keplrWindow(),
));

if (secretWordsOrPrivateKey.includes(' ')) {
await module.exports.importWalletWithPhrase(
secretWordsOrPrivateKey,
Expand Down Expand Up @@ -377,7 +366,6 @@ const keplr = {
{
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
selectedChains,
createNewWallet,
Expand All @@ -398,7 +386,6 @@ const keplr = {
await module.exports.importWallet(
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
selectedChains,
);
Expand Down
2 changes: 0 additions & 2 deletions pages/keplr/first-time-flow-page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const createWalletButton = 'Create a new wallet';
const existingWalletButton = 'Import an existing wallet';
const importRecoveryPhraseButton = 'Import existing recovery phrase';
const createNewRecoveryPhraseButton = 'Create new recovery phrase';
const showMyPhraseButton = 'I understood. Show my phrase.';
const copyToClipboardButton = 'Copy to clipboard';
Expand All @@ -24,7 +23,6 @@ const importButtonSelector = 'button:has-text("Import")';
module.exports.onboardingElements = {
existingWalletButton,
createWalletButton,
importRecoveryPhraseButton,
createNewRecoveryPhraseButton,
showMyPhraseButton,
copyToClipboardButton,
Expand Down
2 changes: 0 additions & 2 deletions plugins/keplr-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ module.exports = (on, config) => {
setupWallet: async ({
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
selectedChains,
createNewWallet,
}) => {
await keplr.initialSetup(null, {
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
selectedChains,
createNewWallet,
Expand Down
2 changes: 0 additions & 2 deletions support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ Cypress.Commands.add('setupWallet', (args = {}) => {
secretWords,
privateKey,
password = 'Test1234',
newAccount = false,
walletName = 'My Wallet',
selectedChains = [],
createNewWallet = false,
Expand All @@ -426,7 +425,6 @@ Cypress.Commands.add('setupWallet', (args = {}) => {
privateKey ||
'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology',
password,
newAccount,
walletName,
selectedChains,
createNewWallet,
Expand Down
1 change: 0 additions & 1 deletion support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ declare namespace Cypress {
secretWords?: string;
privateKey?: string;
password?: string;
newAccount?: boolean;
walletName?: string;
selectedChains?: Array<string>;
createNewWallet?: boolean;
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/specs/keplr/keplr-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ describe('Keplr', () => {
'Offer accepted',
);
});
it(`should create a new wallet using 24 word phrase`, () => {
it(`should import a wallet and add selected chains`, () => {
cy.setupWallet({
secretWords:
'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology',
password: 'Test1234',
newAccount: true,
walletName: 'My Wallet 2',
selectedChains: ['Agoric localhost', 'Secret Network'],
}).then(setupFinished => {
Expand Down

0 comments on commit b22be79

Please sign in to comment.