Skip to content

Commit

Permalink
Improve test organization
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca committed Jan 20, 2025
1 parent bebed8f commit ccd2111
Show file tree
Hide file tree
Showing 23 changed files with 431 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/web-e2e-hp-ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Web Happy path on demand tests
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 1,4'
- cron: '0 4 * * 3'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
// DO NOT use OWNER_2_PRIVATE_KEY for safe creation. Used for CF safes.
const signer = walletCredentials.OWNER_2_PRIVATE_KEY

describe('[SMOKE] CF Safe creation tests', () => {
describe('CF Safe creation happy path tests', () => {
beforeEach(() => {
cy.visit(constants.welcomeUrl + '?chain=sep')
// Required for data layer
Expand All @@ -18,7 +18,7 @@ describe('[SMOKE] CF Safe creation tests', () => {
getEvents()
})

it('[SMOKE] CF creation happy path. GA safe_created', () => {
it('CF creation happy path. GA safe_created', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
createwallet.clickOnContinueWithWalletBtn()
Expand Down
20 changes: 19 additions & 1 deletion apps/web/cypress/e2e/regression/add_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getMockAddress } from '../../support/utils/ethers.js'
let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_1_PRIVATE_KEY

describe('Add Owners tests', () => {
before(async () => {
Expand Down Expand Up @@ -60,4 +59,23 @@ describe('Add Owners tests', () => {
owner.clickOnNextBtn()
owner.verifyConfirmTransactionWindowDisplayed()
})

it('Verify default threshold value. Verify correct threshold calculation', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
owner.typeOwnerAddress(constants.DEFAULT_OWNER_ADDRESS)
owner.verifyThreshold(1, 2)
})

it('Verify valid Address validation', () => {
wallet.connectSigner(signer)
owner.openAddOwnerWindow()
owner.typeOwnerAddress(constants.SEPOLIA_OWNER_2)
owner.clickOnNextBtn()
owner.verifyConfirmTransactionWindowDisplayed()
owner.clickOnBackBtn()
owner.typeOwnerAddress(staticSafes.SEP_STATIC_SAFE_3)
owner.clickOnNextBtn()
owner.verifyConfirmTransactionWindowDisplayed()
})
})
102 changes: 102 additions & 0 deletions apps/web/cypress/e2e/regression/address_book_3.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import 'cypress-file-upload'
import * as constants from '../../support/constants.js'
import * as addressBook from '../pages/address_book.page.js'
import * as main from '../pages/main.page.js'
import * as ls from '../../support/localstorage_data.js'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let staticSafes = []

const NAME = 'Owner1'
const NAME_2 = 'Owner2'
const EDITED_NAME = 'Edited Owner1'
const duplicateEntry = 'test-sepolia-90'
const owner1 = 'Automation owner'
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const recipientData = [owner1, constants.DEFAULT_OWNER_ADDRESS]

describe('Address book tests - 3', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.addressBookUrl + staticSafes.SEP_STATIC_SAFE_4)
})

it('Verify entry can be added', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
})

it('Verify entry can be deleted', () => {
cy.wrap(null)
.then(() =>
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.sepoliaAddress1),
)
.then(() =>
main.isItemInLocalstorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.sepoliaAddress1),
)
.then(() => {
cy.reload()
addressBook.clickDeleteEntryButton()
addressBook.clickDeleteEntryModalDeleteButton()
addressBook.verifyEditedNameNotExists(EDITED_NAME)
})
})

it('Verify csv file can be imported', () => {
addressBook.clickOnImportFileBtn()
addressBook.importCSVFile(addressBook.validCSVFile)
addressBook.verifyImportBtnStatus(constants.enabledStates.enabled)
addressBook.clickOnImportBtn()
addressBook.verifyDataImported(addressBook.entries)
addressBook.verifyNumberOfRows(4)
})

it('Import a csv file with an empty address/name/network in one row', () => {
addressBook.clickOnImportFileBtn()
addressBook.importCSVFile(addressBook.emptyCSVFile)
addressBook.verifyImportBtnStatus(constants.enabledStates.disabled)
addressBook.verifyUploadExportMessage([addressBook.uploadErrorMessages.emptyFile])
})

it('Import a non-csv file', () => {
addressBook.clickOnImportFileBtn()
addressBook.importCSVFile(addressBook.nonCSVFile)
addressBook.verifyImportBtnStatus(constants.enabledStates.disabled)
addressBook.verifyUploadExportMessage([addressBook.uploadErrorMessages.fileType])
})

it('Import a csv file with a repeated address and same network', () => {
addressBook.clickOnImportFileBtn()
addressBook.importCSVFile(addressBook.duplicatedCSVFile)
addressBook.verifyImportBtnStatus(constants.enabledStates.enabled)
addressBook.clickOnImportBtn()
addressBook.verifyDataImported([duplicateEntry])
addressBook.verifyNumberOfRows(1)
})

it('Verify modal shows the amount of entries and networks detected', () => {
addressBook.clickOnImportFileBtn()
addressBook.importCSVFile(addressBook.networksCSVFile)
addressBook.verifyImportBtnStatus(constants.enabledStates.enabled)
addressBook.verifyModalSummaryMessage(4, 3)
})

it('Verify an entry can be added by ENS name', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntryByENS(NAME_2, constants.ENS_TEST_SEPOLIA)
})

it('Verify clicking on Send button autofills the recipient filed with correct value', () => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.sepoliaAddress2)
cy.wait(1000)
cy.reload()
wallet.connectSigner(signer)
addressBook.clickOnSendBtn()
addressBook.verifyRecipientData(recipientData)
})
})
48 changes: 48 additions & 0 deletions apps/web/cypress/e2e/regression/assets.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as constants from '../../support/constants'
import * as assets from '../pages/assets.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'
import * as main from '../pages/main.page'

