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

Tests: Add production tests #4049

Merged
merged 2 commits into from
Aug 7, 2024
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
33 changes: 33 additions & 0 deletions cypress/e2e/prodhealthcheck/add_owner.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as owner from '../pages/owners.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Add Owners tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.prodbaseUrl + constants.setupUrl + staticSafes.SEP_STATIC_SAFE_4)
cy.clearLocalStorage()
main.acceptCookies()
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

// TODO: Added to prod
it('Verify add owner button is disabled for disconnected user', () => {
owner.verifyAddOwnerBtnIsDisabled()
})

// TODO: Added to prod
it.skip('Verify the Add New Owner Form can be opened', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
})
})
48 changes: 48 additions & 0 deletions cypress/e2e/prodhealthcheck/create_tx.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as createtx from '../../e2e/pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let staticSafes = []

const sendValue = 0.00002

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

function happyPathToStepTwo() {
createtx.typeRecipientAddress(constants.EOA)
createtx.clickOnTokenselectorAndSelectSepoliaEth()
createtx.setSendValue(sendValue)
createtx.clickOnNextBtn()
}

describe.skip('Create transactions tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_6)
main.acceptCookies()
wallet.connectSigner(signer)
createtx.clickOnNewtransactionBtn()
createtx.clickOnSendTokensBtn()
})

// TODO: Added to prod
it('Verify submitting a tx and that clicking on notification shows the transaction in queue', () => {
happyPathToStepTwo()
createtx.verifySubmitBtnIsEnabled()
createtx.changeNonce(14)
cy.wait(1000)
createtx.clickOnSignTransactionBtn()
createtx.waitForProposeRequest()
createtx.clickViewTransaction()
createtx.verifySingleTxPage()
createtx.verifyQueueLabel()
createtx.verifyTransactionSummary(sendValue)
})
})
45 changes: 45 additions & 0 deletions cypress/e2e/prodhealthcheck/load_safe.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'cypress-file-upload'
import * as constants from '../../support/constants'
import * as main from '../pages/main.page'
import * as safe from '../pages/load_safe.pages'
import * as createwallet from '../pages/create_wallet.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'

let staticSafes = []

const testSafeName = 'Test safe name'
const testOwnerName = 'Test Owner Name'
// TODO
const SAFE_ENS_NAME = 'test20.eth'
const SAFE_ENS_NAME_TRANSLATED = constants.EOA

const EOA_ADDRESS = constants.EOA

const INVALID_ADDRESS_ERROR_MSG = 'Address given is not a valid Safe address'

// TODO
const OWNER_ENS_DEFAULT_NAME = 'test20.eth'
const OWNER_ADDRESS = constants.EOA

describe('Load Safe tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.prodbaseUrl + constants.loadNewSafeSepoliaUrl)
main.acceptCookies()
cy.wait(2000)
})

// TODO: Added to prod
it('Verify Safe and owner names are displayed in the Review step', () => {
safe.inputNameAndAddress(testSafeName, staticSafes.SEP_STATIC_SAFE_4)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
safe.verifyDataInReviewSection(testSafeName, testOwnerName)
safe.clickOnAddBtn()
})
})
30 changes: 30 additions & 0 deletions cypress/e2e/prodhealthcheck/messages_onchain.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import * as createTx from '../pages/create_tx.pages.js'
import * as msg_data from '../../fixtures/txmessages_data.json'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'

let staticSafes = []

const typeMessagesOnchain = msg_data.type.onChain

describe('Onchain Messages tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.prodbaseUrl + constants.transactionsHistoryUrl + staticSafes.SEP_STATIC_SAFE_10)
main.acceptCookies()
})

// TODO: Added to prod
it('Verify summary for signed on-chain message', () => {
createTx.verifySummaryByName(
typeMessagesOnchain.contractName,
[typeMessagesOnchain.success, typeMessagesOnchain.signMessage],
typeMessagesOnchain.altTmage,
)
})
})
89 changes: 89 additions & 0 deletions cypress/e2e/prodhealthcheck/nfts.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import * as constants from '../../support/constants'
import * as main from '../pages/main.page'
import * as nfts from '../pages/nfts.pages'
import * as createTx from '../pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

const singleNFT = ['safeTransferFrom']
const multipleNFT = ['multiSend']
const multipleNFTAction = 'safeTransferFrom'
const NFTSentName = 'GTT #22'

