Skip to content

Commit

Permalink
Tests: Cleanup prod tests (#4362)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca authored Oct 11, 2024
1 parent 9a760d2 commit 6a5eb5c
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 56 deletions.
6 changes: 5 additions & 1 deletion cypress/e2e/pages/create_tx.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ export function verifyExpandedDetails(data, warning) {
if (warning) cy.get(warning).should('be.visible')
}

export function verifyAdvancedDetails(data) {
main.checkTextsExistWithinElement(accordionDetails, data)
}

export function verifyActions(data) {
main.checkTextsExistWithinElement(accordionDetails, data)
}
Expand All @@ -273,7 +277,7 @@ export function clickOnExpandableAction(data) {
})
}

function clickOnAdvancedDetails() {
export function clickOnAdvancedDetails() {
cy.get(advancedDetails).click()
}

Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const selectAllRowsChbxStr = /Select All Rows checkbox/i
export const selectRowChbxStr = /Select Row checkbox/i
export const recipientStr = /recipient/i
export const validRecipientAddressStr = /please enter a valid recipient address/i
export const contractMethodSelector = 'input[id="contract-method-selector"]'
export const testAddressValue2 = 'testAddressValue'
export const testBooleanValue = 'testBooleanValue'
export const testFallback = 'fallback'
Expand Down Expand Up @@ -103,6 +104,7 @@ export const transactiobUilderHeadlinePreview = 'Transaction Builder'
export const availableNetworksPreview = 'Available networks'
export const connecttextPreview = 'Compose custom contract interactions and batch them into a single transaction'
const warningDefaultAppStr = 'The application you are trying to access is not in the default Safe Apps list'
export const AddressEmptyCodeStr = 'AddressEmptyCode'
export const localStorageItem =
'{"https://safe-test-app.com":[{"feature":"camera","status":"granted"},{"feature":"microphone","status":"denied"}]}'
export const gridItem = 'main .MuiPaper-root > .MuiGrid-item'
Expand All @@ -111,7 +113,7 @@ export const linkNames = {
txBuilderLogo: /Transaction Builder logo/i,
}
export const abi =
'[{{}"inputs":[{{}"internalType":"address","name":"_singleton","type":"address"{}}],"stateMutability":"nonpayable","type":"constructor"{}},{{}"stateMutability":"payable","type":"fallback"{}}]'
'[{"inputs":[{"internalType":"address","name":"_singleton","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]'

export const permissionCheckboxes = {
camera: 'input[name="camera"]',
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/prodhealthcheck/add_owner.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 '../../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'
Expand All @@ -18,13 +17,11 @@ describe('[PROD] Add Owners tests', () => {
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', () => {
it('Verify the Add New Owner Form can be opened', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
})
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/prodhealthcheck/create_tx.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 '../../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'
Expand All @@ -18,7 +17,7 @@ function happyPathToStepTwo() {
createtx.clickOnNextBtn()
}

describe.skip('[PROD] Create transactions tests', () => {
describe('[PROD] Create transactions tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand All @@ -30,7 +29,6 @@ describe.skip('[PROD] Create transactions tests', () => {
createtx.clickOnSendTokensBtn()
})

// TODO: Added to prod
it('Verify submitting a tx and that clicking on notification shows the transaction in queue', () => {
happyPathToStepTwo()
createtx.verifySubmitBtnIsEnabled()
Expand Down
13 changes: 0 additions & 13 deletions cypress/e2e/prodhealthcheck/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('[PROD] Load Safe tests', () => {
before(async () => {
Expand All @@ -31,7 +19,6 @@ describe('[PROD] Load Safe tests', () => {
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()
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/prodhealthcheck/messages_onchain.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 createTx from '../pages/create_tx.pages.js'
import * as msg_data from '../../fixtures/txmessages_data.json'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
Expand All @@ -17,7 +16,6 @@ describe('[PROD] Onchain Messages tests', () => {
cy.visit(constants.prodbaseUrl + constants.transactionsHistoryUrl + staticSafes.SEP_STATIC_SAFE_10)
})

// TODO: Added to prod
it('Verify summary for signed on-chain message', () => {
createTx.verifySummaryByName(
typeMessagesOnchain.contractName,
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/prodhealthcheck/remove_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ describe('[PROD] Remove Owners tests', () => {
cy.contains(owner.safeAccountNonceStr, { timeout: 10000 })
})

// TODO: Added to prod
it.skip('Verify owner deletion transaction has been created', () => {
it('Verify owner deletion transaction has been created', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
owner.openRemoveOwnerWindow(1)
Expand Down
4 changes: 0 additions & 4 deletions cypress/e2e/prodhealthcheck/sidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,21 @@ describe('[PROD] Sidebar tests', () => {
cy.visit(constants.prodbaseUrl + constants.homeUrl + staticSafes.SEP_STATIC_SAFE_9)
})

// 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)
})
Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/prodhealthcheck/spending_limits.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 spendinglimit from '../pages/spending_limits.pages'
import * as navigation from '../pages/navigation.page'
import * as tx from '../pages/create_tx.pages'
Expand All @@ -9,11 +8,7 @@ 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
const signerAddress = walletCredentials.OWNER_4_WALLET_ADDRESS

const tokenAmount = 0.1
const newTokenAmount = 0.001
const spendingLimitBalance = '(0.15 ETH)'

describe('[PROD] Spending limits tests', () => {
before(async () => {
Expand All @@ -25,7 +20,6 @@ describe('[PROD] Spending limits tests', () => {
cy.get(spendinglimit.spendingLimitsSection).should('be.visible')
})

// TODO: Added to prod
it.skip('Verify that the Review step shows beneficiary, amount allowed, reset time', () => {
//Assume that default reset time is set to One time
wallet.connectSigner(signer)
Expand All @@ -40,12 +34,10 @@ describe('[PROD] Spending limits tests', () => {
)
})

// TODO: Added to prod
it('Verify values and trash icons are displayed in Beneficiary table', () => {
spendinglimit.verifyBeneficiaryTable()
})

// TODO: Added to prod
it.skip('Verify Spending limit option is available when selecting the corresponding token', () => {
wallet.connectSigner(signer)
navigation.clickOnNewTxBtn()
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/prodhealthcheck/swaps_history_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('[PROD] Swaps history tests 2', () => {
staticSafes = await getSafes(CATEGORIES.static)
})

// TODO: Added to prod
it('Verify swap buy operation with 2 actions: approve & swap', { defaultCommandTimeout: 30000 }, () => {
cy.visit(
constants.prodbaseUrl + constants.transactionUrl + staticSafes.SEP_STATIC_SAFE_1 + swaps.swapTxs.buy2actions,
Expand All @@ -34,7 +33,6 @@ describe('[PROD] Swaps history tests 2', () => {
])
})

// TODO: Added to prod
// TODO: Unskip after next release due to changes in design tx
it.skip(
'Verify no decoding if tx was created using CowSwap safe-app in the history',
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/prodhealthcheck/swaps_tokens.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('[PROD] Swaps token tests', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_1)
})

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

// TODO: Added to prod
// TODO: Check why expected number of buttons not displayed sometimes
it.skip('Verify swap button are displayed in assets table and dashboard', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/prodhealthcheck/tokens.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import * as constants from '../../support/constants'
import * as main from '../pages/main.page'
import * as assets from '../pages/assets.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'

const ASSET_NAME_COLUMN = 0
const TOKEN_AMOUNT_COLUMN = 1
const FIAT_AMOUNT_COLUMN = 2

Expand All @@ -19,7 +17,6 @@ describe('[PROD] Prod tokens tests', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_2)
})

// TODO: Added to prod
it('Verify that non-native tokens are present and have balance', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.verifyBalance(assets.currencyDaiCap, TOKEN_AMOUNT_COLUMN, assets.currencyDaiAlttext)
Expand Down Expand Up @@ -77,15 +74,12 @@ describe('[PROD] Prod tokens tests', () => {
)
})

// TODO: Added to prod
//Include in smoke.
it('Verify that when owner is disconnected, Send button is disabled', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.showSendBtn(0)
assets.VerifySendButtonIsDisabled()
})

// TODO: Added to prod
it('Verify that when connected user is not owner, Send button is disabled', () => {
cy.visit(constants.prodbaseUrl + constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_3)
assets.selectTokenList(assets.tokenListOptions.allTokens)
Expand Down
7 changes: 0 additions & 7 deletions cypress/e2e/prodhealthcheck/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe('[PROD] Tx history tests 1', () => {
cy.wait('@allTransactions')
})

// TODO: Added to prod
// Account creation
it('Verify summary for account creation', () => {
createTx.verifySummaryByName(
Expand All @@ -45,7 +44,6 @@ describe('[PROD] Tx history tests 1', () => {
)
})

// TODO: Added to prod
it('Verify exapanded details for account creation', () => {
createTx.clickOnTransactionItemByName(typeCreateAccount.title)
createTx.verifyExpandedDetails([
Expand All @@ -61,7 +59,6 @@ describe('[PROD] Tx history tests 1', () => {
])
})

// TODO: Added to prod
// Token send
it('Verify exapanded details for token send', () => {
createTx.clickOnTransactionItemByName(typeSend.title, typeSend.summaryTxInfo)
Expand All @@ -73,7 +70,6 @@ describe('[PROD] Tx history tests 1', () => {
])
})

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

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

// TODO: Added to prod
// TODO: Unskip after next release due to design tx
it.skip('Verify that 3 actions exist in initial spending limits setup', () => {
createTx.clickOnTransactionItemByName(typeSpendingLimits.title, typeSpendingLimits.summaryTxInfo)
Expand All @@ -125,7 +119,6 @@ describe('[PROD] Tx history tests 1', () => {
])
})

// TODO: Added to prod
it('Verify advanced details displayed in exapanded details for allowance deletion', () => {
createTx.clickOnTransactionItemByName(typeDeleteAllowance.title, typeDeleteAllowance.summaryTxInfo)
createTx.expandAdvancedDetails([typeDeleteAllowance.baseGas])
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/regression/swaps_history_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ describe('Swaps history tests 2', () => {
const eq = swaps.createRegex(swapsHistory.DAIeqCOW, 'COW')

create_tx.verifyExpandedDetails([swapsHistory.sellFull, dai, eq, swapsHistory.dai, swapsHistory.filled])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.gGpV2, swapsHistory.actionPreSignatureG])
})

// TODO: Added to prod
Expand All @@ -42,6 +44,8 @@ describe('Swaps history tests 2', () => {
swapsHistory.actionApprove,
swapsHistory.actionPreSignature,
])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.multiSend, swapsHistory.multiSendCallOnly1_3_0])
})

it('Verify "Cancelled" status for manually cancelled limit orders', { defaultCommandTimeout: 30000 }, () => {
Expand All @@ -60,6 +64,8 @@ describe('Swaps history tests 2', () => {
swapsHistory.cow,
swapsHistory.cancelled,
])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.gGpV2, swapsHistory.actionPreSignatureG])
})

it('Verify swap operation with 3 actions: wrap & approve & swap', { defaultCommandTimeout: 30000 }, () => {
Expand All @@ -79,6 +85,8 @@ describe('Swaps history tests 2', () => {
swapsHistory.actionPreSignature,
swapsHistory.actionDepositEth,
])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.multiSend, swapsHistory.multiSendCallOnly1_3_0])
})

it('Verify "Expired" field in the tx details for limit orders', { defaultCommandTimeout: 30000 }, () => {
Expand All @@ -89,6 +97,8 @@ describe('Swaps history tests 2', () => {
const eq = swaps.createRegex(swapsHistory.DAIeqCOW, 'COW')

create_tx.verifyExpandedDetails([swapsHistory.sellOrder, swapsHistory.sell, dai, eq, swapsHistory.expired])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.gGpV2, swapsHistory.actionPreSignatureG])
})

it('Verify "Filled" field in the tx details for limit orders', { defaultCommandTimeout: 30000 }, () => {
Expand All @@ -99,6 +109,8 @@ describe('Swaps history tests 2', () => {
const eq = swaps.createRegex(swapsHistory.USDTeqUSDC, 'USDC')

create_tx.verifyExpandedDetails([swapsHistory.sellOrder, swapsHistory.sell, usdc, eq, swapsHistory.filled])
create_tx.clickOnAdvancedDetails()
create_tx.verifyAdvancedDetails([swapsHistory.gGpV2, swapsHistory.actionPreSignatureG])
})

// TODO: Added to prod
Expand Down
8 changes: 8 additions & 0 deletions cypress/e2e/safe-apps/tx-builder.spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,12 @@ describe('Transaction Builder tests', { defaultCommandTimeout: 20000 }, () => {
})
})
})

it('Verify that error types are not displayed in ABI methods', () => {
cy.enter(iframeSelector).then((getBody) => {
getBody().findByLabelText(safeapps.enterABIStr).type(safeapps.abi, { parseSpecialCharSequences: false })
getBody().find(safeapps.contractMethodSelector).click()
getBody().find(safeapps.AddressEmptyCodeStr).should('not.exist')
})
})
})
Loading

0 comments on commit 6a5eb5c

Please sign in to comment.