From 3c49bc1635c5fde427f5d1594c22556ff1ee44fd Mon Sep 17 00:00:00 2001 From: mike10ca Date: Fri, 22 Sep 2023 15:01:46 +0200 Subject: [PATCH] Address comments in PR --- cypress/e2e/pages/create_tx.pages.js | 6 +- cypress/e2e/pages/safeapps.pages.js | 6 +- cypress/e2e/safe-apps/apps_list.cy.js | 16 ++--- cypress/e2e/smoke/tx_history.cy.js | 86 +++++++++++++-------------- cypress/support/constants.js | 18 +++--- 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/cypress/e2e/pages/create_tx.pages.js b/cypress/e2e/pages/create_tx.pages.js index 9eeb58934f..f60859d689 100644 --- a/cypress/e2e/pages/create_tx.pages.js +++ b/cypress/e2e/pages/create_tx.pages.js @@ -27,7 +27,7 @@ const editBtnStr = 'Edit' const executionParamsStr = 'Execution parameters' const noLaterStr = 'No, later' const signBtnStr = 'Sign' -const expandallbtnStr = 'Expand all' +const expandAllBtnStr = 'Expand all' const collapseAllBtnStr = 'Collapse all' export function clickOnNewtransactionBtn() { @@ -133,7 +133,7 @@ export function clickOnSignTransactionBtn() { } export function waitForProposeRequest() { - cy.intercept('POST', constants.proposeEndPoint).as('ProposeTx') + cy.intercept('POST', constants.proposeEndpoint).as('ProposeTx') cy.wait('@ProposeTx') } @@ -186,6 +186,6 @@ export function clickOnExpandAllBtn() { cy.contains(expandallbtnStr).click() } -export function lickOnCollapseAllBtn() { +export function clickOnCollapseAllBtn() { cy.contains(collapseAllBtnStr).click() } diff --git a/cypress/e2e/pages/safeapps.pages.js b/cypress/e2e/pages/safeapps.pages.js index 1f20703c65..4700348f6b 100644 --- a/cypress/e2e/pages/safeapps.pages.js +++ b/cypress/e2e/pages/safeapps.pages.js @@ -1,6 +1,6 @@ import * as constants from '../../support/constants' -const searchappInput = 'input[id="search-by-name"]' +const searchAppInput = 'input[id="search-by-name"]' const appUrlInput = 'input[name="appUrl"]' const closePreviewWindowBtn = 'button[aria-label*="Close"][aria-label*="preview"]' @@ -51,11 +51,11 @@ export const permissionCheckboxNames = { fullscreen: 'Fullscreen', } export function typeAppName(name) { - cy.get(searchappInput).clear().type(name) + cy.get(searchAppInput).clear().type(name) } export function clearSearchAppInput() { - cy.get(searchappInput).clear() + cy.get(searchAppInput).clear() } export function verifyLinkName(name) { diff --git a/cypress/e2e/safe-apps/apps_list.cy.js b/cypress/e2e/safe-apps/apps_list.cy.js index 7acaa92700..a6db25138e 100644 --- a/cypress/e2e/safe-apps/apps_list.cy.js +++ b/cypress/e2e/safe-apps/apps_list.cy.js @@ -15,19 +15,19 @@ describe('The Safe Apps list', () => { describe('When searching apps', () => { it('should filter the list by app name', () => { // Wait for /safe-apps response - cy.intercept('GET', constants.appsEndPoint).then(() => { - safeapps.typeAppName(constants.appNames.walletconnect) + cy.intercept('GET', constants.appsEndpoint).then(() => { + safeapps.typeAppName(constants.appNames.walletConnect) safeapps.verifyLinkName(safeapps.linkNames.logo) }) }) it('should filter the list by app description', () => { - safeapps.typeAppName(constants.appNames.customcontract) + safeapps.typeAppName(constants.appNames.customContract) safeapps.verifyLinkName(safeapps.linkNames.logo) }) it('should show a not found text when no match', () => { - safeapps.typeAppName(constants.appNames.noresults) + safeapps.typeAppName(constants.appNames.noResults) safeapps.verifyNoAppsTextPresent() }) }) @@ -50,23 +50,23 @@ describe('The Safe Apps list', () => { describe('When adding a custom app', () => { it('should show an error when the app manifest is invalid', () => { - cy.intercept('GET', constants.invalidappUrl, { + cy.intercept('GET', constants.invalidAppUrl, { name: constants.testAppData.name, }) safeapps.clickOnCustomAppsTab() safeapps.clickOnAddCustomApp() - safeapps.typeCustomAppUrl(constants.invalidappUrl) + safeapps.typeCustomAppUrl(constants.invalidAppUrl) safeapps.verifyAppNotSupportedMsg() }) it('should be added to the list within the custom apps section', () => { - cy.intercept('GET', constants.validappUrlJson, { + cy.intercept('GET', constants.validAppUrlJson, { name: constants.testAppData.name, description: constants.testAppData.descr, icons: [{ src: 'logo.svg', sizes: 'any', type: 'image/svg+xml' }], }) - safeapps.typeCustomAppUrl(constants.validappUrl) + safeapps.typeCustomAppUrl(constants.validAppUrl) safeapps.verifyAppTitle(myCustomAppTitle) safeapps.acceptTC() safeapps.clickOnAddBtn() diff --git a/cypress/e2e/smoke/tx_history.cy.js b/cypress/e2e/smoke/tx_history.cy.js index 06e20b0d8c..81486194ff 100644 --- a/cypress/e2e/smoke/tx_history.cy.js +++ b/cypress/e2e/smoke/tx_history.cy.js @@ -1,6 +1,6 @@ import * as constants from '../../support/constants' import * as main from '../pages/main.page' -import * as createtx from '../pages/create_tx.pages' +import * as createTx from '../pages/create_tx.pages' const INCOMING = 'Received' const OUTGOING = 'Sent' @@ -30,8 +30,8 @@ describe('Transaction history', () => { const time4 = '5:01 PM' const success = 'Success' - createtx.verifyDateExists(DATE) - createtx.verifyDateExists(NEXT_DATE_LABEL) + createTx.verifyDateExists(DATE) + createTx.verifyDateExists(NEXT_DATE_LABEL) // Transaction summaries from October 9th const rows = cy.contains('div', DATE).nextUntil(`div:contains(${NEXT_DATE_LABEL})`) @@ -43,77 +43,77 @@ describe('Transaction history', () => { .last() .within(() => { // Type - createtx.verifyImageAlttxt(0, INCOMING) - createtx.verifyStatus(constants.transactionStatus.received) + createTx.verifyImageAlttxt(0, INCOMING) + createTx.verifyStatus(constants.transactionStatus.received) // Info - createtx.verifyImageAlttxt(1, constants.tokenAbbreviation.gor) - createtx.verifyTransactionStrExists(amount) - createtx.verifyTransactionStrExists(time) - createtx.verifyTransactionStrExists(success) + createTx.verifyImageAlttxt(1, constants.tokenAbbreviation.gor) + createTx.verifyTransactionStrExists(amount) + createTx.verifyTransactionStrExists(time) + createTx.verifyTransactionStrExists(success) }) // CowSwap deposit of Wrapped Ether .prev() .within(() => { - createtx.verifyTransactionStrExists('0') + createTx.verifyTransactionStrExists('0') // TODO: update next line after fixing the logo // cy.find('img').should('have.attr', 'src').should('include', WRAPPED_ETH) - createtx.verifyTransactionStrExists(constants.tokenNames.wrapped_ether) - createtx.verifyTransactionStrExists(constants.transactionStatus.deposit) - createtx.verifyTransactionStrExists(time2) - createtx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(constants.tokenNames.wrappedEther) + createTx.verifyTransactionStrExists(constants.transactionStatus.deposit) + createTx.verifyTransactionStrExists(time2) + createTx.verifyTransactionStrExists(constants.transactionStatus.success) }) // CowSwap approval of Wrapped Ether .prev() .within(() => { - createtx.verifyTransactionStrExists('1') + createTx.verifyTransactionStrExists('1') // Type // TODO: update next line after fixing the logo // cy.find('img').should('have.attr', 'src').should('include', WRAPPED_ETH) - createtx.verifyTransactionStrExists(constants.transactionStatus.approve) - createtx.verifyTransactionStrExists(time3) - createtx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(constants.transactionStatus.approve) + createTx.verifyTransactionStrExists(time3) + createTx.verifyTransactionStrExists(constants.transactionStatus.success) }) // Contract interaction .prev() .within(() => { - createtx.verifyTransactionStrExists('2') - createtx.verifyTransactionStrExists(constants.transactionStatus.interaction) - createtx.verifyTransactionStrExists(time4) - createtx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists('2') + createTx.verifyTransactionStrExists(constants.transactionStatus.interaction) + createTx.verifyTransactionStrExists(time4) + createTx.verifyTransactionStrExists(constants.transactionStatus.success) }) // Send 0.11 WETH .prev() .within(() => { - createtx.verifyImageAlttxt(0, OUTGOING) - createtx.verifyTransactionStrExists(constants.transactionStatus.sent) - createtx.verifyTransactionStrExists(amount2) - createtx.verifyTransactionStrExists(time4) - createtx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyImageAlttxt(0, OUTGOING) + createTx.verifyTransactionStrExists(constants.transactionStatus.sent) + createTx.verifyTransactionStrExists(amount2) + createTx.verifyTransactionStrExists(time4) + createTx.verifyTransactionStrExists(constants.transactionStatus.success) }) // Receive 120 DAI .prev() .within(() => { - createtx.verifyTransactionStrExists(constants.transactionStatus.received) - createtx.verifyTransactionStrExists(amount3) - createtx.verifyTransactionStrExists(time4) - createtx.verifyTransactionStrExists(constants.transactionStatus.success) + createTx.verifyTransactionStrExists(constants.transactionStatus.received) + createTx.verifyTransactionStrExists(amount3) + createTx.verifyTransactionStrExists(time4) + createTx.verifyTransactionStrExists(constants.transactionStatus.success) }) }) it('should expand/collapse all actions', () => { - createtx.clickOnTransactionExpandableItem('Mar 24, 2023', () => { - createtx.verifyTransactionStrNotVible(str1) - createtx.verifyTransactionStrNotVible(str2) - createtx.verifyTransactionStrNotVible(str3) - createtx.lickOnExpandAllBtn() - createtx.verifyTransactionStrExists(str1) - createtx.verifyTransactionStrExists(str2) - createtx.verifyTransactionStrExists(str3) - createtx.lickOnCollapseAllBtn() - createtx.verifyTransactionStrNotVible(str1) - createtx.verifyTransactionStrNotVible(str2) - createtx.verifyTransactionStrNotVible(str3) + createTx.clickOnTransactionExpandableItem('Mar 24, 2023', () => { + createTx.verifyTransactionStrNotVible(str1) + createTx.verifyTransactionStrNotVible(str2) + createTx.verifyTransactionStrNotVible(str3) + createTx.clickOnExpandAllBtn() + createTx.verifyTransactionStrExists(str1) + createTx.verifyTransactionStrExists(str2) + createTx.verifyTransactionStrExists(str3) + createTx.clickOnCollapseAllBtn() + createTx.verifyTransactionStrNotVible(str1) + createTx.verifyTransactionStrNotVible(str2) + createTx.verifyTransactionStrNotVible(str3) }) }) }) diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 50eb7e1c6f..77e3994062 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -31,12 +31,12 @@ export const appsUrl = '/apps' export const requestPermissionsUrl = '/request-permissions' export const getPermissionsUrl = '/get-permissions' export const appSettingsUrl = '/settings/safe-apps' -export const invalidappUrl = 'https://my-invalid-custom-app.com/manifest.json' -export const validappUrlJson = 'https://my-valid-custom-app.com/manifest.json' -export const validappUrl = 'https://my-valid-custom-app.com' +export const invalidAppUrl = 'https://my-invalid-custom-app.com/manifest.json' +export const validAppUrlJson = 'https://my-valid-custom-app.com/manifest.json' +export const validAppUrl = 'https://my-valid-custom-app.com' -export const proposeEndPoint = '/**/propose' -export const appsEndPoint = '/**/safe-apps' +export const proposeEndpoint = '/**/propose' +export const appsEndpoint = '/**/safe-apps' export const GOERLI_CSV_ENTRY = { name: 'goerli user 1', @@ -59,9 +59,9 @@ export const tokenAbbreviation = { } export const appNames = { - walletconnect: 'walletconnect', - customcontract: 'compose custom contract', - noresults: 'atextwithoutresults', + walletConnect: 'walletconnect', + customContract: 'compose custom contract', + noResults: 'atextwithoutresults', } export const testAppData = { @@ -84,5 +84,5 @@ export const transactionStatus = { } export const tokenNames = { - wrapped_ether: 'Wrapped Ether', + wrappedEther: 'Wrapped Ether', }