Skip to content

Commit

Permalink
Merge branch 'support-video-ann' into test-stg
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 30, 2023
2 parents 69fd284 + 5ac4447 commit 3410e5c
Show file tree
Hide file tree
Showing 147 changed files with 8,737 additions and 1,444 deletions.
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ VITE_TRANSAK_URL=https://staging-global.transak.com
VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488

VITE_KS_SETTING_API=https://ks-setting.dev.kyberengineering.io/api
VITE_BLACKJACK_API=https://blackjack.dev.kyberengineering.io/api

VITE_GTM_ID=

Expand Down
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ VITE_TRANSAK_URL=https://global.transak.com
VITE_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d

VITE_KS_SETTING_API=https://ks-setting.kyberswap.com/api
VITE_BLACKJACK_API=https://blackjack.kyberswap.com/api

VITE_GTM_ID=GTM-TRQCJ8F

Expand Down
1 change: 1 addition & 0 deletions .env.stg
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ VITE_TRANSAK_URL=https://staging-global.transak.com
VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488

VITE_KS_SETTING_API=https://ks-setting.stg.kyberengineering.io/api
VITE_BLACKJACK_API=https://blackjack.stg.kyberengineering.io/api

VITE_GTM_ID=

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand Down Expand Up @@ -147,10 +147,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand All @@ -84,9 +84,9 @@ jobs:

- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Yarn Build
env:
Expand Down Expand Up @@ -118,14 +118,14 @@ jobs:
yarn preview &
yarn test-e2e -c baseUrl='http://127.0.0.1:4173/' -e grepTags=smoke,NETWORK=Ethereum
env:
DISPLAY: :0.0
DISPLAY: :0.0

- name: Archive e2e artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
if: always()
with:
name: e2e-artifacts
path: |
cypress/videos
cypress/screenshots
name: e2e-artifacts
path: |
cypress/videos
cypress/screenshots
continue-on-error: true
18 changes: 9 additions & 9 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand All @@ -97,11 +97,11 @@ jobs:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ env.SERVICE }}-buildx

# - name: Restore node_modules
# uses: actions/cache@v2
# with:
# path: '**/node_modules'
# key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Restore node_modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependences
uses: bahmutov/npm-install@HEAD
Expand Down Expand Up @@ -144,10 +144,10 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

# - name: Restore node_modules
# uses: actions/cache@v2
# with:
# path: '**/node_modules'
# key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Restore node_modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependences
uses: bahmutov/npm-install@HEAD
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
fail-fast: false
matrix:
network: ['Ethereum', 'Arbitrum', 'Optimism', 'Avalanche', 'BNB']
network: ['Ethereum', 'Arbitrum', 'Optimism', 'Avalanche', 'BNB Chain']
steps:
- name: Trigger Code Checkout
uses: actions/checkout@v3

- name: Set up Node.js 18.15.0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
node-version: 20.9.0
registry-url: 'https://npm.pkg.github.com'
scope: '@kybernetwork'

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.15.0
v20.9.0
50 changes: 50 additions & 0 deletions cypress/e2e/pages/cross-chain.po.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { NETWORK_LIST } from "../selectors/constants.cy"
import { CrossChainLocators, NetworkLocators } from "../selectors/selectors.cy"