let nftsSafes,
staticSafes = []

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe.skip('NFTs tests', () => {
before(() => {
getSafes(CATEGORIES.nfts)
.then((nfts) => {
nftsSafes = nfts
return getSafes(CATEGORIES.static)
})
.then((statics) => {
staticSafes = statics
})
})

beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.prodbaseUrl + constants.balanceNftsUrl + staticSafes.SEP_STATIC_SAFE_2)
main.acceptCookies()
wallet.connectSigner(signer)
nfts.waitForNftItems(2)
})

// TODO: Added to prod
// TODO: Add Sign action
it('Verify multipls NFTs can be selected and reviewed', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(3)
nfts.deselectNFTs([2], 3)
nfts.sendNFT()
nfts.verifyNFTModalData()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.clikOnNextBtn()
nfts.verifyReviewModalData(2)
})

// TODO: Added to prod
it('Verify that when 2 NFTs are selected, actions and tx details are correct in Review step', () => {
nfts.verifyInitialNFTData()
nfts.selectNFTs(2)
nfts.sendNFT()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
nfts.clikOnNextBtn()
nfts.verifyTxDetails(multipleNFT)
nfts.verifyCountOfActions(2)
nfts.verifyActionName(0, multipleNFTAction)
nfts.verifyActionName(1, multipleNFTAction)
})

// TODO: Added to prod
it('Verify Send button is disabled for non-owner', () => {
cy.visit(constants.balanceNftsUrl + nftsSafes.SEP_NFT_SAFE_2)
nfts.verifyInitialNFTData()
nfts.selectNFTs(1)
nfts.verifySendNFTBtnDisabled()
})

// TODO: Added to prod
it('Verify Send NFT transaction has been created', () => {
cy.visit(constants.balanceNftsUrl + nftsSafes.SEP_NFT_SAFE_1)
nfts.verifyInitialNFTData()
nfts.selectNFTs(1)
nfts.sendNFT()
nfts.typeRecipientAddress(staticSafes.SEP_STATIC_SAFE_1)
createTx.changeNonce(2)
nfts.clikOnNextBtn()
createTx.clickOnSignTransactionBtn()
createTx.waitForProposeRequest()
createTx.clickViewTransaction()
createTx.verifySingleTxPage()
createTx.verifyQueueLabel()
createTx.verifyTransactionStrExists(NFTSentName)
})
})
43 changes: 43 additions & 0 deletions cypress/e2e/prodhealthcheck/remove_owner.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as owner from '../pages/owners.pages'
import * as createwallet from '../pages/create_wallet.pages'
import * as createTx from '../pages/create_tx.pages.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Remove Owners tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.prodbaseUrl + constants.setupUrl + staticSafes.SEP_STATIC_SAFE_13)
main.waitForHistoryCallToComplete()
cy.clearLocalStorage()
main.acceptCookies()
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

// TODO: Added to prod
it.skip('Verify owner deletion transaction has been created', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
owner.openRemoveOwnerWindow(1)
cy.wait(3000)
createwallet.clickOnNextBtn()
//This method creates the @removedAddress alias
owner.getAddressToBeRemoved()
owner.verifyOwnerDeletionWindowDisplayed()
createTx.changeNonce(10)
createTx.clickOnSignTransactionBtn()
createTx.waitForProposeRequest()
createTx.clickViewTransaction()
createTx.clickOnTransactionItemByName('removeOwner')
createTx.verifyTxDestinationAddress('@removedAddress')
})
})
45 changes: 45 additions & 0 deletions cypress/e2e/prodhealthcheck/sidebar.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as constants from '../../support/constants'
import * as main from '../pages/main.page'
import * as sideBar from '../pages/sidebar.pages'
import * as navigation from '../pages/navigation.page'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Sidebar tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.prodbaseUrl + constants.homeUrl + staticSafes.SEP_STATIC_SAFE_9)
cy.clearLocalStorage()
main.acceptCookies()
})

// TODO: Added to prod
it('Verify current safe details', () => {
sideBar.verifySafeHeaderDetails(sideBar.testSafeHeaderDetails)
})

// TODO: Added to prod
it.skip('Verify New transaction button enabled for owners', () => {
wallet.connectSigner(signer)
sideBar.verifyNewTxBtnStatus(constants.enabledStates.enabled)
})

// TODO: Added to prod
it.skip('Verify New transaction button enabled for beneficiaries who are non-owners', () => {
cy.visit(constants.prodbaseUrl + constants.homeUrl + staticSafes.SEP_STATIC_SAFE_11)
wallet.connectSigner(signer)
sideBar.verifyNewTxBtnStatus(constants.enabledStates.enabled)
})

// TODO: Added to prod
it('Verify New Transaction button disabled for non-owners', () => {
main.verifyElementsCount(navigation.newTxBtn, 0)
})
})
Loading
Loading