Skip to content

Commit

Permalink
use tick instead of waituntil
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Oct 12, 2023
1 parent f3040eb commit fb833e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions packages/ui/cypress/tests/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ 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 { waitForAuthRequest } from '../utils/waitForAuthRequests'

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')
})

it('Reject connection', () => {
waitForAuthRequest()
cy.getAuthRequests().then((authRequests) => {
const requests = Object.values(authRequests)
// we should have 1 connection request to the extension
Expand All @@ -28,7 +30,6 @@ describe('Connect Account', () => {
})

it('Connects with Alice', () => {
waitForAuthRequest()
const AliceAddress = Object.values(injectedAccounts)[0].address
cy.getAuthRequests().then((authRequests) => {
const requests = Object.values(authRequests)
Expand Down
6 changes: 4 additions & 2 deletions packages/ui/cypress/tests/transactions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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 { waitForAuthRequest } from '../utils/waitForAuthRequests'
import { waitForTxRequest } from '../utils/waitForTxRequests'

const AliceAddress = Object.values(injectedAccounts)[0].address
Expand All @@ -21,9 +20,12 @@ describe('Perform transactions', () => {
beforeEach(() => {
cy.visit(landingPageUrl)
cy.initExtension(injectedAccounts)
cy.clock()
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
waitForAuthRequest()
cy.tick(500)
// restore the clock to prevent WS errors
cy.clock().invoke('restore')
cy.getAuthRequests().then((authRequests) => {
const requests = Object.values(authRequests)
// we should have 1 connection request to the extension
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/cypress/utils/waitForAuthRequests.ts

This file was deleted.

0 comments on commit fb833e4

Please sign in to comment.