-
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.
Add tests for unknown transactions (#460)
Co-authored-by: Thibaut Sardan <[email protected]>
- Loading branch information
Showing
8 changed files
with
121 additions
and
6 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
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
8 changes: 8 additions & 0 deletions
8
packages/ui/cypress/support/page-objects/modals/txSigningModal.ts
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,8 @@ | ||
export const txSigningModal = { | ||
body: () => cy.get('[data-cy=modal-tx-signing]'), | ||
callHashLabel: () => cy.get('[data-cy=label-call-hash]'), | ||
approveButton: () => cy.get('[data-cy=button-approve-tx]'), | ||
rejectButton: () => cy.get('[data-cy=button-reject-tx]'), | ||
callDataInput: () => cy.get('[data-cy=input-call-data]'), | ||
callInfoContainer: () => cy.get('[data-cy=container-call-info]') | ||
} |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { testAccounts } from '../fixtures/testAccounts' | ||
import { landingPageUrl } from '../fixtures/landingData' | ||
import { multisigPage } from '../support/page-objects/multisigPage' | ||
import { txSigningModal } from '../support/page-objects/modals/txSigningModal' | ||
import { knownMultisigs } from '../fixtures/knownMultisigs' | ||
|
||
describe('Unknown Transaction', () => { | ||
beforeEach(() => { | ||
cy.setupAndVisit({ | ||
url: landingPageUrl, | ||
extensionConnectionAllowed: true, | ||
injectExtensionWithAccounts: [testAccounts['Signatory 2 Of Multisig With Unknown Tx']] | ||
}) | ||
}) | ||
|
||
it('can see an unknown transaction displayed in the transaction list', () => { | ||
multisigPage | ||
.transactionList() | ||
.should('be.visible') | ||
.within(() => { | ||
multisigPage.pendingTransactionItem().should('have.length', 1) | ||
multisigPage.pendingTransactionItem().within(() => { | ||
multisigPage.pendingTransactionCallName().should('contain.text', 'Unknown call') | ||
multisigPage.unknownCallIcon().should('be.visible') | ||
multisigPage.unknownCallAlert().should('be.visible') | ||
}) | ||
}) | ||
}) | ||
|
||
it('can see the expected state of an unknown tx without call data', () => { | ||
const { hashOfUknownCall: expectedCallHash, callData } = | ||
knownMultisigs['multisig-with-unknown-transaction'] | ||
|
||
multisigPage | ||
.transactionList() | ||
.should('be.visible') | ||
.within(() => { | ||
multisigPage.pendingTransactionItem().within(() => { | ||
multisigPage.reviewButton().click() | ||
}) | ||
}) | ||
txSigningModal | ||
.body() | ||
.should('be.visible') | ||
.within(() => { | ||
txSigningModal.callHashLabel().should('contain.text', expectedCallHash) | ||
txSigningModal.approveButton().should('not.be.enabled') | ||
txSigningModal.rejectButton().should('not.exist') | ||
// now provide call data and ensure we see the call info and approve button enabled | ||
txSigningModal.callDataInput().type(callData) | ||
txSigningModal | ||
.callInfoContainer() | ||
.should('be.visible') | ||
.should('contain.text', 'system.remark') | ||
.should('contain.text', 'remark: Unknown Transaction Test') | ||
txSigningModal.approveButton().should('be.enabled') | ||
}) | ||
}) | ||
}) |
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