Skip to content

Commit

Permalink
clickOnconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Oct 13, 2023
1 parent 499b33f commit a4774f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
7 changes: 2 additions & 5 deletions packages/ui/cypress/tests/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ 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'
import { clickOnConnect } from '../utils/clickOnConnect'

describe('Connect Account', () => {
beforeEach(() => {
cy.visit(landingPageUrl)
cy.initExtension(injectedAccounts)
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
clickOnConnect()
})

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 +26,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
7 changes: 2 additions & 5 deletions packages/ui/cypress/tests/transactions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +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 { waitForAuthRequest } from '../utils/waitForAuthRequests'
import { clickOnConnect } from '../utils/clickOnConnect'
import { waitForTxRequest } from '../utils/waitForTxRequests'

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

export const clickOnConnect = () => {
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
waitForAuthRequest()
}

0 comments on commit a4774f8

Please sign in to comment.