-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e:test: Add Zap In simulation (#2375)
- Loading branch information
Showing
29 changed files
with
1,559 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
CrossChainLocators, | ||
HeaderLocators, | ||
LimitOrderLocators, | ||
NetworkLocators, | ||
SwapPageLocators, | ||
TokenCatalogLocators, | ||
WalletLocators, | ||
} from '../selectors/selectors.cy' | ||
|
||
export interface myCallbackType<T> { | ||
(myArgument: T): void | ||
} | ||
export const Header = { | ||
connectWallet() { | ||
cy.get(WalletLocators.btnConnectWallet).should('be.visible').click() | ||
cy.connectWallet() | ||
}, | ||
|
||
getStatusConnectedWallet() { | ||
cy.get(WalletLocators.statusConnected, { timeout: 10000 }).should('be.visible') | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { PoolLocators } from '../selectors/selectors.cy' | ||
|
||
export enum CustomRange { | ||
FullRange = 'Full Range', | ||
Safe = 'Safe', | ||
Common = 'Common', | ||
Expert = 'Expert', | ||
} | ||
export type FarmingRange = { | ||
minPrice: string | ||
maxPrice: string | ||
} | ||
export const PoolsPage = { | ||
open(chain: string) { | ||
cy.visit('/pools/' + chain) | ||
}, | ||
searchByPoolAddress(poolAddress: string) { | ||
cy.get(PoolLocators.txtSearchPool).clear().type(poolAddress) | ||
cy.wait(2000) | ||
}, | ||
selectCustomRange(range: CustomRange) { | ||
cy.get('button').contains(range).click() | ||
}, | ||
selectFarmingRange(farmingRange: FarmingRange) { | ||
cy.get('[role=button]').contains('Farming Ranges').click() | ||
cy.get(PoolLocators.txtPriceValue).eq(0).clear().type(farmingRange.minPrice) | ||
cy.get(PoolLocators.txtPriceValue).eq(1).clear().type(farmingRange.maxPrice) | ||
}, | ||
getCurrentPrice() { | ||
return cy | ||
.get(PoolLocators.lblCurrentPrice) | ||
.invoke('text') | ||
.then(currenPriceValue => { | ||
return currenPriceValue | ||
}) | ||
}, | ||
addLiquidity(poolAddress: string, amountIn: string, customRange?: CustomRange, farmingRange?: FarmingRange) { | ||
PoolsPage.searchByPoolAddress(poolAddress) | ||
cy.get('button').contains('Add Liquidity').click() | ||
cy.get(PoolLocators.btnZapIn).click() | ||
if (typeof customRange != 'undefined') { | ||
PoolsPage.selectCustomRange(customRange) | ||
} | ||
if (typeof farmingRange != 'undefined') { | ||
PoolsPage.selectFarmingRange(farmingRange) | ||
} | ||
cy.get(PoolLocators.txtAmountIn).type(amountIn) | ||
cy.wait(20000) | ||
cy.go('back') | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,137 @@ | ||
import { CrossChainLocators, HeaderLocators, LimitOrderLocators, NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy" | ||
import { | ||
CrossChainLocators, | ||
HeaderLocators, | ||
LimitOrderLocators, | ||
NetworkLocators, | ||
SwapPageLocators, | ||
TokenCatalogLocators, | ||
WalletLocators, | ||
} from '../selectors/selectors.cy' | ||
|
||
export const NETWORK = Cypress.env('NETWORK') | ||
|
||
export interface myCallbackType<T> { | ||
(myArgument: T): void | ||
(myArgument: T): void | ||
} | ||
|
||
export const SwapPage = { | ||
open(url: string) { | ||
cy.visit('/' + url) | ||
cy.url().should('include', url) | ||
cy.closeTutorialPopup() | ||
}, | ||
|
||
selectTokenIn(): TokenCatalog { | ||
cy.selectToken(SwapPageLocators.dropdownTokenIn) | ||
return new TokenCatalog() | ||
}, | ||
selectTokenOut(): TokenCatalog { | ||
cy.selectToken(SwapPageLocators.dropdownTokenOut) | ||
return new TokenCatalog() | ||
}, | ||
|
||
getCurrentTokenIn(text: myCallbackType<string>) { | ||
cy.getContent(SwapPageLocators.dropdownTokenIn, text) | ||
}, | ||
|
||
getCurrentTokenOut(text: myCallbackType<string>) { | ||
cy.getContent(SwapPageLocators.dropdownTokenOut, text) | ||
}, | ||
|
||
connectWallet() { | ||
cy.get(WalletLocators.btnConnectWallet).should('be.visible').click() | ||
cy.connectWallet() | ||
}, | ||
|
||
getStatusConnectedWallet() { | ||
cy.get(WalletLocators.statusConnected, { timeout: 10000 }).should('be.visible') | ||
}, | ||
|
||
goToLimitOrder() { | ||
cy.get(LimitOrderLocators.btnLimit).click() | ||
}, | ||
|
||
goToCrossChain() { | ||
cy.get(CrossChainLocators.btnCrossChain).click() | ||
}, | ||
|
||
goToFarmPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblFarms).click({ force: true }) | ||
}, | ||
|
||
goToPoolPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblPools).click({ force: true }) | ||
}, | ||
|
||
goToMyPoolsPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblMyPools).click({ force: true }) | ||
}, | ||
open(url: string) { | ||
cy.visit('/' + url) | ||
cy.url().should('include', url) | ||
cy.closeTutorialPopup() | ||
}, | ||
|
||
selectTokenIn(): TokenCatalog { | ||
cy.selectToken(SwapPageLocators.dropdownTokenIn) | ||
return new TokenCatalog() | ||
}, | ||
selectTokenOut(): TokenCatalog { | ||
cy.selectToken(SwapPageLocators.dropdownTokenOut) | ||
return new TokenCatalog() | ||
}, | ||
|
||
getCurrentTokenIn(text: myCallbackType<string>) { | ||
cy.getContent(SwapPageLocators.dropdownTokenIn, text) | ||
}, | ||
|
||
getCurrentTokenOut(text: myCallbackType<string>) { | ||
cy.getContent(SwapPageLocators.dropdownTokenOut, text) | ||
}, | ||
|
||
connectWallet() { | ||
cy.get(WalletLocators.btnConnectWallet).should('be.visible').click() | ||
cy.connectWallet() | ||
}, | ||
|
||
getStatusConnectedWallet() { | ||
cy.get(WalletLocators.statusConnected, { timeout: 10000 }).should('be.visible') | ||
}, | ||
|
||
goToLimitOrder() { | ||
cy.get(LimitOrderLocators.btnLimit).click() | ||
}, | ||
|
||
goToCrossChain() { | ||
cy.get(CrossChainLocators.btnCrossChain).click() | ||
}, | ||
|
||
goToFarmPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblFarms).click({ force: true }) | ||
}, | ||
|
||
goToPoolPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblPools).click({ force: true }) | ||
}, | ||
|
||
goToMyPoolsPage() { | ||
cy.get(HeaderLocators.dropdownEarn).click({ force: true }) | ||
cy.get(HeaderLocators.lblMyPools).click({ force: true }) | ||
}, | ||
} | ||
|
||
export class Network { | ||
selectNetwork(network: string) { | ||
cy.get(NetworkLocators.btnSelectNetwork, { timeout: 30000 }).should('be.visible').click() | ||
cy.get(NetworkLocators.btnNetwork).contains(network).click({ force: true }) | ||
} | ||
selectNetwork(network: string) { | ||
cy.get(NetworkLocators.btnSelectNetwork, { timeout: 30000 }).should('be.visible').click() | ||
cy.get(NetworkLocators.btnNetwork).contains(network).click({ force: true }) | ||
} | ||
} | ||
|
||
export class TokenCatalog { | ||
searchToken(value: string) { | ||
cy.searchToken(value) | ||
} | ||
|
||
selectImportTab() { | ||
cy.selectImportTab() | ||
} | ||
|
||
selectFavoriteToken(tokenSymbol: string) { | ||
cy.selectFavoriteToken(tokenSymbol) | ||
} | ||
|
||
selectTokenBySymbol(tokenSymbol: string) { | ||
this.searchToken(tokenSymbol) | ||
cy.selectTokenBySymbol(tokenSymbol) | ||
} | ||
|
||
addFavoriteToken(tokenSymbol: Array<string>) { | ||
tokenSymbol.forEach(element => { | ||
this.searchToken(element) | ||
cy.wait(2000) | ||
cy.addFavoriteToken() | ||
}); | ||
} | ||
|
||
removeFavoriteToken(tokenSymbol: string) { | ||
cy.removeFavoriteToken(tokenSymbol) | ||
} | ||
|
||
importNewTokens(address: Array<string>) { | ||
address.forEach(element => { | ||
SwapPage.selectTokenIn() | ||
cy.importNewToken(element) | ||
}) | ||
} | ||
|
||
deleteImportedToken(value: string) { | ||
cy.deleteImportedToken(value) | ||
} | ||
|
||
clearAllImportedTokens() { | ||
cy.clearAllImportedTokens() | ||
} | ||
|
||
getFavoriteTokens(list: myCallbackType<string[]>) { | ||
cy.getList(TokenCatalogLocators.lblFavoriteToken, list) | ||
} | ||
|
||
getWhitelistTokens(list: myCallbackType<string[]>) { | ||
cy.getList(TokenCatalogLocators.lblTokenSymbol, list) | ||
} | ||
|
||
getNoResultsFound(text: myCallbackType<string>) { | ||
cy.getContent(TokenCatalogLocators.lblNotFound, text) | ||
} | ||
} | ||
searchToken(value: string) { | ||
cy.searchToken(value) | ||
} | ||
|
||
selectImportTab() { | ||
cy.selectImportTab() | ||
} | ||
|
||
selectFavoriteToken(tokenSymbol: string) { | ||
cy.selectFavoriteToken(tokenSymbol) | ||
} | ||
|
||
selectTokenBySymbol(tokenSymbol: string) { | ||
this.searchToken(tokenSymbol) | ||
cy.selectTokenBySymbol(tokenSymbol) | ||
} | ||
|
||
addFavoriteToken(tokenSymbol: Array<string>) { | ||
tokenSymbol.forEach(element => { | ||
this.searchToken(element) | ||
cy.wait(2000) | ||
cy.addFavoriteToken() | ||
}) | ||
} | ||
|
||
removeFavoriteToken(tokenSymbol: string) { | ||
cy.removeFavoriteToken(tokenSymbol) | ||
} | ||
|
||
importNewTokens(address: Array<string>) { | ||
address.forEach(element => { | ||
SwapPage.selectTokenIn() | ||
cy.importNewToken(element) | ||
}) | ||
} | ||
|
||
deleteImportedToken(value: string) { | ||
cy.deleteImportedToken(value) | ||
} | ||
|
||
clearAllImportedTokens() { | ||
cy.clearAllImportedTokens() | ||
} | ||
|
||
getFavoriteTokens(list: myCallbackType<string[]>) { | ||
cy.getList(TokenCatalogLocators.lblFavoriteToken, list) | ||
} | ||
|
||
getWhitelistTokens(list: myCallbackType<string[]>) { | ||
cy.getList(TokenCatalogLocators.lblTokenSymbol, list) | ||
} | ||
|
||
getNoResultsFound(text: myCallbackType<string>) { | ||
cy.getContent(TokenCatalogLocators.lblNotFound, text) | ||
} | ||
} |
Oops, something went wrong.