From ef39efb416e003877aa0e70bf1cee506f322e946 Mon Sep 17 00:00:00 2001 From: mike10ca Date: Tue, 7 Nov 2023 15:13:55 +0100 Subject: [PATCH] Update test definitions --- cypress.config.js | 2 +- cypress/e2e/pages/safeapps.pages.js | 3 ++ ...in.spec.cy.js => drain_account.spec.cy.js} | 24 +++++----- cypress/e2e/safe-apps/tx-builder.spec.cy.js | 46 +++++++++---------- 4 files changed, 37 insertions(+), 38 deletions(-) rename cypress/e2e/safe-apps/{drain.spec.cy.js => drain_account.spec.cy.js} (78%) diff --git a/cypress.config.js b/cypress.config.js index 753ec36daa..ff3bf4baf8 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -5,7 +5,7 @@ export default defineConfig({ trashAssetsBeforeRuns: true, retries: { - runMode: 3, + runMode: 1, openMode: 0, }, diff --git a/cypress/e2e/pages/safeapps.pages.js b/cypress/e2e/pages/safeapps.pages.js index 00a44684fb..fb7401609b 100644 --- a/cypress/e2e/pages/safeapps.pages.js +++ b/cypress/e2e/pages/safeapps.pages.js @@ -73,6 +73,7 @@ export const anotherChainStr = 'This batch is from another Chain (1)!' export const useImplementationABI = 'Use Implementation ABI' export const addressNotValidStr = 'The address is not valid' export const transferEverythingStr = 'Transfer everything' +export const noTokensSelectedStr = 'No tokens selected' export const requiredStr = 'Required' export const e3eTestStr = 'E2E test' export const createBtnStr = 'Create' @@ -98,6 +99,8 @@ export const gridItem = 'main .MuiPaper-root > .MuiGrid-item' export const linkNames = { logo: /logo/i, } +export const abi = + '[{{}"inputs":[{{}"internalType":"address","name":"_singleton","type":"address"{}}],"stateMutability":"nonpayable","type":"constructor"{}},{{}"stateMutability":"payable","type":"fallback"{}}]' export const permissionCheckboxes = { camera: 'input[name="camera"]', diff --git a/cypress/e2e/safe-apps/drain.spec.cy.js b/cypress/e2e/safe-apps/drain_account.spec.cy.js similarity index 78% rename from cypress/e2e/safe-apps/drain.spec.cy.js rename to cypress/e2e/safe-apps/drain_account.spec.cy.js index c3a630ad52..87d878f307 100644 --- a/cypress/e2e/safe-apps/drain.spec.cy.js +++ b/cypress/e2e/safe-apps/drain_account.spec.cy.js @@ -19,7 +19,7 @@ describe('Drain Account Safe App tests', { defaultCommandTimeout: 12000 }, () => safeapps.clickOnContinueBtn() }) - it('should allow to perform a drain', () => { + it('Verify drain can be created [C56627]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) getBody().findAllByText(safeapps.transferEverythingStr).click() @@ -28,7 +28,7 @@ describe('Drain Account Safe App tests', { defaultCommandTimeout: 12000 }, () => cy.findByRole('button', { name: safeapps.testNativeTransfer2 }) }) - it('should allow to perform a partial drain', () => { + it('Verify partial drain can be created [C56628]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() getBody().findAllByLabelText(safeapps.selectRowChbxStr).eq(1).click() @@ -40,7 +40,7 @@ describe('Drain Account Safe App tests', { defaultCommandTimeout: 12000 }, () => cy.findByRole('button', { name: safeapps.testNativeTransfer1 }) }) - it('should allow to perform a drain when a ENS is specified', () => { + it('Verify a drain can be created when a ENS is specified [C56629]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.recipientStr).type('goerli-test-safe.eth').wait(2000) getBody().findAllByText(safeapps.transferEverythingStr).click() @@ -49,45 +49,45 @@ describe('Drain Account Safe App tests', { defaultCommandTimeout: 12000 }, () => cy.findByRole('button', { name: safeapps.testNativeTransfer2 }) }) - // Adjust safe - owner - it.skip('should keep previous data when drain is cancelled', () => { + // TODO: Adjust safe - owner + it.skip('Verify when cancelling a drain, previous data is preserved [C56630]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) getBody().findAllByText(safeapps.transferEverythingStr).click() }) - cy.findByRole('button', { name: 'Cancel' }).click() + cy.findByRole('button', { name: safeapps.cancelBtnStr }).click() cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText(safeapps.transferEverythingStr).should('be.visible') }) }) - it('should not allow to perform a drain when no recipient is selected', () => { + it('Verify a drain cannot be created with no recipient selected [C56631]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText(safeapps.transferEverythingStr).click() getBody().findByText(safeapps.validRecipientAddressStr) }) }) - it('should not allow to perform a drain when an invalid recipient is selected', () => { + it('Verify a drain cannot be created with invalid recipient selected [C56632]', () => { cy.enter(iframeSelector).then((getBody) => { - getBody().findByLabelText(safeapps.recipientStr).type('0x49d4450977E2c95362C13D3a31a09311E0Ea26A') + getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2.substring(1)) getBody().findAllByText(safeapps.transferEverythingStr).click() getBody().findByText(safeapps.validRecipientAddressStr) }) }) - it('should not allow to perform a drain when no assets are selected', () => { + it('Verify a drain cannot be created when no assets are selected [C56633]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) - getBody().findAllByText('No tokens selected').should('be.visible') + getBody().findAllByText(safeapps.noTokensSelectedStr).should('be.visible') }) }) it('should not allow to perform a drain when no assets and recipient are selected', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() - getBody().findAllByText('No tokens selected').should('be.visible') + getBody().findAllByText(safeapps.noTokensSelectedStr).should('be.visible') }) }) }) diff --git a/cypress/e2e/safe-apps/tx-builder.spec.cy.js b/cypress/e2e/safe-apps/tx-builder.spec.cy.js index 3cca89f199..fd850c112f 100644 --- a/cypress/e2e/safe-apps/tx-builder.spec.cy.js +++ b/cypress/e2e/safe-apps/tx-builder.spec.cy.js @@ -3,7 +3,7 @@ import * as constants from '../../support/constants' import * as main from '../pages/main.page' import * as safeapps from '../pages/safeapps.pages' -describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { +describe('Tx-builder Safe App tests', { defaultCommandTimeout: 20000 }, () => { const appUrl = constants.TX_Builder_url const iframeSelector = `iframe[id="iframe-${appUrl}"]` const visitUrl = `/apps/open?safe=${constants.GOERLI_SAFE_APPS_SAFE}&appUrl=${encodeURIComponent(appUrl)}` @@ -14,7 +14,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { safeapps.clickOnContinueBtn() }) - it('should allow to create and send a simple batch', () => { + it('Verify a simple batch can be created [C56609]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS) getBody().find(safeapps.contractMethodIndex).parent().click() @@ -32,7 +32,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.findAllByText(constants.SAFE_APP_ADDRESS_2_SHORT).should('have.length', 1) }) - it('should allow to create and send a complex batch', () => { + it('Verify a complex batch can be created [C56610]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS) getBody().find(safeapps.contractMethodIndex).parent().click() @@ -54,7 +54,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.findAllByText('True').should('have.length', 3) }) - it('should allow to create and send a batch to an ENS name', () => { + it('Verify a batch can be created using ENS name [C56611]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.ENS_TEST_GOERLI) getBody().findByRole('button', { name: safeapps.useImplementationABI }).click() @@ -72,24 +72,20 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.findByText(safeapps.thresholdStr2).should('exist') }) - it('should allow to a create and send a batch from an ABI', () => { + it('Verify a batch can be created from an ABI [C56612]', () => { cy.enter(iframeSelector).then((getBody) => { - getBody() - .findByLabelText(safeapps.enterABIStr) - .type( - '[{{}"inputs":[{{}"internalType":"address","name":"_singleton","type":"address"{}}],"stateMutability":"nonpayable","type":"constructor"{}},{{}"stateMutability":"payable","type":"fallback"{}}]', - ) + getBody().findByLabelText(safeapps.enterABIStr).type(safeapps.abi) getBody().findByLabelText(safeapps.toAddressStr).type(constants.SAFE_APP_ADDRESS_2) getBody().findByLabelText(safeapps.gorValue).type('0') getBody().findByText(safeapps.addTransactionStr).click() getBody().findByText(safeapps.createBatchStr).click() getBody().findByText(safeapps.sendBatchStr).click() }) - cy.findByRole('heading', { name: /transaction builder/i }).should('be.visible') + cy.get('h4').contains(safeapps.transactionBuilderStr).should('be.visible') cy.findByText(constants.SAFE_APP_ADDRESS_2).should('be.visible') }) - it('should allow to create and send a batch using custom data', () => { + it('Verify a batch with custom data can be created [C56613]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().find('.MuiSwitch-root').click() getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS_3) @@ -103,7 +99,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.findByText(constants.SAFE_APP_ADDRESS_3).should('be.visible') }) - it('should allow to cancel a created batch', () => { + it('Verify a batch can be cancelled [C56614]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS) getBody().find(safeapps.contractMethodIndex).parent().click() @@ -118,7 +114,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should allow to revert a cancel and continue with the flow', () => { + it('Verify cancel operation can be reverted [C56615]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS) getBody().find(safeapps.contractMethodIndex).parent().click() @@ -133,7 +129,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should allow to go back without removing data and add more transactions to the batch', () => { + it('Verify it is allowed to go back without removing data and add more transactions to the batch [C56616]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS) getBody().find(safeapps.contractMethodIndex).parent().click() @@ -154,14 +150,14 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.get('p').contains('2').should('be.visible') }) - it('should not allow to create a batch given invalid address', () => { + it('Verify a batch cannot be created with invalid address [C56617]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS_3) getBody().findAllByText(safeapps.addressNotValidStr).should('have.css', 'color', 'rgb(244, 67, 54)') }) }) - it('should not allow to create a batch given no asset amount', () => { + it('Verify a batch cannot be created without asset amount [C56618]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS_3) getBody().findByText(safeapps.addTransactionStr).click() @@ -169,7 +165,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should not allow to create a batch given no method data', () => { + it('Verify a batch cannot be created without method data [C56619]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS_2) getBody().findByText(safeapps.addTransactionStr).click() @@ -177,7 +173,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should allow to upload a batch, save it to the library, download it & remove it', () => { + it('Verify a batch can be uploaded, saved, downloaded and removed [C56620]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText('choose a file').attachFile('test-working-batch.json', { subjectType: 'drag-n-drop' }) getBody().findAllByText('uploaded').wait(300) @@ -194,7 +190,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { cy.readFile('cypress/downloads/E2E test.json').should('exist') }) - it('should notify when the uploaded batch is from a different chain', () => { + it('Verify there is notification if uploaded batch is from a different chain [C56621]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText('choose a file').attachFile('test-mainnet-batch.json', { subjectType: 'drag-n-drop' }) getBody().findAllByText(safeapps.warningStr).should('be.visible') @@ -202,7 +198,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should show an error when a modified batch is uploaded', () => { + it('Verify there is error message when a modified batch is uploaded [C56622]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText('choose a file').attachFile('test-modified-batch.json', { subjectType: 'drag-n-drop' }) getBody().findAllByText(safeapps.changedPropertiesStr) @@ -210,7 +206,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should not allow to upload an invalid batch', () => { + it('Verify an invalid batch cannot be uploaded [C56623]', () => { cy.enter(iframeSelector).then((getBody) => { getBody() .findAllByText('choose a file') @@ -220,7 +216,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should not allow to upload an empty batch', () => { + it('Verify an empty batch cannot be uploaded [C56624]', () => { cy.enter(iframeSelector).then((getBody) => { getBody() .findAllByText('choose a file') @@ -230,7 +226,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should simulate a valid batch as successful', () => { + it('Verify a valid batch as successful can be simulated [C56625]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.SAFE_APP_ADDRESS_3) getBody().findByLabelText(safeapps.gorValue).type('0') @@ -242,7 +238,7 @@ describe('Tx-builder Safe App tests', { defaultCommandTimeout: 12000 }, () => { }) }) - it('should simulate an invalid batch as failed', () => { + it('Verify an invalid batch as failed can be simulated [C56626]', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.enterAddressStr).type(constants.TEST_SAFE_2) getBody().findByText(safeapps.keepProxiABIStr).click()