Skip to content

Commit

Permalink
Fix regression tests (#3835)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca authored Jun 12, 2024
1 parent 5a9ab12 commit e92c01d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
},
retries: {
runMode: 3,
openMode: 3,
openMode: 0,
},
e2e: {
setupNodeEvents(on, config) {
Expand Down
13 changes: 9 additions & 4 deletions cypress/e2e/pages/assets.pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as main from './main.page'
import * as addressbook from '../pages/address_book.page'
import * as createTx from '../pages/create_tx.pages'
import { tableRow } from '../pages/address_book.page'

let etherscanLinkSepolia = 'a[aria-label="View on sepolia.etherscan.io"]'
export const balanceSingleRow = '[aria-labelledby="tableTitle"] > tbody tr'
Expand Down Expand Up @@ -43,14 +44,16 @@ const pageCountString1to25 = '1–25 of'
const pageCountString1to10 = '1–10 of'
const pageCountString10to20 = '11–20 of'

export const fiatRegex = new RegExp(`([0-9]{1,3},)*[0-9]{1,3}.[0-9]{2}`)
export const fiatRegex = new RegExp(`\\$?(([0-9]{1,3},)*[0-9]{1,3}(\\.[0-9]{2})?|0)`)

export const tokenListOptions = {
allTokens: 'span[data-track="assets: Show all tokens"]',
default: 'span[data-track="assets: Show default tokens"]',
}
export const currencyEUR = 'EUR'
export const currencyUSD = 'USD'
export const currencyEUR = '€'
export const currencyOptionEUR = 'EUR'
export const currency$ = '$'
export const currencyCAD = 'CAD'

export const currentcySepoliaFormat = '0.09996 ETH'

Expand Down Expand Up @@ -192,10 +195,12 @@ export function clickOnTokenBalanceSortBtn() {
export function verifyTokenNamesOrder(option = 'ascending') {
const tokens = []

main.getTextToArray('tr p', tokens)
main.getTextToArray(tableRow, tokens)

cy.wrap(tokens).then((arr) => {
cy.log('*** Original array ' + tokens)
let sortedNames = [...arr].sort()
cy.log('*** Sorted array ' + sortedNames)
if (option == 'descending') sortedNames = [...arr].sort().reverse()
expect(arr).to.deep.equal(sortedNames)
})
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/regression/balances_pagination.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as main from '../../e2e/pages/main.page'

const ASSETS_LENGTH = 8

describe('Balance pagination tests', () => {
// Skip until connection error is resolved
describe.skip('Balance pagination tests', () => {
before(() => {
cy.clearLocalStorage()
// Open the Safe used for testing
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/regression/sidebar_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ describe('Sidebar added sidebar tests', () => {
})

it('Verify Fiat currency changes when edited in the assets tab', () => {
assets.changeCurrency(constants.currencies.cad)
sideBar.checkCurrencyInHeader(constants.currencies.cad)
assets.changeCurrency(assets.currencyCAD)
sideBar.checkCurrencyInHeader(assets.currency$)
})

// Waiting for endpoint from CGW
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/regression/tokens.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ describe('Tokens tests', () => {
it('Verify the default Fiat currency and the effects after changing it', () => {
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.verifyFirstRowDoesNotContainCurrency(assets.currencyEUR, FIAT_AMOUNT_COLUMN)
assets.verifyFirstRowContainsCurrency(assets.currencyUSD, FIAT_AMOUNT_COLUMN)
assets.verifyFirstRowContainsCurrency(assets.currency$, FIAT_AMOUNT_COLUMN)
assets.clickOnCurrencyDropdown()
assets.selectCurrency(assets.currencyEUR)
assets.verifyFirstRowDoesNotContainCurrency(assets.currencyUSD, FIAT_AMOUNT_COLUMN)
assets.selectCurrency(assets.currencyOptionEUR)
assets.verifyFirstRowDoesNotContainCurrency(assets.currency$, FIAT_AMOUNT_COLUMN)
assets.verifyFirstRowContainsCurrency(assets.currencyEUR, FIAT_AMOUNT_COLUMN)
})

Expand Down
5 changes: 0 additions & 5 deletions cypress/support/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ export const tokenAbbreviation = {
tpcc: 'tpcc',
}

export const currencies = {
cad: 'CAD',
aud: 'AUD',
}

export const appNames = {
walletConnect: 'walletconnect',
txbuilder: 'transaction builder',
Expand Down

0 comments on commit e92c01d

Please sign in to comment.