Skip to content

Commit

Permalink
Tests: Tests refactoring (#4380)
Browse files Browse the repository at this point in the history
* Tests refactoring

* Update tests - wip
  • Loading branch information
mike10ca authored Oct 15, 2024
1 parent c991d76 commit 93164b9
Show file tree
Hide file tree
Showing 30 changed files with 113 additions and 205 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/pages/nfts.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export function clikOnNextBtn() {
export function verifyReviewModalData(NFTcount) {
main.verifyElementsExist([nftItemList])
main.verifyElementsCount(nftItemNane, NFTcount)
cy.get(signBtn).should('not.be.disabled')

if (NFTcount > 1) {
const numbersArr = Array.from({ length: NFTcount }, (_, index) => index + 1)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/swaps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function clickOnExceeFeeChkbox() {
export function clickOnSwapBtn() {
cy.get('button').contains(swapBtnStr).as('swapBtn')

cy.get('@swapBtn').should('exist').click()
cy.get('@swapBtn').should('exist').click({ force: true })
}

export function checkSwapBtnIsVisible() {
Expand Down
9 changes: 2 additions & 7 deletions cypress/e2e/prodhealthcheck/nfts.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
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'
Expand All @@ -16,7 +14,7 @@ let nftsSafes,
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe.skip('[PROD] NFTs tests', () => {
describe('[PROD] NFTs tests', () => {
before(() => {
getSafes(CATEGORIES.nfts)
.then((nfts) => {
Expand All @@ -34,7 +32,6 @@ describe.skip('[PROD] NFTs tests', () => {
nfts.waitForNftItems(2)
})

// TODO: Added to prod
// TODO: Add Sign action
it('Verify multipls NFTs can be selected and reviewed', () => {
nfts.verifyInitialNFTData()
Expand All @@ -47,7 +44,6 @@ describe.skip('[PROD] NFTs tests', () => {
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)
Expand All @@ -60,17 +56,16 @@ describe.skip('[PROD] NFTs tests', () => {
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)
wallet.connectSigner(signer)
nfts.verifyInitialNFTData()
nfts.selectNFTs(1)
nfts.sendNFT()
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/prodhealthcheck/sidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ describe('[PROD] Sidebar tests', () => {
sideBar.verifySafeHeaderDetails(sideBar.testSafeHeaderDetails)
})

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

it.skip('Verify New transaction button enabled for beneficiaries who are non-owners', () => {
it('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)
Expand Down
7 changes: 1 addition & 6 deletions cypress/e2e/prodhealthcheck/sidebar_3.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import * as sideBar from '../pages/sidebar.pages.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
Expand All @@ -9,15 +8,13 @@ import * as owner from '../pages/owners.pages.js'
let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer1 = walletCredentials.OWNER_1_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_3_PRIVATE_KEY

describe.skip('[PROD] Sidebar tests 3', () => {
describe('[PROD] Sidebar tests 3', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

// TODO: Added to prod
it('Verify the "My accounts" counter at the top is counting all safes the user owns', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_9)
cy.intercept('GET', constants.safeListEndpoint, {
Expand All @@ -28,7 +25,6 @@ describe.skip('[PROD] Sidebar tests 3', () => {
sideBar.checkMyAccountCounter(2)
})

// TODO: Added to prod
it('Verify pending signature is displayed in sidebar for unsigned tx', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_7)
wallet.connectSigner(signer)
Expand All @@ -49,7 +45,6 @@ describe.skip('[PROD] Sidebar tests 3', () => {
sideBar.checkTxToConfirm(1)
})

// TODO: Added to prod
it('Verify balance exists in a tx in sidebar', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_7)
wallet.connectSigner(signer)
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/prodhealthcheck/spending_limits.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('[PROD] Spending limits tests', () => {
cy.get(spendinglimit.spendingLimitsSection).should('be.visible')
})

it.skip('Verify that the Review step shows beneficiary, amount allowed, reset time', () => {
it('Verify that the Review step shows beneficiary, amount allowed, reset time', () => {
//Assume that default reset time is set to One time
wallet.connectSigner(signer)
spendinglimit.clickOnNewSpendingLimitBtn()
Expand All @@ -38,7 +38,7 @@ describe('[PROD] Spending limits tests', () => {
spendinglimit.verifyBeneficiaryTable()
})

it.skip('Verify Spending limit option is available when selecting the corresponding token', () => {
it('Verify Spending limit option is available when selecting the corresponding token', () => {
wallet.connectSigner(signer)
navigation.clickOnNewTxBtn()
tx.clickOnSendTokensBtn()
Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/prodhealthcheck/swaps_history_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ describe('[PROD] Swaps history tests 2', () => {
])
})

// TODO: Unskip after next release due to changes in design tx
it.skip(
it(
'Verify no decoding if tx was created using CowSwap safe-app in the history',
{ defaultCommandTimeout: 30000 },
() => {
Expand All @@ -57,7 +56,7 @@ describe('[PROD] Swaps history tests 2', () => {
swapsHistory.forAtMost,
])
main.verifyValuesDoNotExist(create_tx.transactionItem, [swapsHistory.title, swapsHistory.cow, swapsHistory.dai])
main.verifyValuesExist(create_tx.transactionItem, [swapsHistory.actionPreSignatureG, swapsHistory.safeAppTitile])
main.verifyValuesExist(create_tx.transactionItem, [swapsHistory.actionPreSignatureG, swapsHistory.gGpV2])
},
)
})
5 changes: 2 additions & 3 deletions cypress/e2e/prodhealthcheck/swaps_tokens.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('[PROD] Swaps token tests', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_1)
})

it.skip(
it(
'Verify that clicking the swap from assets tab, autofills that token automatically in the form',
{ defaultCommandTimeout: 30000 },
() => {
Expand All @@ -36,8 +36,7 @@ describe('[PROD] Swaps token tests', () => {
},
)

// TODO: Check why expected number of buttons not displayed sometimes
it.skip('Verify swap button are displayed in assets table and dashboard', () => {
it('Verify swap button are displayed in assets table and dashboard', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
main.verifyElementsCount(swaps.assetsSwapBtn, 4)
cy.visit(constants.homeUrl + staticSafes.SEP_STATIC_SAFE_1)
Expand Down
9 changes: 3 additions & 6 deletions cypress/e2e/prodhealthcheck/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ describe('[PROD] Tx history tests 1', () => {
})

// Spending limits
// TODO: Unskip after next release due to design tx
it.skip('Verify summary for setting spend limits', () => {
it('Verify summary for setting spend limits', () => {
createTx.verifySummaryByName(
typeSpendingLimits.title,
typeSpendingLimits.summaryTxInfo,
Expand All @@ -81,8 +80,7 @@ describe('[PROD] Tx history tests 1', () => {
)
})

// TODO: Unskip after next release due to design tx
it.skip('Verify exapanded details for initial spending limits setup', () => {
it('Verify exapanded details for initial spending limits setup', () => {
createTx.clickOnTransactionItemByName(typeSpendingLimits.title, typeSpendingLimits.summaryTxInfo)
createTx.verifyExpandedDetails(
[
Expand All @@ -95,8 +93,7 @@ describe('[PROD] Tx history tests 1', () => {
)
})

// TODO: Unskip after next release due to design tx
it.skip('Verify that 3 actions exist in initial spending limits setup', () => {
it('Verify that 3 actions exist in initial spending limits setup', () => {
createTx.clickOnTransactionItemByName(typeSpendingLimits.title, typeSpendingLimits.summaryTxInfo)
createTx.verifyActions([
typeSpendingLimits.enableModule.title,
Expand Down
14 changes: 1 addition & 13 deletions cypress/e2e/prodhealthcheck/tx_history_2.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as constants from '../../support/constants'
import * as main from '../pages/main.page'
import * as createTx from '../pages/create_tx.pages'
import * as data from '../../fixtures/txhistory_data_data.json'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
Expand Down Expand Up @@ -41,7 +40,6 @@ describe('[PROD] Tx history tests 2', () => {
createTx.verifyNumberOfTransactions(20)
})

// TODO: Added to prod
// On-chain rejection
it('Verify exapanded details for on-chain rejection', () => {
createTx.clickOnTransactionItemByName(typeOnchainRejection.title)
Expand All @@ -57,10 +55,8 @@ describe('[PROD] Tx history tests 2', () => {
])
})

// TODO: Added to prod
// Batch transaction
// TODO: Unskip after next release due to design tx
it.skip('Verify exapanded details for batch', () => {
it('Verify exapanded details for batch', () => {
createTx.clickOnTransactionItemByName(typeBatch.title, typeBatch.summaryTxInfo)
createTx.verifyExpandedDetails(
[typeBatch.contractTitle, typeBatch.transactionHash, typeBatch.safeTxHash],
Expand All @@ -69,19 +65,16 @@ describe('[PROD] Tx history tests 2', () => {
createTx.verifyActions([typeBatch.nativeTransfer.title])
})

// TODO: Added to prod
// Add owner
it('Verify summary for adding owner', () => {
createTx.verifySummaryByName(typeAddOwner.title, [typeGeneral.statusOk], typeAddOwner.altImage)
})

// TODO: Added to prod
// Change owner
it('Verify summary for changing owner', () => {
createTx.verifySummaryByName(typeChangeOwner.title, [typeGeneral.statusOk], typeChangeOwner.altImage)
})

// TODO: Added to prod
it('Verify exapanded details for changing owner', () => {
createTx.clickOnTransactionItemByName(typeChangeOwner.title)
createTx.verifyExpandedDetails([
Expand All @@ -96,19 +89,16 @@ describe('[PROD] Tx history tests 2', () => {
])
})

// TODO: Added to prod
// Remove owner
it('Verify summary for removing owner', () => {
createTx.verifySummaryByName(typeRemoveOwner.title, [typeGeneral.statusOk], typeRemoveOwner.altImage)
})

// TODO: Added to prod
// Disbale module
it('Verify summary for disable module', () => {
createTx.verifySummaryByName(typeDisableOwner.title, [typeGeneral.statusOk], typeDisableOwner.altImage)
})

// TODO: Added to prod
// Change threshold
it('Verify summary for changing threshold', () => {
createTx.verifySummaryByName(
Expand All @@ -118,7 +108,6 @@ describe('[PROD] Tx history tests 2', () => {
)
})

// TODO: Added to prod
it('Verify exapanded details for changing threshold', () => {
createTx.clickOnTransactionItemByName(typeChangeThreshold.title)
createTx.verifyExpandedDetails(
Expand All @@ -132,7 +121,6 @@ describe('[PROD] Tx history tests 2', () => {
createTx.checkRequiredThreshold(2)
})

// TODO: Added to prod
it('Verify that sender address of untrusted token will not be copied until agreed in warning popup', () => {
createTx.clickOnTransactionItemByName(typeUntrustedToken.summaryTitle, typeUntrustedToken.summaryTxInfo)
createTx.verifyAddressNotCopied(0, typeUntrustedToken.senderAddress)
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/regression/add_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe('Add Owners tests', () => {
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

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

// TODO: Added to prod
// Added to prod
it('Verify the Add New Owner Form can be opened', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/regression/create_tx.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Create transactions tests', () => {
createtx.clickOnSendTokensBtn()
})

// TODO: Added to prod
// Added to prod
it('Verify submitting a tx and that clicking on notification shows the transaction in queue', () => {
happyPathToStepTwo()
createtx.verifySubmitBtnIsEnabled()
Expand Down
14 changes: 1 addition & 13 deletions cypress/e2e/regression/load_safe.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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'
Expand All @@ -9,17 +8,6 @@ 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 () => {
Expand All @@ -38,7 +26,7 @@ describe('Load Safe tests', () => {
safe.clickOnNextBtn()
})

// TODO: Added to prod
// 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()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/regression/messages_onchain.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Onchain Messages tests', () => {
)
})

// TODO: Added to prod
// Added to prod
it('Verify summary for signed on-chain message', () => {
createTx.verifySummaryByName(
typeMessagesOnchain.contractName,
Expand Down
Loading

0 comments on commit 93164b9

Please sign in to comment.