Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed args style for setupWallet command #24

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,22 +410,24 @@ Cypress.Commands.add(
);

// Keplr Commands
Cypress.Commands.add(
'setupWallet',
(
secretWordsOrPrivateKey = 'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology',
Cypress.Commands.add('setupWallet', (args = {}) => {
const {
secretWords,
privateKey,
password = 'Test1234',
newAccount = false,
walletName = 'My Wallet',
) => {
return cy.task('setupWallet', {
secretWordsOrPrivateKey,
password,
newAccount,
walletName,
});
},
);
} = args;
return cy.task('setupWallet', {
secretWordsOrPrivateKey:
secretWords ||
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,
});
});

Cypress.Commands.add('acceptAccess', () => {
return cy.task('acceptAccess');
Expand Down
18 changes: 18 additions & 0 deletions support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,5 +505,23 @@ declare namespace Cypress {
viewportWidth: number,
viewportHeight: number,
): Chainable<Subject>;
/**
* Generic method to setup wallet (works for keplr only)
* @example
* cy.setupWallet();
* cy.setupWallet({
* secretWords: 'test test test test test test test test test test test junk',
* password: 'Password123',
* });
*/
setupWallet(
args: {
secretWords?: String;
privateKey?: String;
password?: String;
newAccount?: Boolean;
walletName?: String;
}
): Chainable<Subject>;
}
}
26 changes: 13 additions & 13 deletions tests/e2e/specs/keplr/keplr-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ describe('Keplr', () => {
);
});
it(`should create a new wallet using 24 word phrase`, () => {
cy.setupWallet(
'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology',
'Test1234',
true,
'My Wallet 2',
).then(setupFinished => {
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',
}).then(setupFinished => {
expect(setupFinished).to.be.true;
});
});
it(`should complete Keplr setup by importing the wallet using private key`, () => {
cy.setupWallet(
'A9C09B6E4AF70DE1F1B621CB1AA66CFD0B4AA977E4C18497C49132DD9E579485',
null,
false,
'My wallet 3',
).then(setupFinished => {
cy.setupWallet({
privateKey:
'A9C09B6E4AF70DE1F1B621CB1AA66CFD0B4AA977E4C18497C49132DD9E579485',
walletName: 'My wallet 3',
}).then(setupFinished => {
expect(setupFinished).to.be.true;
});
});
Expand Down Expand Up @@ -119,4 +119,4 @@ describe('Keplr', () => {
});
});
});
});
});
Loading