Skip to content

Commit

Permalink
export in function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Oct 12, 2023
1 parent fb833e4 commit 7e6bd79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 2 additions & 6 deletions packages/ui/cypress/tests/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ import { injectedAccounts } from '../fixtures/injectedAccounts'
import { landingPageUrl } from '../fixtures/landingData'
import { landingPage } from '../support/page-objects/landingPage'
import { topMenuItems } from '../support/page-objects/topMenuItems'
import { clickOnConnect } from '../utils/clickOnConnect'

describe('Connect Account', () => {
beforeEach(() => {
cy.visit(landingPageUrl)
cy.initExtension(injectedAccounts)
cy.clock()
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
cy.tick(500)
// restore the clock to prevent WS errors
cy.clock().invoke('restore')
clickOnConnect()
})

it('Reject connection', () => {
Expand Down
9 changes: 2 additions & 7 deletions packages/ui/cypress/tests/transactions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { injectedAccounts } from '../fixtures/injectedAccounts'
import { knownMultisigs } from '../fixtures/knownMultisigs'
import { landingPageUrl } from '../fixtures/landingData'
import { landingPage } from '../support/page-objects/landingPage'
import { multisigPage } from '../support/page-objects/multisigPage'
import { notifications } from '../support/page-objects/notifications'
import { sendTxModal } from '../support/page-objects/sendTxModal'
import { topMenuItems } from '../support/page-objects/topMenuItems'
import { clickOnConnect } from '../utils/clickOnConnect'
import { waitForTxRequest } from '../utils/waitForTxRequests'

const AliceAddress = Object.values(injectedAccounts)[0].address
Expand All @@ -20,12 +20,7 @@ describe('Perform transactions', () => {
beforeEach(() => {
cy.visit(landingPageUrl)
cy.initExtension(injectedAccounts)
cy.clock()
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
cy.tick(500)
// restore the clock to prevent WS errors
cy.clock().invoke('restore')
clickOnConnect()
cy.getAuthRequests().then((authRequests) => {
const requests = Object.values(authRequests)
// we should have 1 connection request to the extension
Expand Down
11 changes: 11 additions & 0 deletions packages/ui/cypress/utils/clickOnConnect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { landingPage } from '../support/page-objects/landingPage'
import { topMenuItems } from '../support/page-objects/topMenuItems'

export const clickOnConnect = () => {
cy.clock()
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
cy.tick(500)
// restore the clock to prevent WS errors
cy.clock().invoke('restore')
}

0 comments on commit 7e6bd79

Please sign in to comment.