Skip to content

Commit

Permalink
FIX CYPRESS TESTS (#710)
Browse files Browse the repository at this point in the history
* fix cypress SwapMod output test

* update gitignore w/cypress env

* use GNO for native swap

* comment
  • Loading branch information
W3stside authored Jun 20, 2022
1 parent 952780e commit a072462
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

# testing
/coverage
cypress.env.json

# builds
/build
Expand Down
27 changes: 19 additions & 8 deletions cypress-custom/integration/swapMod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,36 @@ describe('Swap (mod)', () => {
})

it('can enter an amount into output', () => {
cy.get('#swap-currency-output .token-amount-input')
// first clear/reset the INPUT currency input field
// as it is auto prefilled with "1"
cy.get('#swap-currency-input .token-amount-input')
.clear()
// then we select and clear the OUTPUT field
.get('#swap-currency-output .token-amount-input')
.clear()
// and type in an amount
.type('0.001', { delay: 400, force: true })
.should('have.value', '0.001')
})

it('zero output amount', () => {
cy.get('#swap-currency-output .token-amount-input')
// When `.clear() doesn't work, brute force it with the input below.
// From https://stackoverflow.com/a/65918033/1272513
.type('{selectall}{backspace}{selectall}{backspace}')
// first clear/reset the INPUT currency input field
// as it is auto prefilled with "1"
cy.get('#swap-currency-input .token-amount-input')
.clear()
// then we select and clear the OUTPUT field
.get('#swap-currency-output .token-amount-input')
.clear()
// and type in an amount
.type('0.0')
.should('have.value', '0.0')
})

it('can swap Native for DAI', () => {
it('can find GNO and swap Native for GNO', () => {
cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').should('be.visible')
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click({ force: true })
cy.get('#token-search-input').type('GNO')
cy.get('.token-item-0xd0Dab4E640D95E9E8A47545598c33e31bDb53C7c').should('be.visible')
cy.get('.token-item-0xd0Dab4E640D95E9E8A47545598c33e31bDb53C7c').click({ force: true })
cy.get('#swap-currency-input .token-amount-input').should('be.visible')
cy.get('#swap-currency-input .token-amount-input').type('{selectall}{backspace}{selectall}{backspace}').type('0.5')
cy.get('#swap-currency-output .token-amount-input').should('not.equal', '')
Expand Down

0 comments on commit a072462

Please sign in to comment.