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: Migrate Smoke tests to Sepolia #2670

Merged
merged 3 commits into from
Oct 20, 2023
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
6 changes: 4 additions & 2 deletions cypress/e2e/pages/balances.pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as main from '../pages/main.page'

let etherscanLink = 'a[aria-label="View on goerli.etherscan.io"]'
let etherscanLink = 'a[aria-label="View on sepolia.etherscan.io"]'
let etherscanLinkSepolia = 'a[aria-label="View on sepolia.etherscan.io"]'
export const balanceSingleRow = '[aria-labelledby="tableTitle"] > tbody tr'
const currencyDropdown = '[id="currency"]'
Expand Down Expand Up @@ -45,6 +45,8 @@ export const tokenListOptions = {
export const currencyEUR = 'EUR'
export const currencyUSD = 'USD'

export const currentcySepoliaFormat = '0.1 ETH'

export const currencyAave = 'AAVE'
export const currencyAaveAlttext = 'AAVE'
export const currentcyAaveFormat = '27 AAVE'
Expand All @@ -68,7 +70,7 @@ export const currentcyLinkFormat = '35.94 LINK'
export const currencyDai = 'Dai'
export const currencyDaiCap = 'DAI'
export const currencyDaiAlttext = 'DAI'
export const currentcyDaiFormat = '120,496.61 DAI'
export const currentcyDaiFormat = '82 DAI'
export const currencyDaiFormat_2 = '82 DAI'

export const currencyEther = 'Wrapped Ether'
Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/pages/batches.pages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as constants from '../../support/constants'

const tokenSelectorText = 'G(ö|oe)rli Ether'
const noLaterString = 'No, later'
const yesExecuteString = 'Yes, execute'
Expand Down Expand Up @@ -39,7 +41,7 @@ function fillTransactionData(EOA, amount) {
cy.get(recipientInput).type(EOA, { delay: 1 })
// Click on the Token selector
cy.get(tokenAddressInput).prev().click()
cy.get(listBox).contains(new RegExp(tokenSelectorText)).click()
cy.get(listBox).contains(constants.tokenNames.sepoliaEther).click()
cy.get(amountInput).type(amount)
cy.contains(nextBtn).click()
}
Expand All @@ -59,7 +61,6 @@ function executeTransaction() {
}

function addToBatchButton() {
cy.contains(noLaterString, { timeout: 4000 }).click()
cy.contains(addToBatchBtn).should('be.visible').and('not.be.disabled').click()
}

Expand Down
29 changes: 17 additions & 12 deletions cypress/e2e/pages/create_tx.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ const nonceInput = 'input[name="nonce"]'
const gasLimitInput = '[name="gasLimit"]'
const rotateLeftIcon = '[data-testid="RotateLeftIcon"]'
const transactionItemExpandable = 'div[id^="transfer"]'
const expandItemIcon = '[data-testid="ExpandMoreIcon"]'

const viewTransactionBtn = 'View transaction'
const transactionDetailsTitle = 'Transaction details'
const QueueLabel = 'needs to be executed first'
const TransactionSummary = 'Send'
const TransactionSummary = 'Send '

const maxAmountBtnStr = 'Max'
const nextBtnStr = 'Next'
Expand Down Expand Up @@ -50,9 +51,9 @@ export function clickOnSendTokensBtn() {
cy.contains(sendTokensBtnStr).click()
}

export function clickOnTokenselectorAndSelectGoerli() {
export function clickOnTokenselectorAndSelectSepolia() {
cy.get(tokenAddressInput).prev().click()
cy.get('ul[role="listbox"]').contains(constants.goerliToken).click()
cy.get('ul[role="listbox"]').contains(constants.tokenNames.sepoliaEther).click()
}

export function setMaxAmount() {
Expand All @@ -66,8 +67,11 @@ export function verifyMaxAmount(token, tokenAbbreviation) {
.contains(token)
.next()
.then((element) => {
const maxBalance = element.text().replace(tokenAbbreviation, '').trim()
cy.get(amountInput).should('have.value', maxBalance)
const maxBalance = parseFloat(element.text().replace(tokenAbbreviation, '').trim())
cy.get(amountInput).should(($input) => {
const actualValue = parseFloat($input.val())
expect(actualValue).to.be.closeTo(maxBalance, 0.1)
})
console.log(maxBalance)
})
}
Expand Down Expand Up @@ -99,9 +103,7 @@ export function verifyConfirmTransactionData() {
// Asserting the sponsored info is present
cy.contains(executeStr).scrollIntoView().should('be.visible')

cy.get('span').contains(estimatedFeeStr).next().should('have.css', 'text-decoration-line', 'line-through')
cy.contains(transactionsPerHrStr)
cy.contains(transactionsPerHr5Of5Str)
cy.get('span').contains(estimatedFeeStr)
}

export function openExecutionParamsModal() {
Expand All @@ -112,10 +114,9 @@ export function openExecutionParamsModal() {
export function verifyAndSubmitExecutionParams() {
cy.contains(executionParamsStr).parents('form').as('Paramsform')

// Only gaslimit should be editable when the relayer is selected
const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)']
const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)', 'Gas limit']
arrayNames.forEach((element) => {
cy.get('@Paramsform').find('label').contains(`${element}`).next().find('input').should('be.disabled')
cy.get('@Paramsform').find('label').contains(`${element}`).next().find('input').should('not.be.disabled')
})

cy.get('@Paramsform').find(gasLimitInput).clear().type('300000').invoke('prop', 'value').should('equal', '300000')
Expand Down Expand Up @@ -150,7 +151,7 @@ export function verifyQueueLabel() {
}

export function verifyTransactionSummary(sendValue) {
cy.contains(TransactionSummary + `${sendValue} ${constants.tokenAbbreviation.gor}`).should('exist')
cy.contains(TransactionSummary + `${sendValue} ${constants.tokenAbbreviation.sep}`).should('exist')
}

export function verifyDateExists(date) {
Expand Down Expand Up @@ -189,3 +190,7 @@ export function clickOnExpandAllBtn() {
export function clickOnCollapseAllBtn() {
cy.contains(collapseAllBtnStr).click()
}

export function clickOnExpandIcon() {
cy.get(expandItemIcon).click()
}
34 changes: 14 additions & 20 deletions cypress/e2e/pages/dashboard.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ export function verifyOverviewWidgetData() {

cy.get('@overviewSection').within(() => {
// Prefix is separated across elements in EthHashInfo
cy.contains(constants.TEST_SAFE).should('exist')
cy.contains('1/2')
cy.get(`a[href="${constants.BALANCE_URL}${encodeURIComponent(constants.TEST_SAFE)}"]`).contains(viewAssetsStr)
// Text next to Tokens contains a number greater than 0
cy.contains('p', tokensStr).next().contains('1')
cy.contains('p', nftStr).next().contains('0')
cy.contains(constants.SEPOLIA_TEST_SAFE_5).should('exist')
cy.get('h2').contains('Overview')
cy.get(`a[href="${constants.BALANCE_URL}${encodeURIComponent(constants.SEPOLIA_TEST_SAFE_5)}"]`).contains(
viewAssetsStr,
)
})
}

Expand All @@ -45,9 +44,15 @@ export function verifyTxQueueWidget() {
cy.contains(noTransactionStr).should('not.exist')

// Queued txns
cy.contains(`a[href^="/transactions/tx?id=multisig_0x"]`, '13' + 'Send' + '-0.00002 GOR' + '1/1').should('exist')

cy.contains(`a[href="${constants.transactionQueueUrl}${encodeURIComponent(constants.TEST_SAFE)}"]`, viewAllStr)
cy.contains(
`a[href^="/transactions/tx?id=multisig_0x"]`,
'13' + 'Send' + `-0.00002 ${constants.tokenAbbreviation.sep}` + '1/1',
).should('exist')

cy.contains(
`a[href="${constants.transactionQueueUrl}${encodeURIComponent(constants.SEPOLIA_TEST_SAFE_5)}"]`,
viewAllStr,
)
})
}

Expand All @@ -71,17 +76,6 @@ export function verifyFeaturedAppsSection() {
}

export function verifySafeAppsSection() {
// Create an alias for the Safe Apps section
cy.contains('h2', safeAppStr).parents('section').as('safeAppsSection')

cy.get('@safeAppsSection').contains(exploreSafeApps)

// Regular safe apps
cy.get('@safeAppsSection').within(() => {
// Find exactly 5 Safe Apps cards inside the Safe Apps section
cy.get(`a[href^="${constants.openAppsUrl}${encodeURIComponent(constants.TEST_SAFE)}&appUrl=http"]`).should(
'have.length',
5,
)
})
}
11 changes: 5 additions & 6 deletions cypress/e2e/pages/import_export.pages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as constants from '../../support/constants'
import { format } from 'date-fns'
const path = require('path')

Expand Down Expand Up @@ -33,8 +34,8 @@ export function uploadFile(filePath) {

export function verifyImportModalData() {
//verifies that the modal says the amount of chains/addressbook values it uploaded for file ../fixtures/data_import.json
cy.contains('Added Safe Accounts on 3 chains').should('be.visible')
cy.contains('Address book for 3 chains').should('be.visible')
cy.contains('Added Safe Accounts on 4 chains').should('be.visible')
cy.contains('Address book for 4 chains').should('be.visible')
cy.contains('Settings').should('be.visible')
cy.contains('Bookmarked Safe Apps').should('be.visible')
}
Expand All @@ -55,10 +56,8 @@ export function clickOnAddressBookBtn() {

export function verifyImportedAddressBookData() {
//Verifies imported owners in the Address book for file ../fixtures/data_import.json
cy.get('tbody tr:nth-child(1) td:nth-child(1)').contains('test1')
cy.get('tbody tr:nth-child(1) td:nth-child(2)').contains('0x61a0c717d18232711bC788F19C9Cd56a43cc8872')
cy.get('tbody tr:nth-child(2) td:nth-child(1)').contains('test2')
cy.get('tbody tr:nth-child(2) td:nth-child(2)').contains('0x7724b234c9099C205F03b458944942bcEBA13408')
cy.get('tbody tr:nth-child(1) td:nth-child(1)').contains(constants.SEPOLIA_CSV_ENTRY.name)
cy.get('tbody tr:nth-child(1) td:nth-child(2)').contains(constants.SEPOLIA_CSV_ENTRY.address.substring(4))
}

export function clickOnAppsBtn() {
Expand Down
11 changes: 6 additions & 5 deletions cypress/e2e/pages/load_safe.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ export function selectGoerli() {
cy.contains('span', constants.networks.goerli)
}

export function selectSepolia() {
cy.get('ul li').contains(constants.networks.sepolia).click()
cy.contains('span', constants.networks.sepolia)
}

export function selectPolygon() {
cy.get('ul li').contains(constants.networks.polygon).click()
cy.contains('span', constants.networks.polygon)
}

export function verifyNameInputHasPlceholder() {
cy.get(nameInput).should('have.attr', 'placeholder').should('match', constants.goerlySafeName)
}

export function inputName(name) {
cy.get(nameInput).type(name).should('have.value', name)
}
Expand All @@ -53,7 +54,7 @@ export function inputAddress(address) {

export function verifyAddressInputValue() {
// The address field should be filled with the "bare" QR code's address
const [, address] = constants.GOERLI_TEST_SAFE.split(':')
const [, address] = constants.SEPOLIA_TEST_SAFE_1.split(':')
cy.get('input[name="address"]').should('have.value', address)
}

Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/pages/main.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import * as constants from '../../support/constants'

const acceptSelection = 'Accept selection'

export function clickOnSideMenuItem(item) {
cy.get('p').contains(item).click()
}

export function acceptCookies() {
cy.wait(1000)
cy.get('button')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/smoke/address_book.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const EDITED_NAME = 'Edited Owner1'
describe('Address book tests', () => {
before(() => {
cy.clearLocalStorage()
cy.visit(constants.addressBookUrl + constants.GOERLI_TEST_SAFE)
cy.visit(constants.addressBookUrl + constants.SEPOLIA_TEST_SAFE_1)
main.acceptCookies()
})

Expand Down Expand Up @@ -41,7 +41,7 @@ describe('Address book tests', () => {
addressBook.clickOnImportFileBtn()
addressBook.importFile()
addressBook.verifyImportModalIsClosed()
addressBook.verifyDataImported(constants.GOERLI_CSV_ENTRY.name, constants.GOERLI_CSV_ENTRY.address)
addressBook.verifyDataImported(constants.SEPOLIA_CSV_ENTRY.name, constants.SEPOLIA_CSV_ENTRY.address)
})

it.skip('Verify Gnosis Chain imported address can be found [C56066]', () => {
Expand Down
Loading
Loading