Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Feb 26, 2025
1 parent 697e4ed commit 49f1827
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { setIdentitySignatories } from './setIdentitySignatories'
import { identitySignatories } from './setIdentitySignatories'

export const setIdentityMultisigs = {
'multisig-without-identity': {
name: 'Multisig With Pure',
address: '5Hca6oEWVEYobPv8vw1PYUmGiz8AHUD2CDgXdedqoBwWZPK9',
threshold: 2,
signatories: [setIdentitySignatories[1].address, setIdentitySignatories[2].address]
signatories: [identitySignatories[1].address, identitySignatories[2].address]
},

// this is a multisig I use all the time. Because Rococo now filters identity calls
Expand All @@ -14,6 +14,6 @@ export const setIdentityMultisigs = {
name: 'Multisig with identity',
address: '15KHTWdJyzyxaQbBNRmQN89KmFr1jPXXsPHM5Rxvd1Tkb2XZ',
threshold: 2,
signatories: [setIdentitySignatories[4]]
signatories: [identitySignatories[4]]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InjectedAccountWitMnemonic } from '../testAccounts'

export const setIdentitySignatories = [
export const identitySignatories = [
// signatories of multisig-with-identity
{
address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/cypress/fixtures/westendAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { InjectedAccountWitMnemonic } from './testAccounts'

export const westendMemberAccount = {
// this is the member of a multisig and a multisig with Pure
// use in hidden-accounts
// used in hidden-accounts
// used in identity (it has one on Westend)
hidden: {
account: {
address: '5CPG8FMciJBBE47YwSQHte23tTz91egixJw514g6BCt5nHPz',
Expand All @@ -12,7 +13,7 @@ export const westendMemberAccount = {
mnemonic: ''
} as InjectedAccountWitMnemonic,
expectedSingleMultisig: {
westEndAddress: '5CvCLBVHufgqTDUVJL3xY6Pd7TVaYtaTGzvYRfGeaAPJLdDS',
westendAddress: '5CvCLBVHufgqTDUVJL3xY6Pd7TVaYtaTGzvYRfGeaAPJLdDS',
paseoAddress: '1rVUWkMmSxJtkV1Fy6xgFDmy5VEFC8bMVf2axG18FQpX7hE',
pubKey: '0x25bee0c82d1a5ea1ef4f75b4cb517286a78ed51ab934b1636ac4d8b018811b1b'
},
Expand Down
10 changes: 5 additions & 5 deletions packages/ui/cypress/tests/hidden-accounts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Hidden Accounts', () => {
})

//hide the multisig account
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress)
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westendAddress)
settingsPage.hiddenAccountsContainer().should('have.length', 2)
topMenuItems.multiproxySelectorDesktop().should('be.visible').click()
// the multisig should be hidden
Expand Down Expand Up @@ -83,14 +83,14 @@ describe('Hidden Accounts', () => {
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)
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)
westendMemberAccount.hidden.expectedSingleMultisig.westendAddress.slice(0, 6)
)
})

Expand All @@ -109,7 +109,7 @@ describe('Hidden Accounts', () => {
})

