Skip to content

Commit

Permalink
fix test waiting for refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Apr 9, 2024
1 parent 1a5c894 commit b308565
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/ui/cypress/tests/multisig-creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { notifications } from '../support/page-objects/notifications'
import { topMenuItems } from '../support/page-objects/topMenuItems'
import { landingPage } from '../support/page-objects/landingPage'
import { waitForTxRequest } from '../utils/waitForTxRequests'
import { waitForMultisigLength } from '../utils/waitForMultisigLength'

const fundedAccount1 = testAccounts['Funded Account 1 Chopsticks Kusama']
const fundedAccount2 = testAccounts['Funded Account 2 Chopsticks Kusama']
Expand All @@ -23,7 +24,7 @@ const typeAndAdd = (address: string) => {
newMultisigPage.addButton().click()
}

const acceptMultisigCreationAndVerifyNotifications = () => {
const acceptMultisigCreationAndVerifyNotifications = (firstMultisig = false) => {
waitForTxRequest()
cy.getTxRequests().then((req) => {
const txRequests = Object.values(req)
Expand All @@ -36,6 +37,8 @@ const acceptMultisigCreationAndVerifyNotifications = () => {
notifications.loadingNotificationIcon().should('be.visible')
notifications.notificationWrapper().should('contain', 'broadcast')

firstMultisig && landingPage.firstMultisigCreationLabel().should('be.visible')

notifications.successNotificationIcon(30000).should('be.visible')
notifications.notificationWrapper().should('contain', 'Tx in block')
})
Expand Down Expand Up @@ -89,7 +92,7 @@ describe('Multisig creation', () => {
newMultisigPage.nextButton().should('contain', 'Next').click()
})

it('Create a multisig with a pure proxy', () => {
it.only('Create a multisig with a pure proxy', () => {
const multisigName = 'Multisig with proxy'
const expectedMultisigAddress = 'D9b1mkwhCwyRMUQZLyyKPdVkiJfFCuyVuWr3EmYAV6ETXkX'

Expand All @@ -102,9 +105,7 @@ describe('Multisig creation', () => {
newMultisigPage.step3.infoBox().should('contain', '1 batch transaction')
newMultisigPage.step3.errorNotEnoughFunds().should('not.exist')
newMultisigPage.nextButton().should('contain', 'Create').click()
acceptMultisigCreationAndVerifyNotifications()

landingPage.firstMultisigCreationLabel().should('be.visible')
acceptMultisigCreationAndVerifyNotifications(true)

// Landing Page
multisigPage.accountHeader(10000).within(() => {
Expand All @@ -124,7 +125,7 @@ describe('Multisig creation', () => {
})
})

it('Create a multisig without a pure proxy', () => {
it.only('Create a multisig without a pure proxy', () => {
const multisigName = 'Multisig without proxy'
const expectedMultisigAddress = 'F764i4HX9LvpW14injFtt9MThuifVdic8PnuPtUAVvMDiwD'
const expectedMultisigAddressFirst6Char = expectedMultisigAddress.slice(0, 6)
Expand All @@ -149,6 +150,8 @@ describe('Multisig creation', () => {
// The banner should disappear
landingPage.multisigCreationInfoBanner().should('not.exist')

waitForMultisigLength(2)

topMenuItems
.desktopMenu()
.within(() =>
Expand Down
13 changes: 13 additions & 0 deletions packages/ui/cypress/utils/waitForMultisigLength.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { multisigPage } from '../support/page-objects/multisigPage'
import { topMenuItems } from '../support/page-objects/topMenuItems'

export const waitForMultisigLength = (length: number) =>
cy.waitUntil(() => {
multisigPage.accountHeader().click()
return topMenuItems
.multiproxySelectorDesktop()
.click()
.then(() => {
return topMenuItems.multiproxySelectorOptionDesktop().then((el) => el.length === length)
})
})

0 comments on commit b308565

Please sign in to comment.