export const CrossChain = {

closeUnderstandPopup() {
cy.get(CrossChainLocators.btnUnderstand).click()
},

selectNetworkIn(networkName: string) {
cy.get(CrossChainLocators.btnNetworkIn).click()
cy.get(NetworkLocators.btnNetwork).contains(networkName).click({ force: true })

},

selectNetworkOut(networkName: string) {
cy.get(CrossChainLocators.btnNetworkOut).click()
cy.get(NetworkLocators.btnNetwork).contains(networkName).click({ force: true })
},

changeNetwork(oldNetwork: string[]) {
let random = 0
do {
random = Math.floor(Math.random() * NETWORK_LIST.length)
} while (oldNetwork.includes(NETWORK_LIST[random]) === true)

return NETWORK_LIST[random]
},

checkLoadedPage() {
return cy.get(CrossChainLocators.rechartsSurface, { timeout: 20000 }).should(() => { }).then($obj => {
if ($obj.length > 0) {
return true
}
return false
})
},

getCurrentNetworkIn() {
return cy.get(CrossChainLocators.btnNetworkIn).invoke('text').then(network => {
return network
})
},

getCurrentNetworkOut() {
return cy.get(CrossChainLocators.btnNetworkOut).invoke('text').then(network => {
return network
})
},
}
13 changes: 13 additions & 0 deletions cypress/e2e/pages/limit-order.po.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ export interface myCallbackType<T> {
}
export const LimitOder = {

checkGetStartedDisplay() {
return cy.get(LimitOrderLocators.btnGetStarted, { timeout: 10000 }).should(() => { }).then($obj => {
if ($obj.length > 0) {
return true
}
return false
})
},

clickGetStarted() {
cy.get(LimitOrderLocators.btnGetStarted, { timeout: 10000 }).click({ force: true })
},

selectTokenSell(): TokenCatalog {
cy.selectToken(LimitOrderLocators.dropdownTokenSell)
return new TokenCatalog()
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/pages/swap-page.po.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HeaderLocators, LimitOrderLocators, NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy"
import { CrossChainLocators, HeaderLocators, LimitOrderLocators, NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy"

export interface myCallbackType<T> {
(myArgument: T): void
Expand Down Expand Up @@ -41,6 +41,10 @@ export const SwapPage = {
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 })
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/selectors/constants.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const TOKEN_SYMBOLS = {
'BNB': ['RICE', 'DAI', 'USDT', 'USDC', 'MAI']
}

export const NETWORK_LIST = ['Ethereum', 'Arbitrum', 'Optimism', 'Avalanche', 'BNB Chain', 'Polygon PoS', 'Fantom', 'Linea', 'Base']

export const UNWHITELIST_TOKENS = {
"Ethereum":
[
Expand Down
13 changes: 11 additions & 2 deletions cypress/e2e/selectors/selectors.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ export const LimitOrderLocators = {
btnLimit: '[data-testid=limit-button]',
txtSellingRate: '[data-testid=input-selling-rate]',
lblBalanceIn: '[data-testid=limit-order-input-tokena] [data-testid=balance]',
lblErrorMessage: '[data-testid=error-message]'
lblErrorMessage: '[data-testid=error-message]',
btnGetStarted: '[data-testid=get-started-button]'
}

export const CrossChainLocators = {
btnCrossChain: '[data-testid=cross-chain-tab]',
btnNetworkIn: '[data-testid=swap-currency-input] [data-testid=network-button]',
btnNetworkOut: '[data-testid=swap-currency-output] [data-testid=network-button]',
btnUnderstand: '[data-testid=understand-button]',
rechartsSurface: '.recharts-surface' //it's in the library so don't use data-testid
}

export const WalletLocators = {
Expand All @@ -40,7 +49,7 @@ export const WalletLocators = {

export const NetworkLocators = {
btnSelectNetwork: '[data-testid=select-network]',
btnNetwork: '[data-testid=network-button]',
btnNetwork: '[data-testid=network-list]',
}

export const HeaderLocators = {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/specs/connect-wallet.e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ describe('Metamask Extension tests', { tags: TAG.regression }, () => {
SwapPage.connectWallet()
})

it.skip('Redirects to swap page when a user has already connected a wallet', () => {
it('Redirects to swap page when a user has already connected a wallet', () => {
cy.acceptMetamaskAccess()
SwapPage.getStatusConnectedWallet()
cy.url().should('include', '/swap')
})

it.skip('Should approve permission to switch network', () => {
it('Should approve permission to switch network', () => {
if (NETWORK !== DEFAULT_NETWORK) {
SwapPage.getStatusConnectedWallet()
wallet.selectNetwork(NETWORK)
Expand Down
37 changes: 37 additions & 0 deletions cypress/e2e/specs/cross-chain.e2e.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { CrossChain } from "../pages/cross-chain.po.cy"
import { SwapPage } from "../pages/swap-page.po.cy"
import { DEFAULT_URL, NETWORK, TAG } from "../selectors/constants.cy"


describe(`Cross-chain on ${NETWORK}`, { tags: TAG.regression }, () => {
beforeEach(() => {
SwapPage.open(DEFAULT_URL)
SwapPage.goToCrossChain()
CrossChain.checkLoadedPage().then((checked) => {
if (checked === true) {
CrossChain.closeUnderstandPopup()
}
})
})

describe('Select network', () => {
it('The network should be changed successfully', () => {
const networkIn = CrossChain.changeNetwork([NETWORK])
CrossChain.selectNetworkIn(networkIn)
CrossChain.getCurrentNetworkIn().then((currentNetworkIn) => {
expect(currentNetworkIn).to.equal(networkIn)
})

CrossChain.getCurrentNetworkOut().then((currentNetworkOut) => {
const networkOut = CrossChain.changeNetwork([networkIn, currentNetworkOut])
cy.wait(1000)
CrossChain.selectNetworkOut(networkOut)
CrossChain.getCurrentNetworkOut().then((currentNetworkOut) => {
expect(currentNetworkOut).to.equal(networkOut)
})

})
})

})
})
7 changes: 5 additions & 2 deletions cypress/e2e/specs/limit-order.e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import { DEFAULT_URL, NETWORK, NORESULTS_TEXT, NOTOKENS_TEXT, TAG, TOKEN_SYMBOLS

const tokenSymbols = TOKEN_SYMBOLS[NETWORK]


const tokenCatalog = new TokenCatalog();


describe(`Limit Order on ${NETWORK}`, { tags: TAG.regression }, () => {
beforeEach(() => {
SwapPage.open(DEFAULT_URL)
SwapPage.goToLimitOrder()
LimitOder.checkGetStartedDisplay().then((checked) => {
if (checked === true) {
LimitOder.clickGetStarted()
}
})
})

describe('Add/remove/select token with favorite tokens list', () => {
Expand Down
3 changes: 2 additions & 1 deletion cypress/support/connectWalletCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare global {
}

Cypress.Commands.add('connectWallet', () => {
cy.get(WalletLocators.chkAcceptTerm).click()
// feature changed => temporary comment
// cy.get(WalletLocators.chkAcceptTerm).click()
cy.get(WalletLocators.btnMetaMask).click()
})
Loading

0 comments on commit 3410e5c

Please sign in to comment.