let staticSafes = []

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

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

beforeEach(() => {
cy.visit(constants.BALANCE_URL + staticSafes.SEP_STATIC_SAFE_2)
})

it('Verify that "Hide token" button is present and opens the "Hide tokens menu"', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.openHideTokenMenu()
assets.verifyEachRowHasCheckbox()
})

it('Verify that clicking the button with an owner opens the Send funds form', () => {
wallet.connectSigner(signer)
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.clickOnSendBtn(0)
})

it('[SMOKE] Verify that Token list dropdown down options show/hide spam tokens', () => {
let spamTokens = [
assets.currencyAave,
assets.currencyTestTokenA,
assets.currencyTestTokenB,
assets.currencyUSDC,
assets.currencyLink,
assets.currencyDaiCap,
]

main.verifyValuesDoNotExist(assets.tokenListTable, spamTokens)
assets.selectTokenList(assets.tokenListOptions.allTokens)
spamTokens.push(constants.tokenNames.sepoliaEther)
main.verifyValuesExist(assets.tokenListTable, spamTokens)
})
})
23 changes: 23 additions & 0 deletions apps/web/cypress/e2e/regression/batch_tx.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,27 @@ describe('Batch transaction tests', { defaultCommandTimeout: 30000 }, () => {
cy.get(batch.batchTxTopBar).should('not.exist')
})
})

it('Verify a transaction can be added to the batch', () => {
wallet.connectSigner(signer)
batch.addNewTransactionToBatch(constants.EOA, currentNonce, funds_first_tx)
batch.verifyBatchIconCount(1)
batch.clickOnBatchCounter()
batch.verifyAmountTransactionsInBatch(1)
})

