Skip to content

Commit

Permalink
Fix pretttier
Browse files Browse the repository at this point in the history
  • Loading branch information
mike10ca committed Sep 8, 2023
1 parent 0d8ff0a commit c5543a3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 71 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": true
}
48 changes: 24 additions & 24 deletions cypress/e2e/pages/address_book.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,79 +15,79 @@ const importBtn = 'Import'
const exportBtn = 'Export'

export function clickOnImportFileBtn() {
cy.contains(importBtn).click()
cy.contains(importBtn).click()
}

export function importFile() {
cy.get('[type="file"]').attachFile('../fixtures/address_book_test.csv')
// Import button should be enabled
cy.get('.MuiDialogActions-root').contains('Import').should('not.be.disabled')
cy.get('.MuiDialogActions-root').contains('Import').click()
cy.get('[type="file"]').attachFile('../fixtures/address_book_test.csv')
// Import button should be enabled
cy.get('.MuiDialogActions-root').contains('Import').should('not.be.disabled')
cy.get('.MuiDialogActions-root').contains('Import').click()
}

export function verifyImportModalIsClosed() {
cy.get('Import address book').should('not.exist')
cy.get('Import address book').should('not.exist')
}

export function verifyDataImported(name, address) {
cy.contains(name).should('exist')
cy.contains(address).should('exist')
cy.contains(name).should('exist')
cy.contains(address).should('exist')
}

export function clickOnExportFileBtn() {
cy.contains(exportBtn).click()
cy.contains(exportBtn).click()
}

export function confirmExport() {
cy.get(exportFileModalBtnSection).contains(exportFileModalExportBtn).click()
cy.get(exportFileModalBtnSection).contains(exportFileModalExportBtn).click()
}

export function clickOnCreateEntryBtn() {
cy.contains(createEntryBtn).click()
cy.contains(createEntryBtn).click()
}

export function tyeInName(name) {
cy.get(nameInput).type(name)
cy.get(nameInput).type(name)
}

export function typeInAddress(address) {
cy.get(addressInput).type(address)
cy.get(addressInput).type(address)
}

export function clickOnSaveEntryBtn() {
cy.contains('button', saveBtn).click()
cy.contains('button', saveBtn).click()
}

export function verifyNewEntryAdded(name, address) {
cy.contains(name).should('exist')
cy.contains(address).should('exist')
cy.contains(name).should('exist')
cy.contains(address).should('exist')
}

export function clickOnEditEntryBtn() {
cy.get(addressBook.editEntryBtn).click({ force: true })
cy.get(addressBook.editEntryBtn).click({ force: true })
}

export function typeInNameInput(name) {
cy.get(addressBook.nameInput).clear().type(name).should('have.value', name);
cy.get(addressBook.nameInput).clear().type(name).should('have.value', name)
}

export function clickOnSaveButton() {
cy.contains('button', saveBtn).click();
cy.contains('button', saveBtn).click()
}

export function verifyNameWasChanged(name, editedName) {
cy.get(name).should('not.exist');
cy.contains(editedName).should('exist');
cy.get(name).should('not.exist')
cy.contains(editedName).should('exist')
}

export function clickDeleteEntryButton() {
cy.get(deleteEntryBtn).click({ force: true });
cy.get(deleteEntryBtn).click({ force: true })
}

export function clickDeleteEntryModalDeleteButton() {
cy.get(deleteEntryModalBtnSection).contains(delteEntryModaldeleteBtn).click();
cy.get(deleteEntryModalBtnSection).contains(delteEntryModaldeleteBtn).click()
}

export function verifyEditedNameNotExists(name) {
cy.get(nae).should('not.exist');
cy.get(nae).should('not.exist')
}
81 changes: 35 additions & 46 deletions cypress/e2e/pages/balances.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const paginationPageList = 'ul[role="listbox"]'
const hiddenTokenSaveBtn = 'Save'
const hideTokenDefaultString = 'Hide tokens'

const pageRowsDefault = '25';
const rowsPerPage10 = '10';
const nextPageBtn = 'button[aria-label="Go to next page"]';
const previousPageBtn = 'button[aria-label="Go to previous page"]';
const tablePageRage21to28 = '21–28 of';
const pageRowsDefault = '25'
const rowsPerPage10 = '10'
const nextPageBtn = 'button[aria-label="Go to next page"]'
const previousPageBtn = 'button[aria-label="Go to previous page"]'
const tablePageRage21to28 = '21–28 of'
const rowsPerPageString = 'Rows per page:'
const pageCountString1to25 = '1–25 of'
const pageCountString1to10 = '1–10 of'
Expand Down Expand Up @@ -47,30 +47,20 @@ export const currentcyGnosisFormat = '< 0.00001 GNO'
export const currencyOx = /^0x$/
export const currentcyOxFormat = '1.003 ZRX'


