chore(trading): delete trading-e2e cypress tests (#5901)
This commit is contained in:
parent
89e2033556
commit
00dbb7dd60
36
.github/workflows/cypress-live-test.yml
vendored
36
.github/workflows/cypress-live-test.yml
vendored
@ -1,36 +0,0 @@
|
|||||||
name: Cypress Console tests -- live environment
|
|
||||||
|
|
||||||
# This workflow runs using provided url
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
url:
|
|
||||||
description: 'Url'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cypress-run:
|
|
||||||
name: Run Cypress Trading tests -- live environment
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Use Node.js 20
|
|
||||||
id: Node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
|
|
||||||
- name: Run Cypress tests
|
|
||||||
uses: cypress-io/github-action@v4
|
|
||||||
with:
|
|
||||||
browser: chrome
|
|
||||||
record: true
|
|
||||||
project: ./apps/trading-e2e
|
|
||||||
config: baseUrl=${{ github.event.inputs.url }}
|
|
||||||
env: grepTags=@live
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
1
.github/workflows/cypress-manual-trigger.yml
vendored
1
.github/workflows/cypress-manual-trigger.yml
vendored
@ -12,7 +12,6 @@ on:
|
|||||||
options:
|
options:
|
||||||
- explorer-e2e
|
- explorer-e2e
|
||||||
- governance-e2e
|
- governance-e2e
|
||||||
- trading-e2e
|
|
||||||
tags:
|
tags:
|
||||||
description: 'Test tags to run'
|
description: 'Test tags to run'
|
||||||
required: true
|
required: true
|
||||||
|
2
.github/workflows/cypress-nightly.yml
vendored
2
.github/workflows/cypress-nightly.yml
vendored
@ -10,5 +10,5 @@ jobs:
|
|||||||
uses: ./.github/workflows/cypress-run.yml
|
uses: ./.github/workflows/cypress-run.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
projects: '["explorer-e2e","governance-e2e","trading-e2e"]'
|
projects: '["explorer-e2e","governance-e2e"]'
|
||||||
tags: '@smoke @regression @slow'
|
tags: '@smoke @regression @slow'
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
|
||||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
|
||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
|
||||||
NX_VEGA_CONFIG_URL=''
|
|
||||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
|
||||||
NX_VEGA_ENV=CUSTOM
|
|
||||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
|
||||||
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
|
|
||||||
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"}
|
|
||||||
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
|
|
||||||
NX_VEGA_URL=http://localhost:3008/graphql
|
|
||||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
|
||||||
NX_ETH_LOCAL_PROVIDER_URL=http://localhost:8545/
|
|
||||||
NX_ETH_WALLET_MNEMONIC="ozone access unlock valid olympic save include omit supply green clown session"
|
|
||||||
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
|
||||||
NX_SENTRY_DSN=https://dummy@o999999.ingest.sentry.io/9999999
|
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
|
||||||
|
|
||||||
|
|
||||||
# Expose some env vars to cypress environment for market setup
|
|
||||||
CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
|
||||||
CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F
|
|
||||||
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
|
||||||
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
|
|
||||||
CYPRESS_CONSOLE_URL=https://console.fairground.wtf
|
|
||||||
CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint
|
|
||||||
CYPRESS_ORACLE_PUBKEY=6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61
|
|
||||||
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65
|
|
||||||
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535
|
|
||||||
CYPRESS_VEGA_ENV=CUSTOM
|
|
||||||
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
|
|
||||||
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
|
|
||||||
CYPRESS_VEGA_TOKEN_URL=https://governance.fairground.wtf
|
|
||||||
CYPRESS_VEGA_URL=http://localhost:3008/graphql
|
|
||||||
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
|
|
||||||
CYPRESS_VEGA_WALLET_API_TOKEN=
|
|
||||||
|
|
||||||
# Cosmic elevator flags (MUST be doubled with CYPRESS_ prefix)
|
|
||||||
NX_SUCCESSOR_MARKETS=true
|
|
||||||
CYPRESS_NX_SUCCESSOR_MARKETS=true
|
|
@ -1,33 +0,0 @@
|
|||||||
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
|
||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
|
||||||
NX_VEGA_CONFIG_URL=''
|
|
||||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
|
||||||
NX_VEGA_ENV=CUSTOM
|
|
||||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
|
||||||
NX_VEGA_CONSOLE_URL=https://console.fairground.wtf
|
|
||||||
NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\"}
|
|
||||||
NX_VEGA_TOKEN_URL=https://governance.fairground.wtf
|
|
||||||
NX_VEGA_URL=http://localhost:3008/graphql
|
|
||||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
|
||||||
NX_ETH_LOCAL_PROVIDER_URL=http://localhost:8545/
|
|
||||||
NX_ETH_WALLET_MNEMONIC="ozone access unlock valid olympic save include omit supply green clown session"
|
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
|
||||||
|
|
||||||
|
|
||||||
# Expose some env vars to cypress environment for market setup
|
|
||||||
CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
|
||||||
CYPRESS_ETHEREUM_WALLET_ADDRESS=0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F
|
|
||||||
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
|
||||||
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
|
|
||||||
CYPRESS_CONSOLE_URL=https://console.fairground.wtf
|
|
||||||
CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint
|
|
||||||
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65
|
|
||||||
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535
|
|
||||||
CYPRESS_VEGA_ENV=CUSTOM
|
|
||||||
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
|
|
||||||
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
|
|
||||||
CYPRESS_VEGA_TOKEN_URL=https://governance.fairground.wtf
|
|
||||||
CYPRESS_VEGA_URL=http://localhost:3008/graphql
|
|
||||||
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
|
|
||||||
CYPRESS_VEGA_WALLET_API_TOKEN=
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
|
|
||||||
"ignorePatterns": ["!**/*"],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
||||||
"rules": {
|
|
||||||
"cypress/unsafe-to-chain-command": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": ["src/plugins/index.js"],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/no-var-requires": "off",
|
|
||||||
"no-undef": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
const { defineConfig } = require('cypress');
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
|
||||||
reporter: '../../node_modules/cypress-mochawesome-reporter',
|
|
||||||
e2e: {
|
|
||||||
setupNodeEvents(on, config) {
|
|
||||||
require('cypress-mochawesome-reporter/plugin')(on);
|
|
||||||
require('@cypress/grep/src/plugin')(config);
|
|
||||||
return config;
|
|
||||||
},
|
|
||||||
baseUrl: 'http://localhost:4200',
|
|
||||||
fileServerFolder: '.',
|
|
||||||
fixturesFolder: false,
|
|
||||||
specPattern: '**/*.cy.{js,jsx,ts,tsx}',
|
|
||||||
supportFile: './src/support/index.js',
|
|
||||||
video: false,
|
|
||||||
videosFolder: '../../dist/cypress/apps/trading-e2e/videos',
|
|
||||||
videoUploadOnPasses: false,
|
|
||||||
screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots',
|
|
||||||
chromeWebSecurity: false,
|
|
||||||
projectId: 'et4snf',
|
|
||||||
defaultCommandTimeout: 10000,
|
|
||||||
viewportWidth: 1800,
|
|
||||||
viewportHeight: 900,
|
|
||||||
responseTimeout: 50000,
|
|
||||||
requestTimeout: 20000,
|
|
||||||
retries: 1,
|
|
||||||
testIsolation: false,
|
|
||||||
experimentalMemoryManagement: true,
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
ETHERSCAN_URL: 'https://sepolia.etherscan.io',
|
|
||||||
ETHEREUM_CHAIN_ID: 11155111,
|
|
||||||
TRADING_MODE_LINK:
|
|
||||||
'https://docs.vega.xyz/testnet/concepts/trading-on-vega/trading-modes#auction-type-liquidity-monitoring',
|
|
||||||
grepTags: '@regression @smoke @slow',
|
|
||||||
grepFilterSpecs: true,
|
|
||||||
grepOmitFiltered: true,
|
|
||||||
txTimeout: { timeout: 70000 },
|
|
||||||
},
|
|
||||||
});
|
|
1
apps/trading-e2e/declaration.d.ts
vendored
1
apps/trading-e2e/declaration.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare module '*.scss';
|
|
@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "trading-e2e",
|
|
||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
||||||
"sourceRoot": "apps/trading-e2e/src",
|
|
||||||
"projectType": "application",
|
|
||||||
"targets": {
|
|
||||||
"e2e": {
|
|
||||||
"executor": "@nx/cypress:cypress",
|
|
||||||
"options": {
|
|
||||||
"cypressConfig": "apps/trading-e2e/cypress.config.js",
|
|
||||||
"devServerTarget": "trading:serve"
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"devServerTarget": "trading:serve:production"
|
|
||||||
},
|
|
||||||
"live": {
|
|
||||||
"devServerTarget": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"executor": "@nx/eslint:lint",
|
|
||||||
"outputs": ["{options.outputFile}"],
|
|
||||||
"options": {
|
|
||||||
"lintFilePatterns": ["apps/trading-e2e/**/*.{js,ts}"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"executor": "nx:run-commands",
|
|
||||||
"outputs": [],
|
|
||||||
"options": {
|
|
||||||
"command": "yarn tsc --project ./apps/trading-e2e/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tags": [],
|
|
||||||
"implicitDependencies": ["trading"]
|
|
||||||
}
|
|
20
apps/trading-e2e/src/index.d.ts
vendored
20
apps/trading-e2e/src/index.d.ts
vendored
@ -1,20 +0,0 @@
|
|||||||
/// <reference types="cypress" />
|
|
||||||
|
|
||||||
declare namespace Cypress {
|
|
||||||
// specify additional properties in the TestConfig object
|
|
||||||
// in our case we will add "tags" property
|
|
||||||
interface SuiteConfigOverrides {
|
|
||||||
/**
|
|
||||||
* List of tags for this test
|
|
||||||
* @example a single tag
|
|
||||||
* it('logs in', { tags: '@smoke' }, () => { ... })
|
|
||||||
* @example multiple tags
|
|
||||||
* it('works', { tags: ['@smoke', '@slow'] }, () => { ... })
|
|
||||||
*/
|
|
||||||
tags?: string | string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Cypress {
|
|
||||||
grep?: (grep?: string, tags?: string, burn?: string) => void;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,337 +0,0 @@
|
|||||||
import { connectEthereumWallet } from '../support/ethereum-wallet';
|
|
||||||
import { selectAsset } from '../support/helpers';
|
|
||||||
|
|
||||||
const amountField = 'input[name="amount"]';
|
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
|
||||||
const sepoliaUrl = Cypress.env('ETHERSCAN_URL');
|
|
||||||
const btcName = 0;
|
|
||||||
const vegaName = 4;
|
|
||||||
const btcSymbol = 'tBTC';
|
|
||||||
const vegaSymbol = 'VEGA';
|
|
||||||
const toastContent = 'toast-content';
|
|
||||||
const depositsTab = 'Deposits';
|
|
||||||
const toastCloseBtn = 'toast-close';
|
|
||||||
const completeWithdrawalBtn = 'complete-withdrawal';
|
|
||||||
const depositSubmit = 'deposit-submit';
|
|
||||||
const approveSubmit = 'approve-submit';
|
|
||||||
const dialogContent = 'dialog-content';
|
|
||||||
|
|
||||||
// Because the tests are run on a live network to optimize time, the tests are interdependent and must be run in the given order.
|
|
||||||
describe('capsule - without MultiSign', { tags: '@slow' }, () => {
|
|
||||||
before(() => {
|
|
||||||
cy.createMarket();
|
|
||||||
cy.get('@markets').then((markets) => {
|
|
||||||
cy.wrap(markets[0]).as('market');
|
|
||||||
});
|
|
||||||
cy.setOnBoardingViewed();
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can deposit', function () {
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
cy.get('[data-testid="pathname-/portfolio"]').should('exist');
|
|
||||||
|
|
||||||
// 1001-DEPO-001
|
|
||||||
// 1001-DEPO-002
|
|
||||||
// 1001-DEPO-003
|
|
||||||
// 1001-DEPO-005
|
|
||||||
// 1001-DEPO-006
|
|
||||||
// 1001-DEPO-007
|
|
||||||
// 1001-DEPO-008
|
|
||||||
// 1001-DEPO-009
|
|
||||||
// 1001-DEPO-010
|
|
||||||
|
|
||||||
cy.getByTestId(depositsTab).click();
|
|
||||||
cy.getByTestId('deposit-button').click();
|
|
||||||
connectEthereumWallet('Unknown');
|
|
||||||
selectAsset(btcName);
|
|
||||||
cy.get('[data-testid="rich-select-option"]').eq(btcName).click();
|
|
||||||
|
|
||||||
cy.getByTestId('approve-default').should(
|
|
||||||
'contain.text',
|
|
||||||
`Before you can make a deposit of your chosen asset, ${btcSymbol}, you need to approve its use in your Ethereum wallet`
|
|
||||||
);
|
|
||||||
cy.getByTestId(approveSubmit).click();
|
|
||||||
cy.getByTestId('approve-pending').should('exist');
|
|
||||||
cy.getByTestId('approve-confirmed').should('exist');
|
|
||||||
cy.get(amountField).focus();
|
|
||||||
cy.get(amountField).clear().type('10');
|
|
||||||
cy.getByTestId(depositSubmit).click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
`Transaction confirmedYour transaction has been confirmed.View on EtherscanDeposit 10.00 ${btcSymbol}`,
|
|
||||||
{ matchCase: false }
|
|
||||||
);
|
|
||||||
cy.getByTestId(toastCloseBtn).click();
|
|
||||||
cy.getByTestId('Collateral').click();
|
|
||||||
|
|
||||||
cy.highlight('deposit verification');
|
|
||||||
|
|
||||||
cy.get('[col-id="asset.symbol"]', txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
btcSymbol
|
|
||||||
);
|
|
||||||
cy.getByTestId(depositsTab).click();
|
|
||||||
cy.get('.ag-cell-value', txTimeout).should('contain.text', btcSymbol);
|
|
||||||
cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout);
|
|
||||||
|
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.should('have.length.above', 2)
|
|
||||||
.eq(1)
|
|
||||||
.parent()
|
|
||||||
.within(() => {
|
|
||||||
cy.get('[col-id="asset.symbol"]').should('have.text', btcSymbol);
|
|
||||||
cy.get('[col-id="amount"]').should('have.text', '10.00');
|
|
||||||
cy.get('[col-id="createdTimestamp"]').should('not.be.empty');
|
|
||||||
cy.get('[col-id="status"]').should('have.text', 'Finalized');
|
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', `${sepoliaUrl}/tx/0x`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can not withdrawal because of no MultiSign', function () {
|
|
||||||
// 1002-WITH-022
|
|
||||||
// 1002-WITH-023
|
|
||||||
// 0003-WTXN-011
|
|
||||||
cy.getByTestId('Withdrawals').click();
|
|
||||||
cy.getByTestId('withdraw-dialog-button').click();
|
|
||||||
selectAsset(btcName);
|
|
||||||
cy.get('[data-testid="rich-select-option"]').eq(btcName).click();
|
|
||||||
cy.get(amountField).focus();
|
|
||||||
cy.get(amountField).clear().type('1');
|
|
||||||
cy.getByTestId('submit-withdrawal').click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'Funds unlocked'
|
|
||||||
);
|
|
||||||
// cy.getByTestId(toastCloseBtn).click();
|
|
||||||
cy.highlight('withdrawals verification');
|
|
||||||
cy.getByTestId('toast-complete-withdrawal').last().click();
|
|
||||||
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'Error occurredcannot estimate gas'
|
|
||||||
);
|
|
||||||
cy.getByTestId(completeWithdrawalBtn).should(
|
|
||||||
'contain.text',
|
|
||||||
'Complete withdrawal'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('capsule', { tags: '@slow', testIsolation: true }, () => {
|
|
||||||
before(() => {
|
|
||||||
cy.updateCapsuleMultiSig();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.createMarket();
|
|
||||||
cy.get('@markets').then((markets) => {
|
|
||||||
cy.wrap(markets[0]).as('market');
|
|
||||||
});
|
|
||||||
cy.setOnBoardingViewed();
|
|
||||||
cy.setVegaWallet();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can withdrawal', function () {
|
|
||||||
// 1002-WITH-0014
|
|
||||||
// 1002-WITH-006
|
|
||||||
// 1002-WITH-009
|
|
||||||
// 1002-WITH-011
|
|
||||||
// 1002-WITH-024
|
|
||||||
// 1002-WITH-012
|
|
||||||
// 1002-WITH-013
|
|
||||||
// 1002-WITH-014
|
|
||||||
// 1002-WITH-015
|
|
||||||
// 1002-WITH-016
|
|
||||||
// 1002-WITH-017
|
|
||||||
// 1002-WITH-019
|
|
||||||
// 1002-WITH-020
|
|
||||||
// 1002-WITH-021
|
|
||||||
const ethWalletAddress = Cypress.env('ETHEREUM_WALLET_ADDRESS');
|
|
||||||
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
cy.get('[data-testid="pathname-/portfolio"]').should('exist');
|
|
||||||
cy.getByTestId(toastCloseBtn, txTimeout).click();
|
|
||||||
cy.getByTestId('Withdrawals').click();
|
|
||||||
cy.getByTestId('withdraw-dialog-button').click();
|
|
||||||
connectEthereumWallet('Unknown');
|
|
||||||
selectAsset(btcName);
|
|
||||||
cy.get('[data-testid="rich-select-option"]').eq(btcName).click();
|
|
||||||
cy.get(amountField).clear().type('1');
|
|
||||||
cy.getByTestId('submit-withdrawal').click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'Funds unlocked'
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.highlight('withdrawals verification');
|
|
||||||
cy.getByTestId('toast-complete-withdrawal').click();
|
|
||||||
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'Transaction confirmed'
|
|
||||||
);
|
|
||||||
cy.getByTestId(toastContent, txTimeout)
|
|
||||||
.should('contain.text', 'Funds unlocked')
|
|
||||||
.and('contain.text', 'Your funds have been unlocked for withdrawal.')
|
|
||||||
.and(
|
|
||||||
'contain.text',
|
|
||||||
'View in block explorerYou can save your withdrawal details for extra security.'
|
|
||||||
)
|
|
||||||
.and('contain.text', 'Withdraw 1.00 tBTCComplete withdrawal');
|
|
||||||
cy.getByTestId('toast-withdrawal-details').click();
|
|
||||||
cy.getByTestId(dialogContent)
|
|
||||||
.last()
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId('dialog-title').should(
|
|
||||||
'contain.text',
|
|
||||||
'Save withdrawal details'
|
|
||||||
);
|
|
||||||
cy.getByTestId('copy-button').should('be.visible');
|
|
||||||
cy.getByTestId('assetSource_value').should(
|
|
||||||
'have.text',
|
|
||||||
'0xb63D135B0a6854EEb765d69ca36210cC70BECAE0'
|
|
||||||
);
|
|
||||||
cy.getByTestId('amount_value').should('have.text', '100000');
|
|
||||||
cy.getByTestId('nonce_value').invoke('text').should('not.be.empty');
|
|
||||||
cy.getByTestId('signatures_value')
|
|
||||||
.invoke('text')
|
|
||||||
.should('not.be.empty');
|
|
||||||
cy.getByTestId('targetAddress_value').should(
|
|
||||||
'have.text',
|
|
||||||
ethWalletAddress
|
|
||||||
);
|
|
||||||
cy.getByTestId('creation_value').invoke('text').should('not.be.empty');
|
|
||||||
});
|
|
||||||
cy.getByTestId('close-withdrawal-approval-dialog').click();
|
|
||||||
|
|
||||||
cy.get('.ag-center-cols-container')
|
|
||||||
.find('[col-id="status"]')
|
|
||||||
.eq(0, txTimeout)
|
|
||||||
.should('contain.text', 'Completed');
|
|
||||||
|
|
||||||
cy.get('[col-id="txHash"]', txTimeout)
|
|
||||||
.should('have.length.above', 1)
|
|
||||||
.eq(1)
|
|
||||||
.parent()
|
|
||||||
.within(() => {
|
|
||||||
cy.get('[col-id="asset.symbol"]').should('have.text', btcSymbol);
|
|
||||||
cy.get('[col-id="amount"]').should('have.text', '1.00');
|
|
||||||
cy.get('[col-id="details.receiverAddress"]')
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', `${sepoliaUrl}/address/`);
|
|
||||||
cy.get('[col-id="createdTimestamp"]').should('not.be.empty');
|
|
||||||
cy.get('[col-id="withdrawnTimestamp"]').should('not.be.empty');
|
|
||||||
cy.get('[col-id="status"]').should('have.text', 'Completed');
|
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', `${sepoliaUrl}/tx/0x`);
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.getByTestId('withdraw-dialog-button').click({ force: true });
|
|
||||||
// cy.getByTestId('BALANCE_AVAILABLE_value').should('have.text', '6.999');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('approved amount is less than deposit', function () {
|
|
||||||
// 1001-DEPO-006
|
|
||||||
// 1001-DEPO-007
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
cy.get('[data-testid="pathname-/portfolio"]').should('exist');
|
|
||||||
cy.getByTestId(toastCloseBtn, txTimeout).click();
|
|
||||||
cy.getByTestId(depositsTab).click();
|
|
||||||
cy.getByTestId('deposit-button').click();
|
|
||||||
connectEthereumWallet('Unknown');
|
|
||||||
selectAsset(btcName);
|
|
||||||
cy.get('[data-testid="rich-select-option"]').eq(btcName).click();
|
|
||||||
cy.contains('Deposits of tBTC not approved').should('not.exist');
|
|
||||||
cy.contains('Use maximum').should('be.visible');
|
|
||||||
cy.get(amountField).clear().type('20000000');
|
|
||||||
cy.getByTestId(depositSubmit).should('be.visible');
|
|
||||||
cy.getByTestId(depositSubmit).click();
|
|
||||||
cy.getByTestId('input-error-text').should(
|
|
||||||
'contain.text',
|
|
||||||
`You can't deposit more than you have in your Ethereum wallet`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('withdraw - delay verification', function () {
|
|
||||||
// 1001-DEPO-024
|
|
||||||
// 1002-WITH-007
|
|
||||||
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
cy.get('[data-testid="pathname-/portfolio"]', txTimeout).should('exist');
|
|
||||||
cy.getByTestId(toastCloseBtn, txTimeout).click();
|
|
||||||
cy.getByTestId(depositsTab).click();
|
|
||||||
cy.getByTestId('deposit-button').click();
|
|
||||||
connectEthereumWallet('Unknown');
|
|
||||||
selectAsset(vegaName);
|
|
||||||
cy.getByTestId('approve-submit').click();
|
|
||||||
cy.getByTestId('approve-confirmed').should(
|
|
||||||
'contain.text',
|
|
||||||
'You approved deposits of up to VEGA'
|
|
||||||
);
|
|
||||||
cy.get(amountField).clear().type('10000');
|
|
||||||
cy.getByTestId('deposit-submit').click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
`Your transaction has been confirmed.`,
|
|
||||||
{ matchCase: false }
|
|
||||||
);
|
|
||||||
cy.getByTestId(toastCloseBtn).click({ multiple: true });
|
|
||||||
cy.getByTestId('Collateral').click();
|
|
||||||
|
|
||||||
cy.highlight('deposit verification');
|
|
||||||
|
|
||||||
cy.get('[col-id="asset.symbol"]', txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
vegaSymbol
|
|
||||||
);
|
|
||||||
cy.getByTestId(depositsTab).click();
|
|
||||||
cy.get('.ag-cell-value', txTimeout).should('contain.text', vegaSymbol);
|
|
||||||
cy.get('[col-id="status"]').should('not.have.text', 'Open', txTimeout);
|
|
||||||
|
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.should('have.length.above', 2)
|
|
||||||
.eq(1)
|
|
||||||
.parent()
|
|
||||||
.within(() => {
|
|
||||||
cy.get('[col-id="asset.symbol"]').should('have.text', vegaSymbol);
|
|
||||||
cy.get('[col-id="amount"]').should('have.text', '10,000.00');
|
|
||||||
cy.get('[col-id="createdTimestamp"]').should('not.be.empty');
|
|
||||||
cy.get('[col-id="status"]').should('have.text', 'Finalized');
|
|
||||||
cy.get('[col-id="txHash"]')
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', `${sepoliaUrl}/tx/0x`);
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.getByTestId('Withdrawals').click(txTimeout);
|
|
||||||
cy.getByTestId('withdraw-dialog-button').click();
|
|
||||||
selectAsset(1);
|
|
||||||
cy.get(amountField).clear().type('10000');
|
|
||||||
cy.getByTestId('DELAY_TIME_value').should('have.text', '5 days');
|
|
||||||
cy.getByTestId('submit-withdrawal').click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'Your funds have been unlocked'
|
|
||||||
);
|
|
||||||
cy.getByTestId(toastCloseBtn).click();
|
|
||||||
cy.getByTestId(completeWithdrawalBtn).first().should('be.visible').click();
|
|
||||||
cy.getByTestId(toastContent, txTimeout).should('contain.text', 'Delayed');
|
|
||||||
cy.getByTestId('tab-withdrawals').within(() => {
|
|
||||||
cy.get('.ag-center-cols-container')
|
|
||||||
.children()
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get('[col-id="status"]').contains(
|
|
||||||
/Delayed \(ready in (\d{1,2}:\d{2}:\d{2}:\d{2})\)/
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,43 +0,0 @@
|
|||||||
import { connectEthereumWallet } from '../support/ethereum-wallet';
|
|
||||||
|
|
||||||
const connectEthWalletBtn = 'connect-eth-wallet-btn';
|
|
||||||
|
|
||||||
describe('ethereum wallet', { tags: '@smoke', testIsolation: true }, () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.mockWeb3Provider();
|
|
||||||
// Using portfolio withdrawals tab is it requires Ethereum wallet connection
|
|
||||||
cy.mockTradingPage();
|
|
||||||
cy.mockSubscription();
|
|
||||||
cy.setVegaWallet();
|
|
||||||
cy.visit('/#/portfolio');
|
|
||||||
cy.get('[data-testid="pathname-/portfolio"]').should('exist');
|
|
||||||
cy.getByTestId('Withdrawals').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can connect', () => {
|
|
||||||
// 0004-EWAL-001
|
|
||||||
|
|
||||||
cy.getByTestId('Deposits').click();
|
|
||||||
cy.getByTestId('deposit-button').click();
|
|
||||||
cy.getByTestId('connect-eth-wallet-btn').click();
|
|
||||||
cy.getByTestId('web3-connector-list').should('exist');
|
|
||||||
cy.getByTestId('web3-connector-MetaMask').click();
|
|
||||||
cy.getByTestId('web3-connector-list').should('not.exist');
|
|
||||||
cy.getByTestId('tab-deposits').should('not.be.empty');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('able to disconnect eth wallet', () => {
|
|
||||||
// 0004-EWAL-004
|
|
||||||
// 0004-EWAL-005
|
|
||||||
// 0004-EWAL-006
|
|
||||||
|
|
||||||
cy.getByTestId('Deposits').click();
|
|
||||||
cy.getByTestId('deposit-button').click();
|
|
||||||
connectEthereumWallet('MetaMask');
|
|
||||||
cy.getByTestId('ethereum-address').should('have.text', '0xEe7D…d94F');
|
|
||||||
cy.getByTestId('disconnect-ethereum-wallet')
|
|
||||||
.should('have.text', 'Disconnect')
|
|
||||||
.click();
|
|
||||||
cy.getByTestId(connectEthWalletBtn).should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,29 +0,0 @@
|
|||||||
import { OrderType } from '@vegaprotocol/types';
|
|
||||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
|
||||||
|
|
||||||
const orderSizeField = 'order-size';
|
|
||||||
const orderPriceField = 'order-price';
|
|
||||||
const orderTIFDropDown = 'order-tif';
|
|
||||||
const placeOrderBtn = 'place-order';
|
|
||||||
|
|
||||||
export const createOrder = (order: OrderSubmission): void => {
|
|
||||||
cy.log('Placing order', order);
|
|
||||||
const { type, side, size, price, timeInForce, expiresAt } = order;
|
|
||||||
|
|
||||||
cy.getByTestId(
|
|
||||||
`order-type-${type === OrderType.TYPE_LIMIT ? 'Limit' : 'Market'}`
|
|
||||||
).click();
|
|
||||||
cy.getByTestId(`order-side-${side}`).click();
|
|
||||||
cy.getByTestId(orderSizeField).clear().type(size);
|
|
||||||
if (price) {
|
|
||||||
cy.getByTestId(orderPriceField).clear().type(price);
|
|
||||||
}
|
|
||||||
cy.getByTestId(orderTIFDropDown).select(timeInForce);
|
|
||||||
if (timeInForce === 'TIME_IN_FORCE_GTT') {
|
|
||||||
if (!expiresAt) {
|
|
||||||
throw new Error('Specify expiresAt if using GTT');
|
|
||||||
}
|
|
||||||
cy.getByTestId('date-picker-field').type(expiresAt);
|
|
||||||
}
|
|
||||||
cy.getByTestId(placeOrderBtn).click();
|
|
||||||
};
|
|
@ -1,18 +0,0 @@
|
|||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
export const orderSizeField = 'order-size';
|
|
||||||
export const orderPriceField = 'order-price';
|
|
||||||
export const orderTIFDropDown = 'order-tif';
|
|
||||||
export const placeOrderBtn = 'place-order';
|
|
||||||
export const toggleShort = 'order-side-SIDE_SELL';
|
|
||||||
export const toggleLong = 'order-side-SIDE_BUY';
|
|
||||||
export const toggleLimit = 'order-type-Limit';
|
|
||||||
export const toggleMarket = 'order-type-Market';
|
|
||||||
|
|
||||||
export const TIFlist = Object.values(Schema.OrderTimeInForce).map((value) => {
|
|
||||||
return {
|
|
||||||
code: Schema.OrderTimeInForceCode[value],
|
|
||||||
value,
|
|
||||||
text: Schema.OrderTimeInForceMapping[value],
|
|
||||||
};
|
|
||||||
});
|
|
@ -1,5 +0,0 @@
|
|||||||
export const connectEthereumWallet = (connectorName: string) => {
|
|
||||||
cy.getByTestId('connect-eth-wallet-btn').should('be.enabled').click();
|
|
||||||
cy.getByTestId('web3-connector-list').should('be.visible');
|
|
||||||
cy.getByTestId(`web3-connector-${connectorName}`).click();
|
|
||||||
};
|
|
@ -1,11 +0,0 @@
|
|||||||
export const selectAsset = (assetIndex: number) => {
|
|
||||||
cy.log(`selecting asset: ${assetIndex}`);
|
|
||||||
cy.getByTestId('select-asset').click();
|
|
||||||
cy.get('[data-testid="rich-select-option"]').eq(assetIndex).click();
|
|
||||||
|
|
||||||
// The asset only gets set once the queries (getWithdrawThreshold, getDelay)
|
|
||||||
// against the Ethereum change resolve, we should fix this but for now just force
|
|
||||||
// some wait time
|
|
||||||
// eslint-disable-next-line
|
|
||||||
cy.wait(100);
|
|
||||||
};
|
|
@ -1,8 +0,0 @@
|
|||||||
import '@vegaprotocol/cypress';
|
|
||||||
import 'cypress-real-events/support';
|
|
||||||
import registerCypressGrep from '@cypress/grep';
|
|
||||||
import { addMockTradingPage } from './trading';
|
|
||||||
import 'cypress-mochawesome-reporter/register';
|
|
||||||
|
|
||||||
registerCypressGrep();
|
|
||||||
addMockTradingPage();
|
|
@ -1,36 +0,0 @@
|
|||||||
import type {
|
|
||||||
OrdersUpdateSubscription,
|
|
||||||
OrdersUpdateSubscriptionVariables,
|
|
||||||
OrderUpdateFieldsFragment,
|
|
||||||
} from '@vegaprotocol/orders';
|
|
||||||
import type { onMessage } from '@vegaprotocol/cypress';
|
|
||||||
import type { PartialDeep } from 'type-fest';
|
|
||||||
import { orderUpdateSubscription } from '@vegaprotocol/mock';
|
|
||||||
|
|
||||||
const sendOrderUpdate: ((data: OrdersUpdateSubscription) => void)[] = [];
|
|
||||||
const getOnOrderUpdate = () => {
|
|
||||||
const onOrderUpdate: onMessage<
|
|
||||||
OrdersUpdateSubscription,
|
|
||||||
OrdersUpdateSubscriptionVariables
|
|
||||||
> = (send) => {
|
|
||||||
sendOrderUpdate.push(send);
|
|
||||||
};
|
|
||||||
return onOrderUpdate;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getSubscriptionMocks = () => ({
|
|
||||||
OrdersUpdate: getOnOrderUpdate(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export function updateOrder(
|
|
||||||
override?: PartialDeep<OrderUpdateFieldsFragment>
|
|
||||||
): void {
|
|
||||||
const update: OrdersUpdateSubscription = orderUpdateSubscription({
|
|
||||||
// @ts-ignore partial deep check failing
|
|
||||||
orders: [override],
|
|
||||||
});
|
|
||||||
if (!sendOrderUpdate) {
|
|
||||||
throw new Error('OrderSub not called');
|
|
||||||
}
|
|
||||||
sendOrderUpdate.forEach((send) => send(update));
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
import type {
|
|
||||||
OrderAmendment,
|
|
||||||
OrderAmendmentBody,
|
|
||||||
OrderCancellation,
|
|
||||||
OrderCancellationBody,
|
|
||||||
OrderSubmission,
|
|
||||||
OrderSubmissionBody,
|
|
||||||
Transaction,
|
|
||||||
} from '@vegaprotocol/wallet';
|
|
||||||
|
|
||||||
export const testOrderSubmission = (
|
|
||||||
order: OrderSubmission,
|
|
||||||
expected?: Partial<OrderSubmission>
|
|
||||||
) => {
|
|
||||||
const expectedOrder = {
|
|
||||||
...order,
|
|
||||||
...expected,
|
|
||||||
};
|
|
||||||
|
|
||||||
const transaction: OrderSubmissionBody = {
|
|
||||||
orderSubmission: expectedOrder,
|
|
||||||
};
|
|
||||||
vegaWalletTransaction(transaction);
|
|
||||||
verifyToast();
|
|
||||||
};
|
|
||||||
|
|
||||||
export const testOrderAmendment = (
|
|
||||||
order: OrderAmendment,
|
|
||||||
expected?: Partial<OrderAmendment>
|
|
||||||
) => {
|
|
||||||
const expectedOrder = {
|
|
||||||
...order,
|
|
||||||
...expected,
|
|
||||||
};
|
|
||||||
|
|
||||||
const transaction: OrderAmendmentBody = {
|
|
||||||
orderAmendment: expectedOrder,
|
|
||||||
};
|
|
||||||
vegaWalletTransaction(transaction);
|
|
||||||
verifyToast();
|
|
||||||
};
|
|
||||||
|
|
||||||
export const testOrderCancellation = (
|
|
||||||
order: OrderCancellation,
|
|
||||||
expected?: Partial<OrderCancellation>
|
|
||||||
) => {
|
|
||||||
const expectedOrder = {
|
|
||||||
...order,
|
|
||||||
...expected,
|
|
||||||
};
|
|
||||||
|
|
||||||
const transaction: OrderCancellationBody = {
|
|
||||||
orderCancellation: expectedOrder,
|
|
||||||
};
|
|
||||||
vegaWalletTransaction(transaction);
|
|
||||||
verifyToast();
|
|
||||||
};
|
|
||||||
|
|
||||||
const vegaWalletTransaction = (transaction: Transaction) => {
|
|
||||||
cy.wait('@VegaWalletTransaction')
|
|
||||||
.its('request')
|
|
||||||
.then((req) => {
|
|
||||||
expect(req.body.params).to.deep.equal({
|
|
||||||
publicKey: Cypress.env('VEGA_PUBLIC_KEY'),
|
|
||||||
sendingMode: 'TYPE_SYNC',
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
expect(req.headers.authorization).to.equal(
|
|
||||||
`VWT ${Cypress.env('VEGA_WALLET_API_TOKEN')}`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const verifyToast = () => {
|
|
||||||
cy.getByTestId('toast').should('contain.text', 'Awaiting confirmation');
|
|
||||||
cy.getByTestId('toast')
|
|
||||||
.find('a')
|
|
||||||
.invoke('attr', 'href')
|
|
||||||
.should('include', `${Cypress.env('EXPLORER_URL')}/txs/test-tx-hash`);
|
|
||||||
cy.getByTestId('toast-close').click();
|
|
||||||
};
|
|
@ -1,252 +0,0 @@
|
|||||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
|
||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
import type { CyHttpMessages } from 'cypress/types/net-stubbing';
|
|
||||||
import type { Provider, Status } from '@vegaprotocol/markets';
|
|
||||||
import {
|
|
||||||
accountsQuery,
|
|
||||||
assetQuery,
|
|
||||||
assetsQuery,
|
|
||||||
candlesQuery,
|
|
||||||
chartQuery,
|
|
||||||
depositsQuery,
|
|
||||||
estimateFeesQuery,
|
|
||||||
marginsQuery,
|
|
||||||
marketCandlesQuery,
|
|
||||||
marketDataQuery,
|
|
||||||
marketDepthQuery,
|
|
||||||
marketInfoQuery,
|
|
||||||
marketsCandlesQuery,
|
|
||||||
marketsDataQuery,
|
|
||||||
marketsQuery,
|
|
||||||
networkParamsQuery,
|
|
||||||
nodeGuardQuery,
|
|
||||||
ordersQuery,
|
|
||||||
estimatePositionQuery,
|
|
||||||
positionsQuery,
|
|
||||||
proposalListQuery,
|
|
||||||
tradesQuery,
|
|
||||||
withdrawalsQuery,
|
|
||||||
protocolUpgradeProposalsQuery,
|
|
||||||
blockStatisticsQuery,
|
|
||||||
networkParamQuery,
|
|
||||||
liquidityProvisionsQuery,
|
|
||||||
successorMarketQuery,
|
|
||||||
parentMarketIdQuery,
|
|
||||||
successorMarketIdsQuery,
|
|
||||||
successorMarketProposalDetailsQuery,
|
|
||||||
liquidityProvidersQuery,
|
|
||||||
} from '@vegaprotocol/mock';
|
|
||||||
import type { PartialDeep } from 'type-fest';
|
|
||||||
import type { MarketDataQuery, MarketsQuery } from '@vegaprotocol/markets';
|
|
||||||
|
|
||||||
type MarketPageMockData = {
|
|
||||||
state: Schema.MarketState;
|
|
||||||
tradingMode?: Schema.MarketTradingMode;
|
|
||||||
trigger?: Schema.AuctionTrigger;
|
|
||||||
};
|
|
||||||
|
|
||||||
const ORACLE_PUBKEY = Cypress.env('ORACLE_PUBKEY');
|
|
||||||
|
|
||||||
const marketDataOverride = (
|
|
||||||
data: MarketPageMockData
|
|
||||||
): PartialDeep<MarketDataQuery> => ({
|
|
||||||
marketsConnection: {
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
data: {
|
|
||||||
// @ts-ignore conflict between incoming and outgoing types
|
|
||||||
trigger: data.trigger,
|
|
||||||
// @ts-ignore same as above
|
|
||||||
marketTradingMode: data.tradingMode,
|
|
||||||
marketState: data.state,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const marketsDataOverride = (
|
|
||||||
data: MarketPageMockData
|
|
||||||
): PartialDeep<MarketsQuery> => ({
|
|
||||||
marketsConnection: {
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
// @ts-ignore conflict between incoming and outgoing types
|
|
||||||
tradingMode: data.tradingMode,
|
|
||||||
state: data.state,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const mockTradingPage = (
|
|
||||||
req: CyHttpMessages.IncomingHttpRequest,
|
|
||||||
state: Schema.MarketState = Schema.MarketState.STATE_ACTIVE,
|
|
||||||
tradingMode?: Schema.MarketTradingMode,
|
|
||||||
trigger?: Schema.AuctionTrigger
|
|
||||||
) => {
|
|
||||||
aliasGQLQuery(req, 'NodeGuard', nodeGuardQuery());
|
|
||||||
aliasGQLQuery(
|
|
||||||
req,
|
|
||||||
'Markets',
|
|
||||||
marketsQuery(marketsDataOverride({ state, tradingMode, trigger }))
|
|
||||||
);
|
|
||||||
aliasGQLQuery(
|
|
||||||
req,
|
|
||||||
'MarketData',
|
|
||||||
marketDataQuery(marketDataOverride({ state, tradingMode, trigger }))
|
|
||||||
);
|
|
||||||
aliasGQLQuery(req, 'MarketsData', marketsDataQuery());
|
|
||||||
aliasGQLQuery(req, 'MarketsCandles', marketsCandlesQuery());
|
|
||||||
aliasGQLQuery(req, 'MarketCandles', marketCandlesQuery());
|
|
||||||
aliasGQLQuery(req, 'MarketDepth', marketDepthQuery());
|
|
||||||
aliasGQLQuery(req, 'Orders', ordersQuery());
|
|
||||||
aliasGQLQuery(req, 'Accounts', accountsQuery());
|
|
||||||
aliasGQLQuery(req, 'Positions', positionsQuery());
|
|
||||||
aliasGQLQuery(req, 'Margins', marginsQuery());
|
|
||||||
aliasGQLQuery(req, 'Assets', assetsQuery());
|
|
||||||
aliasGQLQuery(req, 'Asset', assetQuery());
|
|
||||||
aliasGQLQuery(
|
|
||||||
req,
|
|
||||||
'MarketInfo',
|
|
||||||
marketInfoQuery({
|
|
||||||
market: {
|
|
||||||
tradableInstrument: {
|
|
||||||
instrument: {
|
|
||||||
product: {
|
|
||||||
__typename: 'Future',
|
|
||||||
dataSourceSpecForSettlementData: {
|
|
||||||
data: {
|
|
||||||
sourceType: {
|
|
||||||
sourceType: {
|
|
||||||
signers: [
|
|
||||||
{
|
|
||||||
__typename: 'Signer',
|
|
||||||
signer: {
|
|
||||||
__typename: 'PubKey',
|
|
||||||
key: ORACLE_PUBKEY,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dataSourceSpecForTradingTermination: {
|
|
||||||
data: {
|
|
||||||
sourceType: {
|
|
||||||
sourceType: {
|
|
||||||
signers: [
|
|
||||||
{
|
|
||||||
__typename: 'Signer',
|
|
||||||
signer: {
|
|
||||||
__typename: 'PubKey',
|
|
||||||
key: ORACLE_PUBKEY,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
aliasGQLQuery(req, 'Trades', tradesQuery());
|
|
||||||
aliasGQLQuery(req, 'Chart', chartQuery());
|
|
||||||
aliasGQLQuery(req, 'LiquidityProvisions', liquidityProvisionsQuery());
|
|
||||||
aliasGQLQuery(req, 'LiquidityProviders', liquidityProvidersQuery());
|
|
||||||
aliasGQLQuery(req, 'Candles', candlesQuery());
|
|
||||||
aliasGQLQuery(req, 'Withdrawals', withdrawalsQuery());
|
|
||||||
aliasGQLQuery(req, 'NetworkParams', networkParamsQuery());
|
|
||||||
aliasGQLQuery(req, 'NetworkParam', networkParamQuery);
|
|
||||||
aliasGQLQuery(req, 'EstimateFees', estimateFeesQuery());
|
|
||||||
aliasGQLQuery(req, 'EstimatePosition', estimatePositionQuery());
|
|
||||||
aliasGQLQuery(req, 'ProposalsList', proposalListQuery());
|
|
||||||
aliasGQLQuery(req, 'Deposits', depositsQuery());
|
|
||||||
aliasGQLQuery(
|
|
||||||
req,
|
|
||||||
'ProtocolUpgradeProposals',
|
|
||||||
protocolUpgradeProposalsQuery()
|
|
||||||
);
|
|
||||||
aliasGQLQuery(req, 'BlockStatistics', blockStatisticsQuery());
|
|
||||||
aliasGQLQuery(req, 'SuccessorMarket', successorMarketQuery());
|
|
||||||
aliasGQLQuery(req, 'ParentMarketId', parentMarketIdQuery());
|
|
||||||
aliasGQLQuery(req, 'SuccessorMarketIds', successorMarketIdsQuery());
|
|
||||||
aliasGQLQuery(
|
|
||||||
req,
|
|
||||||
'SuccessorMarketProposalDetails',
|
|
||||||
successorMarketProposalDetailsQuery()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
declare global {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
namespace Cypress {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
interface Chainable<Subject> {
|
|
||||||
mockTradingPage(
|
|
||||||
state?: Schema.MarketState,
|
|
||||||
tradingMode?: Schema.MarketTradingMode,
|
|
||||||
trigger?: Schema.AuctionTrigger,
|
|
||||||
oracleStatus?: Status
|
|
||||||
): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const addMockTradingPage = () => {
|
|
||||||
Cypress.Commands.add(
|
|
||||||
'mockTradingPage',
|
|
||||||
(
|
|
||||||
state = Schema.MarketState.STATE_ACTIVE,
|
|
||||||
tradingMode,
|
|
||||||
trigger,
|
|
||||||
oracleStatus
|
|
||||||
) => {
|
|
||||||
cy.mockChainId();
|
|
||||||
cy.mockGQL((req) => {
|
|
||||||
mockTradingPage(req, state, tradingMode, trigger);
|
|
||||||
});
|
|
||||||
|
|
||||||
const oracle: Provider = {
|
|
||||||
name: 'Another oracle',
|
|
||||||
url: 'https://zombo.com',
|
|
||||||
description_markdown:
|
|
||||||
'Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n',
|
|
||||||
oracle: {
|
|
||||||
status: oracleStatus || 'GOOD',
|
|
||||||
status_reason: '',
|
|
||||||
first_verified: '2022-01-01T00:00:00.000Z',
|
|
||||||
last_verified: '2022-12-31T00:00:00.000Z',
|
|
||||||
type: 'public_key',
|
|
||||||
public_key: ORACLE_PUBKEY,
|
|
||||||
},
|
|
||||||
proofs: [
|
|
||||||
{
|
|
||||||
format: 'signed_message',
|
|
||||||
available: true,
|
|
||||||
type: 'public_key',
|
|
||||||
public_key: ORACLE_PUBKEY,
|
|
||||||
message: 'SOMEHEX',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
github_link: `https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/public_key-${ORACLE_PUBKEY}.toml`,
|
|
||||||
};
|
|
||||||
// Prevent request to github, return some dummy content
|
|
||||||
cy.intercept(
|
|
||||||
'GET',
|
|
||||||
/^https:\/\/raw.githubusercontent.com\/vegaprotocol\/well-known/,
|
|
||||||
{
|
|
||||||
body: [oracle],
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"sourceMap": false,
|
|
||||||
"outDir": "../../dist/out-tsc",
|
|
||||||
"allowJs": true,
|
|
||||||
"types": ["cypress", "node", "cypress-real-events", "@cypress/grep"],
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
|
||||||
"noImplicitReturns": true,
|
|
||||||
"noFallthroughCasesInSwitch": true
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.js", "./declaration.d.ts"]
|
|
||||||
}
|
|
@ -49,10 +49,4 @@ To run the minimal set of unit tests, run the following:
|
|||||||
yarn nx test trading
|
yarn nx test trading
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the UI automation tests with a mocked API, run:
|
To run the UI automation tests please read [e2e/README.md](e2e/README.md)
|
||||||
|
|
||||||
```bash
|
|
||||||
yarn nx run trading-e2e:e2e
|
|
||||||
```
|
|
||||||
|
|
||||||
To run tests with market sim please read [the readme](e2e/README.md).
|
|
||||||
|
@ -84,6 +84,9 @@ if 'release' in args.github_ref:
|
|||||||
|
|
||||||
|
|
||||||
projects = json.dumps(projects)
|
projects = json.dumps(projects)
|
||||||
|
|
||||||
|
# The trading project does not use the deafult NX e2e setup (cypress)
|
||||||
|
projects_e2e.remove('trading-e2e')
|
||||||
projects_e2e = json.dumps(projects_e2e)
|
projects_e2e = json.dumps(projects_e2e)
|
||||||
|
|
||||||
print(f'Projects: {projects}')
|
print(f'Projects: {projects}')
|
||||||
|
Loading…
Reference in New Issue
Block a user