Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E #2371

Closed
wants to merge 7 commits into from
Closed

E2E #2371

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'E2E Smoke'
name: 'Cypress Test'

# concurrency:
# group: pr-workflow-${{ github.ref }}
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
run: |+
#!/bin/bash
yarn preview &
yarn test:e2e -c baseUrl='http://127.0.0.1:4173/' -e grepTags=smoke,NETWORK=Ethereum
yarn test-e2e -c baseUrl='http://127.0.0.1:4173/' -e grepTags=smoke,NETWORK=Ethereum
env:
DISPLAY: :0.0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'E2E Regression'
name: 'E2E Testing Schedule'

on:
schedule:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Run Cypress Test
run: |+
#!/bin/bash
yarn test:e2e -c baseUrl='https://kyberswap.com/' -e grepTags=regression,NETWORK=${{ matrix.network }}
yarn test-schedule -c baseUrl='https://kyberswap.com/' -e grepTags=regression,NETWORK=${{ matrix.network }}
env:
DISPLAY: :0.0

Expand Down
12 changes: 0 additions & 12 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,17 @@ export default defineConfig({
},
userAgent: 'synpress',
chromeWebSecurity: true,
// video: false,
// videoCompression: false,
viewportWidth: 1920,
viewportHeight: 1080,
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
},
e2e: {
testIsolation: false,
setupNodeEvents(on, config) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@cypress/grep/src/plugin')(config)
synpressPlugins(on, config)
const options = {
printLogsToFile: 'always',
outputRoot: config.projectRoot + '/target/',
specRoot: 'cypress/e2e/specs',
outputTarget: {
'cypress-logs|json': 'json',
},
}
require('cypress-terminal-report/src/installLogsPrinter')(on, options)
on('after:run', async results => {
if (results) {
const register = new client.Registry()
Expand Down
23 changes: 0 additions & 23 deletions cypress/e2e/pages/header.po.cy.ts

This file was deleted.

51 changes: 0 additions & 51 deletions cypress/e2e/pages/pools-page.po.cy.ts

This file was deleted.

242 changes: 116 additions & 126 deletions cypress/e2e/pages/swap-page.po.cy.ts
Original file line number Diff line number Diff line change
@@ -1,137 +1,127 @@
import {
CrossChainLocators,
HeaderLocators,
LimitOrderLocators,
NetworkLocators,
SwapPageLocators,
TokenCatalogLocators,
WalletLocators,
} from '../selectors/selectors.cy'

export const NETWORK = Cypress.env('NETWORK')
import { CrossChainLocators, HeaderLocators, LimitOrderLocators, NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy"

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)
}
}
Loading
Loading