-
Notifications
You must be signed in to change notification settings - Fork 54
e2e - Add search token by name and select input #1918
Conversation
Add search token by name and select input to swap.test
change cy.visit('https://cowswap.exchange') to cy.visit('/swap')
|
// search by name and select input | ||
cy.get('#swap-currency-output .open-currency-select-button').click() | ||
cy.get('#token-search-input').click().type('DAI') | ||
cy.get('.sc-pg5r79-2.cUmBvs > div > div').contains('DAI').click({ force: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it'll work because the class name you are depending on will probably change at every build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One Ideas was to add an ID to the currency list as done in #1922. This way it should not change. Would this solve your concerns or are there additional things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! That was made exactly for this, I believe :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to create a command like that we could use like cy.selectInputBySymbol('DAI')
and would automate the search of DAI and select the first result
We have a similar non-working command here
function selectInput(tokenAddress) { |
I am not sure If I get it. I should make it into a cy command? |
I mean https://docs.cypress.io/api/cypress-api/custom-commands I was pointing you to a super similar command in my comment |
closing |
Summary
Add search token by name and select input to e2e swap.tests. Related to #1870
Allows to search tokens by names. In this case it selects DAI as a buy token.
To Test
Not included
Make token name input parameterized.By doing this we could insert any token name from a specific token list and more token pairs can be tested.