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

Support sending assethub assets #628

Merged
merged 10 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add tests
  • Loading branch information
Tbaut committed Jan 27, 2025
commit ad7aecefe7d945d128f76e2371df22cd3140954c
21 changes: 19 additions & 2 deletions packages/ui/cypress/fixtures/polkadotAccounts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { InjectedAccountWitMnemonic } from './testAccounts'

export const expectedPolkadotMultisigAddress = '12niVg1BaFNjWDgtsneoiUQqZ1KB6YBGG68JLrNomYScckrQ'
export const expectedPolkadotMultisigAddressClow =
'12niVg1BaFNjWDgtsneoiUQqZ1KB6YBGG68JLrNomYScckrQ'

export const polkadotMemberAccount = {
// this is the member of a multisig on Polkadot
Expand All @@ -10,5 +11,21 @@ export const polkadotMemberAccount = {
name: 'Clow',
type: 'sr25519',
mnemonic: ''
} as InjectedAccountWitMnemonic
} as InjectedAccountWitMnemonic,
// this is a pure on Polkadot
CultureDot: {
address: '158sHoKeq7ZesHMLcp2MkxFQpd7caEW6Rcy1md3AK1fuX8ak',
publicKey: '0xb6f0f10eec993f3e6806eb6cc4d2f13d5f5a90a17b855a7bf9847a87e07ee322',
name: 'CultureDot',
type: 'sr25519',
mnemonic: ''
} as InjectedAccountWitMnemonic,
// this is a pure on Polkadot
unknown: {
address: '12QZUSm3c2HMjKFDdsY5XVT4gTJeUCiupRA5zUaQmSmnhToK',
publicKey: '0x3e3431343e95883c170859a65d5c00e5bf15113ff92b57ea7a2adbf6cdf90629',
name: 'unknown',
type: 'sr25519',
mnemonic: ''
}
}
59 changes: 0 additions & 59 deletions packages/ui/cypress/tests/asset-hub-account-display.cy.ts

This file was deleted.

127 changes: 127 additions & 0 deletions packages/ui/cypress/tests/multisig-pure-display.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { multisigPage } from '../support/page-objects/multisigPage'
import { accountDisplay } from '../support/page-objects/components/accountDisplay'
import { kusamaAHMemberAccount, expectedKusamaAHMultisigAddress } from '../fixtures/kusamaAssetHub'
import { landingPageNetwork, landingPageNetworkAddress } from '../fixtures/landingData'
import {
expectedPolkadotMultisigAddressClow,
polkadotMemberAccount
} from '../fixtures/polkadotAccounts'

describe('Shows the right assets depending on the network', () => {
it('Shows the right assets balance on the Asset hub landing page', () => {
cy.setupAndVisit({
url: landingPageNetwork('asset-hub-polkadot'),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: [kusamaAHMemberAccount.Nikos]
})

multisigPage
.accountHeader(6000)
.should('be.visible')
.within(() => {
accountDisplay
.addressLabel()
.should('be.visible')
.and('contain.text', expectedKusamaAHMultisigAddress.slice(0, 6))
multisigPage.assetHubBalance('1337').should('be.visible')
multisigPage.assetHubBalance('1337').should('contain.text', '1 USDC')
multisigPage.assetHubBalance('1984').should('be.visible')
multisigPage.assetHubBalance('1984').should('contain.text', '0 USDt')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', '1 DOT')
})
})

it('Shows only the native balance on a non asset hub landing page with multisig', () => {
cy.setupAndVisit({
url: landingPageNetworkAddress({
network: 'polkadot',
address: expectedPolkadotMultisigAddressClow
}),
extensionConnectionAllowed: true,
injectExtensionWithAccounts: [polkadotMemberAccount.Clow]
})

multisigPage
.accountHeader(6000)
.should('be.visible')
.within(() => {
accountDisplay
.addressLabel()
.should('be.visible')
.and('contain.text', expectedPolkadotMultisigAddressClow.slice(0, 6))
multisigPage.assetHubBalance('1337').should('not.exist')
multisigPage.assetHubBalance('1984').should('not.exist')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', 'DOT')
})
})

it('Shows only the native balance on a non asset hub landing page with pure', () => {
cy.setupAndVisit({
url: landingPageNetwork('polkadot'),
extensionConnectionAllowed: true,
watchedAccounts: [polkadotMemberAccount.CultureDot.publicKey || '']
})

multisigPage
.accountHeader(6000)
.should('be.visible')
.within(() => {
accountDisplay
.addressLabel()
.should('be.visible')
.and('contain.text', polkadotMemberAccount.CultureDot.address.slice(0, 6))
multisigPage.assetHubBalance('1337').should('not.exist')
multisigPage.assetHubBalance('1984').should('not.exist')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', 'DOT')
})

multisigPage
.balanceListItem()
.should('be.visible')
.within(() => {
multisigPage.assetHubBalance('1337').should('not.exist')
multisigPage.assetHubBalance('1984').should('not.exist')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', 'DOT')
})
})

it('Shows all the balances on a asset hub landing page with pure', () => {
cy.setupAndVisit({
url: landingPageNetwork('asset-hub-polkadot'),
extensionConnectionAllowed: true,
watchedAccounts: [polkadotMemberAccount.unknown.publicKey || '']
})

multisigPage
.accountHeader(6000)
.should('be.visible')
.within(() => {
accountDisplay
.addressLabel()
.should('be.visible')
.and('contain.text', polkadotMemberAccount.unknown.address.slice(0, 6))
multisigPage.assetHubBalance('1337').should('exist')
multisigPage.assetHubBalance('1337').should('contain.text', 'USDC')
multisigPage.assetHubBalance('1984').should('exist')
multisigPage.assetHubBalance('1984').should('contain.text', 'USDt')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', 'DOT')
})

multisigPage
.balanceListItem()
.should('be.visible')
.within(() => {
multisigPage.assetHubBalance('1337').should('exist')
multisigPage.assetHubBalance('1337').should('contain.text', 'USDC')
multisigPage.assetHubBalance('1984').should('exist')
multisigPage.assetHubBalance('1984').should('contain.text', 'USDt')
multisigPage.nativeBalance().should('be.visible')
multisigPage.nativeBalance().should('contain.text', 'DOT')
})
})
})
Loading