Skip to content

Commit

Permalink
Merge branch 'feat/router-sdk-use-info-endpoint' of https://github.co…
Browse files Browse the repository at this point in the history
…m/soroswap/frontend into feat/router-sdk-use-info-endpoint
  • Loading branch information
abstract829 committed Jun 14, 2024
2 parents c211056 + 7f5c2e2 commit f9832dc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/connectWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe('Connect Wallet', () => {
}
//write logs to a file on cypress/logs/logs.txt
cy.writeFile('cypress/logs/logs.txt', logs.join('\n'));
cy.screenshot();
});
// cy.contains('Public Key: publicKey')
});
Expand Down
62 changes: 57 additions & 5 deletions cypress/e2e/flows.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// cypress/integration/navigation.ts

import { is } from "cypress/types/bluebird"


//Bridge flow
describe('Bridge flow', () => {
Expand All @@ -17,7 +19,59 @@ describe('Bridge flow', () => {

// Swap flow
describe('Select tokens & input ammount', () => {
it('should select token in, select token out and type an input ammount', () => {
it('should navigate to swap', () => {
cy.visit('/swap')
cy.contains('You sell')
})
it('should select token in', () => {
cy.visit('/swap')
cy.get('[data-testid="swap__input__panel"]').within(()=>{
cy.get('[data-testid="swap__token__select"]').click()
})
cy.get('[data-testid="token-search-input"]').type('usdc')
cy.get('[data-testid="currency__list__USDC"]').click()
})
it('should select token out', () => {
cy.visit('/swap')
cy.get('[data-testid="swap__output__panel"]').within(()=>{
cy.get('[data-testid="swap__token__select"]').click()
})
cy.get('[data-testid="token-search-input"]').type('xlm')
cy.get('[data-testid="currency__list__XLM"]').click()

})
it('should type an input ammount & expect for a token out', () => {
cy.visit('/swap')
//Select input asset
cy.get('[data-testid="swap__input__panel"]').within(()=>{
cy.get('[data-testid="swap__token__select"]').click()
})
cy.get('[data-testid="token-search-input"]').type('usdc')
cy.get('[data-testid="currency__list__USDC"]').click()

//Select output asset
cy.get('[data-testid="swap__output__panel"]').within(()=>{
cy.get('[data-testid="swap__token__select"]').click()
})
cy.get('[data-testid="currency__list__XLM"]').click()

//Input amount
cy.get('[data-testid="swap__input__panel"]').within(()=>{
cy.get('.token-amount-input').type('32456')
})
//await for calcs
cy.wait(5000)

//Get the output ammount
cy.get('[data-testid="swap__output__panel"]').within(()=>{
cy.get('.token-amount-input').invoke('val').as('outputAmount')
})
cy.get('@outputAmount').should('not.be.empty')
cy.get('@outputAmount').should('have.length.greaterThan', 7)


})
it('should display more details of the swap in dropdown', () => {
cy.visit('/swap')
//Select input asset
cy.get('[data-testid="swap__input__panel"]').within(()=>{
Expand All @@ -38,7 +92,7 @@ describe('Select tokens & input ammount', () => {
})

//await for calcs
cy.wait(1500)
cy.wait(2500)

//Get the output ammount
cy.get('[data-testid="swap__output__panel"]').within(()=>{
Expand All @@ -47,6 +101,7 @@ describe('Select tokens & input ammount', () => {
cy.get('@outputAmount').should('not.be.empty')
cy.get('@outputAmount').should('have.length.greaterThan', 7)

//Show more details
cy.get('[data-testid="swap-details-header-row"]').click()

cy.contains('Price Impact')
Expand All @@ -65,8 +120,6 @@ describe('Select tokens & input ammount', () => {
cy.get('@expectedOutput').contains('XLM')
cy.get('@path').contains('XLM')
cy.get('@path').contains('USDC')

cy.screenshot()
})
})

Expand Down Expand Up @@ -107,6 +160,5 @@ describe('Navigation flow', () => {
cy.get('a[href*="https://info.soroswap.finance"]').click()
cy.wait(1500)
cy.url().should('match', /https:\/\/info\.soroswap\.finance\//)
cy.screenshot()
})
})

0 comments on commit f9832dc

Please sign in to comment.