Skip to content

Commit

Permalink
Update failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ltthienn committed Nov 15, 2023
1 parent bc99eb6 commit 84040be
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 180 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/pages/swap-page.po.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ export class TokenCatalog {
getNoResultsFound(text: myCallbackType<string>) {
cy.getContent(TokenCatalogLocators.lblNotFound, text)
}

closePopup() {
cy.get(TokenCatalogLocators.iconClosePopup).click()
}
}
4 changes: 2 additions & 2 deletions cypress/e2e/selectors/constants.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export enum TAG {
}

export const TOKEN_SYMBOLS = {
Ethereum: ['BAND', 'ETH', 'USDT', 'USDC', '1INCH'],
Ethereum: ['BAND', 'wstETH', 'USDT', 'USDC', '1INCH'],
Arbitrum: ['ANGLE', 'ARB', 'USDT', 'USDC.e', 'BOB'],
Optimism: ['BOND', 'ETH', 'USDT', 'USDC', 'BOB'],
Optimism: ['BOND', 'wstETH', 'USDT', 'USDC', 'BOB'],
Avalanche: ['AAVE.e', 'sAVAX', 'USDT.e', 'USDC.e', 'BUSD.e'],
BNB: ['RICE', 'BUSD', 'USDT', 'USDC', 'BOB'],
}
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/selectors/selectors.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const TokenCatalogLocators = {
iconFavorite: '[data-testid=button-favorite-token]',
iconRemoveImportedToken: '[data-testid=button-remove-import-token]',
iconRemoveFavoriteToken: '[data-testid=close-btn]',
iconClosePopup: '[data-testid=close-icon]',
btnImport: '[data-testid=button-import-token]',
btnUnderstand: '[data-testid=button-confirm-import-token]',
btnClearAll: '[data-testid=button-clear-all-import-token]',
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/specs/intercept.e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ const tokenCatalog = new TokenCatalog()
const farm = new FarmPage()

describe('Intercept', { tags: TAG.regression }, () => {
beforeEach(() => {
before(() => {
SwapPage.open(DEFAULT_URL)
})

afterEach(() => {
cy.reload()
})
describe('Swap', () => {
it('Should get route successfully', () => {
cy.intercept('GET', '**/routes?**').as('get-route')
Expand Down
50 changes: 22 additions & 28 deletions cypress/e2e/specs/limit-order.e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,32 @@ const tokenCatalog = new TokenCatalog();
const netw = new Network()

describe(`Limit Order on ${NETWORK}`, { tags: TAG.regression }, () => {
beforeEach(() => {
before(() => {
SwapPage.open(DEFAULT_URL)
SwapPage.connectWallet()
SwapPage.getStatusConnectedWallet()
})

describe('Add/remove/select token with favorite tokens list', () => {
beforeEach(() => {
if (NETWORK === 'BNB' || NETWORK === 'Ethereum') {
netw.selectNetwork(NETWORK)
cy.allowMetamaskToSwitchNetwork().then(approved => {
expect(approved).to.be.true
})
} else {
cy.changeMetamaskNetwork(NETWORK)
}
SwapPage.goToLimitOrder()
LimitOder.checkGetStartedDisplay().then((checked) => {
if (checked === true) {
LimitOder.clickGetStarted()
}
if (NETWORK === 'BNB' || NETWORK === 'Ethereum') {
netw.selectNetwork(NETWORK)
cy.allowMetamaskToSwitchNetwork().then(approved => {
expect(approved).to.be.true
})
} else {
cy.changeMetamaskNetwork(NETWORK)
}
SwapPage.goToLimitOrder()
LimitOder.checkGetStartedDisplay().then((checked) => {
if (checked === true) {
LimitOder.clickGetStarted()
}
})
})

afterEach(() => {
cy.reload(false)
SwapPage.getStatusConnectedWallet()
})

describe('Add/remove/select token', () => {
it('Should be added, selected and removed favorite token sell', () => {
LimitOder.selectTokenSell().addFavoriteToken([tokenSymbols[0], tokenSymbols[4]])
tokenCatalog.getFavoriteTokens((list) => {
Expand All @@ -48,16 +51,7 @@ describe(`Limit Order on ${NETWORK}`, { tags: TAG.regression }, () => {
expect(list).not.to.include.members([tokenSymbols[0]])
})
})
})
describe('Add/remove/select token with favorite tokens list', () => {
beforeEach(() => {
SwapPage.goToLimitOrder()
LimitOder.checkGetStartedDisplay().then((checked) => {
if (checked === true) {
LimitOder.clickGetStarted()
}
})
})

it('Should be added, selected and removed favorite token buy', () => {
LimitOder.selectTokenBuy().addFavoriteToken([tokenSymbols[0], tokenSymbols[4]])
tokenCatalog.getFavoriteTokens((list) => {
Expand Down
Loading

0 comments on commit 84040be

Please sign in to comment.