// hide all accounts and expect an error
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress)
addHiddenAccount(westendMemberAccount.hidden.expectedSingleMultisig.westendAddress)
topMenuItems.multiproxySelectorDesktop().should('not.exist')
topMenuItems.homeButton().click()
landingPage
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('Hidden Accounts', () => {
hiddenAccountInfoModal.checkBoxMessage().should('not.be.checked')
hiddenAccountInfoModal.gotItButton().should('be.visible').click()
landingPage.transactionListLoader().should('not.exist')
cy.url().should('include', westendMemberAccount.hidden.expectedSingleMultisig.westEndAddress)
cy.url().should('include', westendMemberAccount.hidden.expectedSingleMultisig.westendAddress)
topMenuItems.multiproxySelectorDesktop().should('be.visible').click()
topMenuItems.multiproxySelectorOptionDesktop().should('have.length', 1)
goToHiddenAccountSettings()
Expand Down
80 changes: 54 additions & 26 deletions packages/ui/cypress/tests/identity.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
import { landingPageNetwork } from '../fixtures/landingData'
import { extrinsicsDisplayAccounts } from '../fixtures/extrinsicsDisplayAccounts'
import { landingPageNetwork, landingPageNetworkAddress } from '../fixtures/landingData'
import { setIdentityMultisigs } from '../fixtures/setIdentity/setIdentityMultisigs'
import { setIdentitySignatories } from '../fixtures/setIdentity/setIdentitySignatories'
import { identitySignatories } from '../fixtures/setIdentity/setIdentitySignatories'
import { westendMemberAccount } from '../fixtures/westendAccounts'
import { multisigPage } from '../support/page-objects/multisigPage'
import { sendTxModal } from '../support/page-objects/sendTxModal'
import { topMenuItems } from '../support/page-objects/topMenuItems'
// import { waitForTxRequest } from '../utils/waitForTxRequests'

describe('Set an identity', () => {
// joystream network isn't supported any more.
it.skip('Does not have the identity option if the pallet is not present', () => {
const multisigSignatoryWithoutIdentity = setIdentitySignatories[3]
// we only support identity on the ppl chain with system chains
it('Does not have the identity option if it is a parachain', () => {
cy.setupAndVisit({
url: landingPageNetwork('joystream'),
url: landingPageNetwork('hydration'),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: [multisigSignatoryWithoutIdentity]
injectExtensionWithAccounts: [extrinsicsDisplayAccounts['Alice']]
})
multisigPage.accountHeader(8000).should('exist')
multisigPage.optionsMenuButton().click()
multisigPage.setIdentityMenuOption().should('not.exist')

//click outside to close the menu
cy.get('body').click(0, 0)
multisigPage.newTransactionButton().click()
sendTxModal.selectEasySetup().should('contain', 'Send tokens').click()
sendTxModal.selectionEasySetupSetIdentity().should('not.exist')
})

it('Does not have the ability to set a an identity on a pure proxy', () => {
cy.setupAndVisit({
url: landingPageNetworkAddress({
network: 'polkadot',
address: setIdentityMultisigs['pure-with-polkadot-identity'].address
}),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: setIdentityMultisigs['pure-with-polkadot-identity'].signatories
})
// select the right multisig (Alice has a lot)
const first5DigitsAddress = setIdentityMultisigs['pure-with-polkadot-identity'].address.slice(
0,
4
)
multisigPage.accountHeader().should('contain', first5DigitsAddress)

multisigPage.optionsMenuButton().click()
multisigPage.setIdentityMenuOption().should('not.exist')

Expand Down Expand Up @@ -89,36 +117,36 @@ describe('Set an identity', () => {
// })
// })

// skipping since identity now needs to be handled with the associatedppl chain
it.skip('Can edit an identity from the new tx button', () => {
it('Can edit an identity from the new tx button', () => {
cy.setupAndVisit({
url: landingPageNetwork('polkadot'),
url: landingPageNetworkAddress({
network: 'westend',
address: westendMemberAccount.hidden.expectedSingleMultisig.westendAddress
}),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: setIdentityMultisigs['pure-with-polkadot-identity'].signatories
injectExtensionWithAccounts: [westendMemberAccount.hidden.account]
})
// select the right multisig (Alice has a lot)
const first5DigitsAddress = setIdentityMultisigs['pure-with-polkadot-identity'].address.slice(
0,
4
)
topMenuItems
.desktopMenu()
.within(() =>
topMenuItems
.multiproxySelectorDesktop()
.click()
.type(`${first5DigitsAddress}{downArrow}{enter}`)
)
const first5DigitsAddress =
westendMemberAccount.hidden.expectedSingleMultisig.westendAddress.slice(0, 4)
// topMenuItems
// .desktopMenu()
// .within(() =>
// topMenuItems
// .multiproxySelectorDesktop()
// .click()
// .type(`${first5DigitsAddress}{downArrow}{enter}`)
// )
multisigPage.accountHeader().should('contain', first5DigitsAddress)

multisigPage.newTransactionButton().click()
sendTxModal.selectEasySetup().should('contain', 'Send tokens').click()
sendTxModal.selectionEasySetupSetIdentity().click()

const expectedIdentity = {
display: 'The Kus DOT Delegate',
twitter: '@TheKusamarian',
email: 'hey@thekusamarian.xyz'
display: 'to be hidden',
twitter: '@hidden',
email: 'hey@hidden.xyz'
}

// Some fields should be pre-filled
Expand Down

0 comments on commit 49f1827

Please sign in to comment.