From c65fbc37250cfc7f433f28204fb3448cca443c77 Mon Sep 17 00:00:00 2001 From: mike10ca Date: Wed, 31 Jan 2024 10:38:49 +0100 Subject: [PATCH] tests: fix drain account tests --- .../e2e/safe-apps/drain_account.spec.cy.js | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/safe-apps/drain_account.spec.cy.js b/cypress/e2e/safe-apps/drain_account.spec.cy.js index 3c2f2a14fa..a45d4b537b 100644 --- a/cypress/e2e/safe-apps/drain_account.spec.cy.js +++ b/cypress/e2e/safe-apps/drain_account.spec.cy.js @@ -2,14 +2,15 @@ import 'cypress-file-upload' import * as constants from '../../support/constants' import * as main from '../pages/main.page' import * as safeapps from '../pages/safeapps.pages' +import * as navigation from '../pages/navigation.page' describe('Drain Account tests', { defaultCommandTimeout: 12000 }, () => { const appUrl = constants.drainAccount_url const iframeSelector = `iframe[id="iframe-${appUrl}"]` - const visitUrl = `/apps/open?safe=${constants.SEPOLIA_TEST_SAFE_5}&appUrl=${encodeURIComponent(appUrl)}` + const visitUrl = `/apps/open?safe=${constants.SEPOLIA_TEST_SAFE_9}&appUrl=${encodeURIComponent(appUrl)}` beforeEach(() => { - cy.intercept(`**//v1/chains/5/safes/${constants.SEPOLIA_TEST_SAFE_5.substring(4)}/balances/**`, { + cy.intercept(`**//v1/chains/11155111/safes/${constants.SEPOLIA_TEST_SAFE_9.substring(4)}/balances/**`, { fixture: 'balances.json', }) @@ -19,72 +20,72 @@ describe('Drain Account tests', { defaultCommandTimeout: 12000 }, () => { safeapps.clickOnContinueBtn() }) - it.skip('Verify drain can be created', () => { + it('Verify drain can be created', () => { cy.enter(iframeSelector).then((getBody) => { - getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) + getBody().findByLabelText(safeapps.recipientStr).type(constants.SEPOLIA_TEST_SAFE_10) getBody().findAllByText(safeapps.transferEverythingStr).click() }) cy.findByRole('button', { name: safeapps.testTransfer1 }) cy.findByRole('button', { name: safeapps.testNativeTransfer2 }) }) - it.skip('Verify partial drain can be created', () => { + it('Verify partial drain can be created', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() getBody().findAllByLabelText(safeapps.selectRowChbxStr).eq(1).click() getBody().findAllByLabelText(safeapps.selectRowChbxStr).eq(2).click() - getBody().findByLabelText(safeapps.recipientStr).clear().type(constants.SAFE_APP_ADDRESS_2) + getBody().findByLabelText(safeapps.recipientStr).clear().type(constants.SEPOLIA_TEST_SAFE_10) getBody().findAllByText(safeapps.transfer2AssetsStr).click() }) cy.findByRole('button', { name: safeapps.testTransfer2 }) cy.findByRole('button', { name: safeapps.testNativeTransfer1 }) }) + // TODO: ENS does not resolve it.skip('Verify a drain can be created when a ENS is specified', () => { cy.enter(iframeSelector).then((getBody) => { - getBody().findByLabelText(safeapps.recipientStr).type('goerli-test-safe.eth').wait(2000) + getBody().findByLabelText(safeapps.recipientStr).type(constants.ENS_TEST_SEPOLIA).wait(2000) getBody().findAllByText(safeapps.transferEverythingStr).click() }) cy.findByRole('button', { name: safeapps.testTransfer1 }) cy.findByRole('button', { name: safeapps.testNativeTransfer2 }) }) - // TODO: Adjust safe - owner - it.skip('Verify when cancelling a drain, previous data is preserved', () => { + it('Verify when cancelling a drain, previous data is preserved', () => { cy.enter(iframeSelector).then((getBody) => { - getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) + getBody().findByLabelText(safeapps.recipientStr).type(constants.SEPOLIA_TEST_SAFE_10) getBody().findAllByText(safeapps.transferEverythingStr).click() }) - cy.findByRole('button', { name: safeapps.cancelBtnStr }).click() + navigation.clickOnModalCloseBtn() cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText(safeapps.transferEverythingStr).should('be.visible') }) }) - it.skip('Verify a drain cannot be created with no recipient selected', () => { + it('Verify a drain cannot be created with no recipient selected', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findAllByText(safeapps.transferEverythingStr).click() getBody().findByText(safeapps.validRecipientAddressStr) }) }) - it.skip('Verify a drain cannot be created with invalid recipient selected', () => { + it('Verify a drain cannot be created with invalid recipient selected', () => { cy.enter(iframeSelector).then((getBody) => { - getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2.substring(1)) + getBody().findByLabelText(safeapps.recipientStr).type(constants.SEPOLIA_TEST_SAFE_10.substring(1)) getBody().findAllByText(safeapps.transferEverythingStr).click() getBody().findByText(safeapps.validRecipientAddressStr) }) }) - it.skip('Verify a drain cannot be created when no assets are selected', () => { + it('Verify a drain cannot be created when no assets are selected', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() - getBody().findByLabelText(safeapps.recipientStr).type(constants.SAFE_APP_ADDRESS_2) + getBody().findByLabelText(safeapps.recipientStr).type(constants.SEPOLIA_TEST_SAFE_10) getBody().findAllByText(safeapps.noTokensSelectedStr).should('be.visible') }) }) - it.skip('Verify a drain cannot be created when no assets and recipient are selected', () => { + it('Verify a drain cannot be created when no assets and recipient are selected', () => { cy.enter(iframeSelector).then((getBody) => { getBody().findByLabelText(safeapps.selectAllRowsChbxStr).click() getBody().findAllByText(safeapps.noTokensSelectedStr).should('be.visible')