-
Notifications
You must be signed in to change notification settings - Fork 20
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
11 changed files
with
250 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { InjectedAccountWitMnemonic } from './testAccounts' | ||
|
||
export const westendMemberAccount = { | ||
// this is the member of a multisig and a multisig with Pure | ||
// use in hidden-accounts | ||
hidden: { | ||
account: { | ||
address: '5CPG8FMciJBBE47YwSQHte23tTz91egixJw514g6BCt5nHPz', | ||
publicKey: '0x0e270b0984354e0f6033dee93293dbeaea366220ca59e584ba7614d8bf393040', | ||
name: 'hidden', | ||
type: 'sr25519', | ||
mnemonic: '' | ||
} as InjectedAccountWitMnemonic, | ||
expectedSingleMultisig: { | ||
westEndAddress: '5CvCLBVHufgqTDUVJL3xY6Pd7TVaYtaTGzvYRfGeaAPJLdDS', | ||
paseoAddress: '1rVUWkMmSxJtkV1Fy6xgFDmy5VEFC8bMVf2axG18FQpX7hE', | ||
pubKey: '0x25bee0c82d1a5ea1ef4f75b4cb517286a78ed51ab934b1636ac4d8b018811b1b' | ||
}, | ||
expectedPure: { | ||
address: '5DqS9vsnXotmczKu87xb5KMUARCVF5JUUVveZz9R8UvXKExK', | ||
pubKey: '0x4e596aec4922957174ba3f86860cca88fa4664006b511f11260cc34ca303d0dd' | ||
} | ||
} | ||
} |
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,168 @@ | ||
import { accountDisplay } from '../support/page-objects/components/accountDisplay' | ||
import { | ||
getSettingsPageHiddenAccountUrl, | ||
landingPageNetwork, | ||
landingPageNetworkAddress | ||
} from '../fixtures/landingData' | ||
import { settingsPage } from '../support/page-objects/settingsPage' | ||
import { westendMemberAccount } from '../fixtures/westendAccounts' | ||
import { topMenuItems } from '../support/page-objects/topMenuItems' | ||
import { multisigPage } from '../support/page-objects/multisigPage' | ||
import { landingPage } from '../support/page-objects/landingPage' | ||
|
||
const randomAddress = 'HeVswqunza8rP2hEWDCThfiB5v2Jxng91yX2oGAZnCKtsgS' | ||
|
||
const addHiddenAccount = (address: string) => { | ||
settingsPage.hiddenAccountsInputsWrapper().within(() => { | ||
settingsPage.accountAddressInput().type(`${address}{enter}`, { delay: 20, timeout: 8000 }) | ||
|
||
settingsPage.addButton().should('be.enabled') | ||
settingsPage.addButton().click() | ||
}) | ||
} | ||
|
||
const goToHiddenAccountSettings = () => { | ||
topMenuItems.settingsButton().click() | ||
settingsPage.hiddenAccountsAccordion().click() | ||
} | ||
|
||
describe('Hidden Accounts', () => { | ||
it('adds an account with a name to the hidden list', () => { | ||
cy.setupAndVisit({ | ||
url: landingPageNetwork('westend'), | ||
extensionConnectionAllowed: true, | ||
injectExtensionWithAccounts: [westendMemberAccount.hidden.account] | ||
}) | ||
goToHiddenAccountSettings() | ||
topMenuItems.multiproxySelectorDesktop().should('be.visible').click() | ||
topMenuItems.multiproxySelectorOptionDesktop().should('have.length', 2) | ||
|
||
//hide random account | ||
addHiddenAccount(randomAddress) | ||
topMenuItems.multiproxySelectorDesktop().should('be.visible').click() | ||
topMenuItems.multiproxySelectorOptionDesktop().should('have.length', 2) | ||
settingsPage.hiddenAccountsContainer().should('be.visible') | ||
settingsPage.hiddenAccountsContainer().within(() => { | ||
accountDisplay.identicon().should('be.visible') | ||
accountDisplay.addressLabel().should('be.visible') | ||
settingsPage.hiddenAccountDeleteButton().should('be.visible') | ||
}) | ||
|
||
//hide the multisig account | ||
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress) | ||
settingsPage.hiddenAccountsContainer().should('have.length', 2) | ||
topMenuItems.multiproxySelectorDesktop().should('be.visible').click() | ||
// the multisig should be hidden | ||
topMenuItems.multiproxySelectorOptionDesktop().should('have.length', 1) | ||
topMenuItems | ||
.multiproxySelectorOptionDesktop() | ||
.should('contain', westendMemberAccount.hidden.expectedPure.address.slice(0, 6)) | ||
}) | ||
|
||
it('hides all accounts sequentially and we switches to the available accounts if any', () => { | ||
cy.setupAndVisit({ | ||
url: landingPageNetworkAddress({ | ||
network: 'westend', | ||
address: westendMemberAccount.hidden.expectedPure.address | ||
}), | ||
extensionConnectionAllowed: true, | ||
injectExtensionWithAccounts: [westendMemberAccount.hidden.account] | ||
}) | ||
//land on the pure | ||
multisigPage.accountHeader().within(() => { | ||
accountDisplay | ||
.addressLabel() | ||
.should('contain.text', westendMemberAccount.hidden.expectedPure.address.slice(0, 6)) | ||
}) | ||
cy.url().should('include', westendMemberAccount.hidden.expectedPure.address) | ||
goToHiddenAccountSettings() | ||
addHiddenAccount(westendMemberAccount.hidden.expectedPure.address) | ||
// we should now have only the single multisig and have it selected | ||
cy.url().should('include', westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress) | ||
topMenuItems.homeButton().click() | ||
multisigPage.accountHeader().within(() => { | ||
accountDisplay | ||
.addressLabel() | ||
.should( | ||
'contain.text', | ||
westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress.slice(0, 6) | ||
) | ||
}) | ||
|
||
topMenuItems.multiproxySelectorDesktop().should('be.visible').click() | ||
topMenuItems.multiproxySelectorOptionDesktop().should('have.length', 1) | ||
goToHiddenAccountSettings() | ||
settingsPage | ||
.hiddenAccountsContainer() | ||
.should('have.length', 1) | ||
.within(() => { | ||
accountDisplay.identicon().should('be.visible') | ||
accountDisplay | ||
.addressLabel() | ||
.should('contain.text', westendMemberAccount.hidden.expectedPure.address.slice(0, 6)) | ||
settingsPage.hiddenAccountDeleteButton().should('be.visible') | ||
}) | ||
|
||
// hide all accounts and expect an error | ||
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress) | ||
topMenuItems.multiproxySelectorDesktop().should('not.exist') | ||
topMenuItems.homeButton().click() | ||
landingPage | ||
.noMultisigFoundError() | ||
.should('contain.text', 'No multisig found for your accounts or watched accounts on westend.') | ||
}) | ||
|
||
it('hides accounts per network only', () => { | ||
cy.setupAndVisit({ | ||
url: landingPageNetworkAddress({ | ||
network: 'westend', | ||
address: westendMemberAccount.hidden.expectedPure.address | ||
}), | ||
extensionConnectionAllowed: true, | ||
injectExtensionWithAccounts: [westendMemberAccount.hidden.account], | ||
hiddenAccounts: [ | ||
{ network: 'westend', pubKey: westendMemberAccount.hidden.expectedPure.pubKey }, | ||
{ network: 'westend', pubKey: westendMemberAccount.hidden.expectedSingleMultisig.pubKey } | ||
] | ||
}) | ||
|
||
landingPage.linkedAddressNotFound().should('be.visible') | ||
// change network paseo should have 1 multisig | ||
topMenuItems.desktopMenu().within(() => topMenuItems.networkSelector().click()) | ||
topMenuItems.networkSelectorOption('paseo').click() | ||
|
||
topMenuItems.multiproxySelectorDesktop().should('be.visible').click() | ||
topMenuItems | ||
.multiproxySelectorOptionDesktop() | ||
.should('have.length', 1) | ||
.should( | ||
'contain', | ||
westendMemberAccount.hidden.expectedSingleMultisig.paseoAddress.slice(0, 6) | ||
) | ||
|
||
// there should be no account in the list | ||
// since it's per network | ||
goToHiddenAccountSettings() | ||
settingsPage.hiddenAccountsContainer().should('not.exist') | ||
}) | ||
|
||
it('can see error when attempting to add same address more than once', () => { | ||
// add an account first | ||
cy.visit(getSettingsPageHiddenAccountUrl()) | ||
addHiddenAccount(randomAddress) | ||
settingsPage.hiddenAccountsContainer().should('have.length', 1) | ||
// attempt to add the same account again | ||
addHiddenAccount(randomAddress) | ||
settingsPage.errorLabel().should('be.visible').should('have.text', 'Account already added') | ||
settingsPage.hiddenAccountsContainer().should('have.length', 1) | ||
settingsPage.addButton().should('be.disabled') | ||
}) | ||
|
||
it('can see error when attempting to add an invalid address', () => { | ||
cy.visit(getSettingsPageHiddenAccountUrl()) | ||
addHiddenAccount('123') | ||
settingsPage.errorLabel().should('be.visible').should('have.text', 'Invalid address') | ||
settingsPage.hiddenAccountsContainer().should('have.length', 0) | ||
settingsPage.addButton().should('be.disabled') | ||
}) | ||
}) |
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
Oops, something went wrong.