export function verityTokenAltImageIsVisible(currency, alttext) {
cy.contains(currency)
.parents('tr')
.within(() => {
cy.get(`img[alt=${alttext}]`).should('be.visible');
});
cy.get(`img[alt=${alttext}]`).should('be.visible')
})
}

export function verifyAssetNameHasExplorerLink(currency, columnName) {
cy.contains(currency)
.parents('tr')
.find('td')
.eq(columnName)
.find(etherscanLink)
.should('be.visible');
cy.contains(currency).parents('tr').find('td').eq(columnName).find(etherscanLink).should('be.visible')
}

export function verifyBalance(currency, tokenAmountColumn, alttext) {
cy.contains(currency)
.parents('tr')
.find('td')
.eq(tokenAmountColumn)
.contains(alttext);
cy.contains(currency).parents('tr').find('td').eq(tokenAmountColumn).contains(alttext)
}

export function verifyTokenBalanceFormat(currency, formatString, tokenAmountColumn, fiatAmountColumn, fiatRegex) {
Expand All @@ -96,10 +86,12 @@ export function clickOnCurrencyDropdown() {

export function selectCurrency(currency) {
cy.get(currencyDropdownList).findByText(currency).click({ force: true })
cy.get(currencyDropdownList).findByText(currency).click({ force: true }).then(() => {
cy.get(currencyDropdownListSelected)
.should('contain', currency);
});
cy.get(currencyDropdownList)
.findByText(currency)
.click({ force: true })
.then(() => {
cy.get(currencyDropdownListSelected).should('contain', currency)
})
}

export function hideAsset(asset) {
Expand All @@ -109,60 +101,57 @@ export function hideAsset(asset) {
}

export function openHideTokenMenu() {
cy.get(hiddeTokensBtn).click();
cy.get(hiddeTokensBtn).click()
}

export function clickOnTokenCheckbox(token) {
cy.contains(token)
.parents('tr')
.find(hiddenTokenCheckbox)
.click();
cy.contains(token).parents('tr').find(hiddenTokenCheckbox).click()
}

export function saveHiddenTokenSelection() {
cy.contains(hiddenTokenSaveBtn).click();
cy.contains(hiddenTokenSaveBtn).click()
}

export function verifyTokenIsVisible(token) {
cy.contains(token);
cy.contains(token)
}

export function verifyMenuButtonLabelIsDefault() {
cy.contains(hideTokenDefaultString);
cy.contains(hideTokenDefaultString)
}

export function verifyInitialTableState() {
cy.contains(rowsPerPageString).next().contains(pageRowsDefault);
cy.contains(pageCountString1to25);
cy.get(balanceSingleRow).should('have.length', 25);
cy.contains(rowsPerPageString).next().contains(pageRowsDefault)
cy.contains(pageCountString1to25)
cy.get(balanceSingleRow).should('have.length', 25)
}

export function changeTo10RowsPerPage() {
cy.contains(rowsPerPageString).next().contains(pageRowsDefault).click({ force: true });
cy.get(paginationPageList).contains(rowsPerPage10).click();
cy.contains(rowsPerPageString).next().contains(pageRowsDefault).click({ force: true })
cy.get(paginationPageList).contains(rowsPerPage10).click()
}

export function verifyTableHas10Rows() {
cy.contains(rowsPerPageString).next().contains(rowsPerPage10);
cy.contains(pageCountString1to10);
cy.get(balanceSingleRow).should('have.length', 10);
cy.contains(rowsPerPageString).next().contains(rowsPerPage10)
cy.contains(pageCountString1to10)
cy.get(balanceSingleRow).should('have.length', 10)
}

export function navigateToNextPage() {
cy.get(nextPageBtn).click({ force: true });
cy.get(nextPageBtn).click({ force: true });
cy.get(nextPageBtn).click({ force: true })
cy.get(nextPageBtn).click({ force: true })
}

export function verifyTableHasNRows(assetsLength) {
cy.contains(tablePageRage21to28);
cy.get(balanceSingleRow).should('have.length', assetsLength);
cy.contains(tablePageRage21to28)
cy.get(balanceSingleRow).should('have.length', assetsLength)
}

export function navigateToPreviousPage() {
cy.get(previousPageBtn).click({ force: true });
cy.get(previousPageBtn).click({ force: true })
}

export function verifyTableHas10RowsAgain() {
cy.contains(pageCountString10to20);
cy.get(balanceSingleRow).should('have.length', 10);
cy.contains(pageCountString10to20)
cy.get(balanceSingleRow).should('have.length', 10)
}

0 comments on commit c5543a3

Please sign in to comment.