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

Small refactor with clickOnConnect test function #403

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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()
}