it('Verify a transaction can be removed from the batch', () => {
cy.wrap(null)
.then(() => main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__batch, ls.batchData.entry0))
.then(() => main.isItemInLocalstorage(constants.localStorageKeys.SAFE_v2__batch, ls.batchData.entry0))
.then(() => {
cy.reload()
wallet.connectSigner(signer)
batch.clickOnBatchCounter()
cy.contains(batch.batchedTransactionsStr).should('be.visible').parents('aside').find('ul > li').as('BatchList')
cy.get('@BatchList').find(batch.deleteTransactionbtn).eq(0).click()
cy.get('@BatchList').should('have.length', 1)
cy.get('@BatchList').contains(funds_first_tx).should('not.exist')
})
})
})
1 change: 1 addition & 0 deletions apps/web/cypress/e2e/regression/create_safe_simple.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ describe('Safe creation tests', () => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2__addressBook, ls.addressBookData.sameOwnerName),
)
.then(() => {
cy.reload()
createwallet.waitForConnectionMsgDisappear()
createwallet.selectMultiNetwork(1, constants.networks.sepolia.toLowerCase())
createwallet.clickOnNextBtn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as createwallet from '../pages/create_wallet.pages'
import * as owner from '../pages/owners.pages'
import * as constants from '../../support/constants.js'
import * as main from '../pages/main.page.js'
import * as createwallet from '../pages/create_wallet.pages.js'
import * as owner from '../pages/owners.pages.js'
import * as wallet from '../../support/utils/wallet.js'

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

describe('[SMOKE] Safe creation tests', () => {
describe('Safe creation tests 3', () => {
beforeEach(() => {
cy.visit(constants.welcomeUrl + '?chain=sep')
})
it('[SMOKE] Verify a Wallet can be connected', () => {
it('Verify a Wallet can be connected', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
createwallet.clickOnContinueWithWalletBtn()
Expand All @@ -22,15 +22,15 @@ describe('[SMOKE] Safe creation tests', () => {
owner.waitForConnectionStatus()
})

it('[SMOKE] Verify that a new Wallet has default name related to the selected network', () => {
it('Verify that a new Wallet has default name related to the selected network', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
createwallet.clickOnContinueWithWalletBtn()
createwallet.clickOnCreateNewSafeBtn()
createwallet.verifyDefaultWalletName(createwallet.defaultSepoliaPlaceholder)
})

it('[SMOKE] Verify Add and Remove Owner Row works as expected', () => {
it('Verify Add and Remove Owner Row works as expected', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
createwallet.clickOnContinueWithWalletBtn()
Expand All @@ -46,7 +46,7 @@ describe('[SMOKE] Safe creation tests', () => {
owner.verifyNumberOfOwners(2)
})

it('[SMOKE] Verify Threshold Setup', () => {
it('Verify Threshold Setup', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
createwallet.clickOnContinueWithWalletBtn()
Expand Down
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 { 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('[SMOKE] Create transactions tests 2', () => {
describe('Create transactions tests 2', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand All @@ -30,15 +29,15 @@ describe('[SMOKE] Create transactions tests 2', () => {
createtx.clickOnSendTokensBtn()
})

it('[SMOKE] Verify advance parameters gas limit input', () => {
it('Verify advance parameters gas limit input', () => {
happyPathToStepTwo()
createtx.changeNonce('1')
createtx.selectCurrentWallet()
createtx.openExecutionParamsModal()
createtx.verifyAndSubmitExecutionParams()
})

it('[SMOKE] Verify a transaction shows relayer and addToBatch button', () => {
it('Verify a transaction shows relayer and addToBatch button', () => {
happyPathToStepTwo()
createtx.verifySubmitBtnIsEnabled()
createtx.verifyNativeTokenTransfer()
Expand Down
39 changes: 39 additions & 0 deletions apps/web/cypress/e2e/regression/dashboard.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as constants from '../../support/constants'
import * as dashboard from '../pages/dashboard.pages'
import * as safeapps from '../pages/safeapps.pages'
import * as createTx from '../pages/create_tx.pages'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'

let staticSafes = []

const txData = ['14', 'Send', '-0.00002 ETH', '1 out of 1']

describe('Dashboard tests', { defaultCommandTimeout: 20000 }, () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})

beforeEach(() => {
cy.visit(constants.homeUrl + staticSafes.SEP_STATIC_SAFE_2)
})

it('Verify that pinned in dashboard, an app keeps its status on apps page', () => {
dashboard.pinAppByIndex(0).then((pinnedApp) => {
cy.visit(constants.appsUrlGeneral + staticSafes.SEP_STATIC_SAFE_2)
safeapps.verifyPinnedApp(pinnedApp)
cy.visit(constants.homeUrl + staticSafes.SEP_STATIC_SAFE_2)
dashboard.clickOnPinBtnByName(pinnedApp)
dashboard.verifyPinnedAppsCount(0)
})
})

it('Verify clicking on View All button directs to list of all queued txs', () => {
dashboard.clickOnViewAllBtn()
createTx.verifyNumberOfTransactions(2)
})

it('Verify clicking on any tx takes the user to Transactions > Queue tab', () => {
dashboard.clickOnTxByIndex(0)
dashboard.verifySingleTxItem(txData)
})
})
Loading

0 comments on commit ccd2111

Please sign in to comment.