-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make account connection test robust (#348)
- Loading branch information
Showing
11 changed files
with
64 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,5 +123,5 @@ builds | |
!.yarn/versions | ||
|
||
# cypress | ||
cypress/screenshots/* | ||
cypress/videos/* | ||
cypress/screenshots | ||
cypress/videos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const landingPage = { | ||
watchAccountButton: () => cy.get('[data-cy=button-watch-address]'), | ||
connectButton: () => cy.get('[data-cy="button-menu-connect"]') | ||
accountsOrRpcLoader: () => cy.get('[data-cy="loader-accounts-rpc-connection"]'), | ||
noAccountFoundError: () => cy.get('[data-cy="text-no-account-found"]') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const topMenuItems = { | ||
connectButton: () => cy.get('[data-cy="button-menu-connect"]'), | ||
multiproxySelector: () => cy.get('[data-cy="select-multiproxy"]') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
import { injectedAccounts } from '../fixtures/injectedAccounts' | ||
import { landingPageUrl } from '../fixtures/landingData' | ||
import { landingPage } from '../support/page-objects/landingPage' | ||
import { topMenuItems } from '../support/page-objects/topMenuItems' | ||
|
||
describe('Connect Account', () => { | ||
beforeEach(() => { | ||
cy.visit(landingPageUrl) | ||
cy.initExtension(injectedAccounts) | ||
topMenuItems.connectButton().click() | ||
landingPage.accountsOrRpcLoader().should('contain', 'Loading accounts') | ||
}) | ||
|
||
it('Reject connection', () => { | ||
cy.initExtension(injectedAccounts) | ||
landingPage.connectButton().click() | ||
cy.getAuthRequests().then((re) => { | ||
const requests = Object.values(re) | ||
cy.getAuthRequests().then((authRequests) => { | ||
const requests = Object.values(authRequests) | ||
// we should have 1 connection request to the extension | ||
cy.wrap(requests.length).should('eq', 1) | ||
// this request should be from the application Multix | ||
cy.wrap(requests[0].origin).should('eq', 'Multix') | ||
// let's allow it for Alice | ||
cy.rejectAuth(requests[0].id, 'Cancelled') | ||
// the ui should then move on to connecting to the rpcs | ||
cy.get('[data-cy="text-no-account-found"]').should('contain', 'No account found') | ||
landingPage.noAccountFoundError().should('be.visible') | ||
}) | ||
}) | ||
|
||
it('Connects with Alice', () => { | ||
cy.initExtension(injectedAccounts) | ||
landingPage.connectButton().click() | ||
cy.getAuthRequests().then((re) => { | ||
const requests = Object.values(re) | ||
cy.getAuthRequests().then((authRequests) => { | ||
const requests = Object.values(authRequests) | ||
// we should have 1 connection request to the extension | ||
cy.wrap(requests.length).should('eq', 1) | ||
// this request should be from the application Multix | ||
cy.wrap(requests[0].origin).should('eq', 'Multix') | ||
// let's allow it for Alice | ||
cy.enableAuth(requests[0].id, [Object.values(injectedAccounts)[0].address]) | ||
// the ui should then move on to connecting to the rpcs | ||
cy.get('[data-cy="loader-rpc-connection"]').should('contain', 'Connecting to the node at') | ||
topMenuItems.multiproxySelector().should('be.visible') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters