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: Make tests independent #2736

Merged
merged 1 commit into from
Nov 2, 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
7 changes: 7 additions & 0 deletions cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export function verifyNewEntryAdded(name, address) {
cy.contains(address).should('exist')
}

export function addEntry(name, address) {
typeInName(name)
typeInAddress(address)
clickOnSaveEntryBtn()
verifyNewEntryAdded(name, address)
}

export function clickOnEditEntryBtn() {
cy.get(editEntryBtn).click({ force: true })
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/pages/batches.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function verifyAmountTransactionsInBatch(count) {
}

export function clickOnConfirmBatchBtn() {
cy.contains(confirmBatchBtn).click()
cy.get('button').contains(confirmBatchBtn).should('be.visible').should('be.enabled').click()
}

export function verifyBatchTransactionsCount(count) {
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/pages/load_safe.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export function selectPolygon() {
cy.contains('span', constants.networks.polygon)
}

export function inputNameAndAddress(name, address) {
inputName(name)
inputAddress(address)
}
export function inputName(name) {
cy.get(nameInput).type(name).should('have.value', name)
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/safe-apps/info_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as main from '../pages/main.page'
import * as safeapps from '../pages/safeapps.pages'

describe('Safe Apps info modal tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.SEPOLIA_TEST_SAFE_5 + constants.appsUrl, { failOnStatusCode: false })
main.acceptCookies()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/safe-apps/preview_drawer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as main from '../pages/main.page'
import * as safeapps from '../pages/safeapps.pages'

describe('Safe Apps info modal tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(`/${constants.SEPOLIA_TEST_SAFE_5}/apps`, { failOnStatusCode: false })
main.acceptCookies()
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/safe-apps/tx_modal.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ const testAppName = 'Cypress Test App'
const testAppDescr = 'Cypress Test App Description'

describe('Transaction modal tests', () => {
before(() => {
cy.clearLocalStorage()
})
beforeEach(() => {
cy.clearLocalStorage()
cy.fixture('safe-app').then((html) => {
cy.intercept('GET', `${constants.testAppUrl}/*`, html)
cy.intercept('GET', `*/manifest.json`, {
Expand Down
15 changes: 9 additions & 6 deletions cypress/e2e/smoke/address_book.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ const NAME = 'Owner1'
const EDITED_NAME = 'Edited Owner1'

describe('Address book tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.addressBookUrl + constants.SEPOLIA_TEST_SAFE_1)
main.acceptCookies()
main.acceptCookies(1)
})

it('Verify entry can be added [C56061]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.typeInName(NAME)
addressBook.typeInAddress(constants.RECIPIENT_ADDRESS)
addressBook.clickOnSaveEntryBtn()
addressBook.verifyNewEntryAdded(NAME, constants.RECIPIENT_ADDRESS)
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
})

it('Verify entered entry in Name input can be saved [C56063]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
addressBook.clickOnEditEntryBtn()
addressBook.typeInNameInput(EDITED_NAME)
addressBook.clickOnSaveButton()
addressBook.verifyNameWasChanged(NAME, EDITED_NAME)
})

it('Verify entry can be deleted [C56062]', () => {
addressBook.clickOnCreateEntryBtn()
addressBook.addEntry(NAME, constants.RECIPIENT_ADDRESS)
// Click the delete button in the first entry
addressBook.clickDeleteEntryButton()
addressBook.clickDeleteEntryModalDeleteButton()
Expand Down Expand Up @@ -63,6 +64,8 @@ describe('Address book tests', () => {
})

it('Verify the address book file can be downloaded [C56065]', () => {
addressBook.clickOnImportFileBtn()
addressBook.importFile()
// Download the export file
const date = format(new Date(), 'yyyy-MM-dd', { timeZone: 'UTC' })
const fileName = `safe-address-book-${date}.csv` //name that is given to the file automatically
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/smoke/balances.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Balance tests', () => {
// Fiat balance regex
const fiatRegex = balances.fiatRegex

before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies(2)
Expand Down Expand Up @@ -114,6 +114,7 @@ describe('Balance tests', () => {
})

it('Verify a token can be unhidden [C56081]', () => {
balances.hideAsset(balances.currencyDaiCap)
balances.openHideTokenMenu()
balances.clickOnTokenCheckbox(balances.currencyDaiCap)
balances.saveHiddenTokenSelection()
Expand Down
20 changes: 15 additions & 5 deletions cypress/e2e/smoke/load_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OWNER_ENS_DEFAULT_NAME = 'test20.eth'
const OWNER_ADDRESS = constants.EOA

describe('Load Safe tests', () => {
before(() => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit(constants.loadNewSafeSepoliaUrl)
main.acceptCookies()
Expand All @@ -39,10 +39,8 @@ describe('Load Safe tests', () => {
cy.get('input[name="address"]').parent().prev('label').as('addressLabel')

createwallet.verifyDefaultWalletName(createwallet.defaltSepoliaPlaceholder)

safe.inputName(testSafeName)
safe.verifyIncorrectAddressErrorMessage()
safe.inputAddress(constants.SEPOLIA_TEST_SAFE_1)
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)

// Type an invalid address
// cy.get('input[name="address"]').clear().type(EOA_ADDRESS)
Expand All @@ -65,17 +63,29 @@ describe('Load Safe tests', () => {
})

it('Verify custom name in the first owner an be set [C56120]', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
})

it('Verify Safe and owner names are displayed in the Review step [C56121]', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_1)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
safe.verifyDataInReviewSection(testSafeName, testOwnerName)
safe.clickOnAddBtn()
})

it('Verify the custom Safe name is successfully loaded [C56122]', () => {
main.verifyHomeSafeUrl(constants.SEPOLIA_TEST_SAFE_1)
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_2)
safe.clickOnNextBtn()
createwallet.typeOwnerName(testOwnerName, 0)
safe.clickOnNextBtn()
safe.verifyDataInReviewSection(testSafeName, testOwnerName)
safe.clickOnAddBtn()
main.verifyHomeSafeUrl(constants.SEPOLIA_TEST_SAFE_2)
safe.veriySidebarSafeNameIsVisible(testSafeName)
safe.verifyOwnerNamePresentInSettings(testOwnerName)
})
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/smoke/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ describe('Transaction history tests', () => {
main.acceptCookies(1)
})

it('Verify October 9th transactions are displayed [C56128]', () => {
it('Verify October 29th transactions are displayed [C56128]', () => {
const DATE = 'Oct 29, 2023'
const NEXT_DATE_LABEL = 'Oct 20, 2023'
const amount = '0.00001 ETH'
const time = '10:39 PM'
const success = 'Success'

createTx.verifyDateExists(DATE)
Expand All @@ -42,7 +41,6 @@ describe('Transaction history tests', () => {
// Info
createTx.verifyImageAltTxt(1, constants.tokenAbbreviation.sep)
createTx.verifyTransactionStrExists(amount)
createTx.verifyTransactionStrExists(time)
createTx.verifyTransactionStrExists(success)
})
})
Expand Down
Loading