Test/fix trading tests (#1139)
This commit is contained in:
parent
465db69da8
commit
750c421ed5
@ -1,4 +1,4 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV=TESTNET
|
NX_VEGA_ENV=TESTNET
|
||||||
CYPRESS_VEGA_ENV=TESTNET
|
CYPRESS_VEGA_ENV=TESTNET
|
||||||
NX_VEGA_REST=https://api.n11.testnet.vega.xyz
|
NX_VEGA_REST=https://api.n10.testnet.vega.xyz
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const textToCheck = Cypress.env('VEGA_ENV');
|
const textToCheck = Cypress.env('VEGA_ENV');
|
||||||
// breaking changes fail
|
// breaking changes fail
|
||||||
describe.skip('stats', () => {
|
describe('stats', () => {
|
||||||
beforeEach(() => cy.visit('/'));
|
beforeEach(() => cy.visit('/'));
|
||||||
|
|
||||||
it('should display header based on environment name', () => {
|
it('should display header based on environment name', () => {
|
||||||
|
@ -9,7 +9,7 @@ describe('deposit form validation', () => {
|
|||||||
cy.mockWeb3Provider();
|
cy.mockWeb3Provider();
|
||||||
cy.mockGQL((req) => {
|
cy.mockGQL((req) => {
|
||||||
aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters());
|
aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters());
|
||||||
aliasQuery(req, 'DepositPage', generateDepositPage());
|
aliasQuery(req, 'AssetsConnection', generateDepositPage());
|
||||||
});
|
});
|
||||||
cy.visit('/portfolio/deposit');
|
cy.visit('/portfolio/deposit');
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ describe('deposit form validation', () => {
|
|||||||
cy.getByTestId(connectEthWalletBtn).click();
|
cy.getByTestId(connectEthWalletBtn).click();
|
||||||
cy.getByTestId('web3-connector-MetaMask').click();
|
cy.getByTestId('web3-connector-MetaMask').click();
|
||||||
|
|
||||||
cy.wait('@DepositPage');
|
cy.wait('@AssetsConnection');
|
||||||
cy.contains('Deposit');
|
cy.contains('Deposit');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ describe('accounts', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.get(tradingAccountRowId)
|
.get(tradingAccountRowId)
|
||||||
.find('[col-id="type"]')
|
.find('[col-id="type"]')
|
||||||
.should('have.text', 'ACCOUNT_TYPE_GENERAL');
|
.should('have.text', 'General');
|
||||||
|
|
||||||
cy.getByTestId('tab-accounts')
|
cy.getByTestId('tab-accounts')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
|
@ -18,6 +18,7 @@ export const generateDealTicketQuery = (
|
|||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
__typename: 'TradableInstrument',
|
__typename: 'TradableInstrument',
|
||||||
instrument: {
|
instrument: {
|
||||||
|
id: 'tBTC TEST',
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
product: {
|
product: {
|
||||||
__typename: 'Future',
|
__typename: 'Future',
|
||||||
|
@ -6,30 +6,39 @@ export const generateDepositPage = (
|
|||||||
override?: PartialDeep<any>
|
override?: PartialDeep<any>
|
||||||
) => {
|
) => {
|
||||||
const defaultResult = {
|
const defaultResult = {
|
||||||
assets: [
|
assetsConnection: {
|
||||||
{
|
edges: [
|
||||||
id: 'asset-0',
|
{
|
||||||
symbol: 'AST0',
|
node: {
|
||||||
name: 'Asset 0',
|
id: 'asset-0',
|
||||||
decimals: 5,
|
symbol: 'AST0',
|
||||||
source: {
|
name: 'Asset 0',
|
||||||
__typename: 'ERC20',
|
decimals: 5,
|
||||||
contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
source: {
|
||||||
|
__typename: 'ERC20',
|
||||||
|
contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
||||||
|
},
|
||||||
|
__typename: 'Asset',
|
||||||
|
},
|
||||||
|
__typename: 'AssetEdge',
|
||||||
},
|
},
|
||||||
__typename: 'Asset',
|
{
|
||||||
},
|
node: {
|
||||||
{
|
id: 'asset-1',
|
||||||
id: 'asset-1',
|
symbol: 'AST1',
|
||||||
symbol: 'AST1',
|
name: 'Asset 1',
|
||||||
name: 'Asset 1',
|
decimals: 5,
|
||||||
decimals: 5,
|
source: {
|
||||||
source: {
|
__typename: 'ERC20',
|
||||||
__typename: 'ERC20',
|
contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
||||||
contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
},
|
||||||
|
__typename: 'Asset',
|
||||||
|
},
|
||||||
|
__typename: 'AssetEdge',
|
||||||
},
|
},
|
||||||
__typename: 'Asset',
|
],
|
||||||
},
|
__typename: 'AssetsConnection',
|
||||||
],
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return merge(defaultResult, override);
|
return merge(defaultResult, override);
|
||||||
|
@ -84,6 +84,15 @@ export const generateMarketList = (
|
|||||||
positionDecimalPlaces: 0,
|
positionDecimalPlaces: 0,
|
||||||
state: MarketState.STATE_SUSPENDED,
|
state: MarketState.STATE_SUSPENDED,
|
||||||
tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
||||||
|
fees: {
|
||||||
|
factors: {
|
||||||
|
makerFee: '0.0002',
|
||||||
|
infrastructureFee: '0.0005',
|
||||||
|
liquidityFee: '0.001',
|
||||||
|
__typename: 'FeeFactors',
|
||||||
|
},
|
||||||
|
__typename: 'Fees',
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
market: {
|
market: {
|
||||||
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed',
|
||||||
@ -94,6 +103,7 @@ export const generateMarketList = (
|
|||||||
bestBidPrice: '17065127',
|
bestBidPrice: '17065127',
|
||||||
bestOfferPrice: '17017654',
|
bestOfferPrice: '17017654',
|
||||||
markPrice: '8441',
|
markPrice: '8441',
|
||||||
|
trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY,
|
||||||
indicativeVolume: '249',
|
indicativeVolume: '249',
|
||||||
__typename: 'MarketData',
|
__typename: 'MarketData',
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,7 @@ export const generateMarket = (override?: PartialDeep<Market>): Market => {
|
|||||||
},
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
instrument: {
|
instrument: {
|
||||||
|
id: 'BTCUSD.MF21',
|
||||||
name: 'BTCUSD Monthly',
|
name: 'BTCUSD Monthly',
|
||||||
code: 'BTCUSD.MF21',
|
code: 'BTCUSD.MF21',
|
||||||
metadata: {
|
metadata: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import { MarketTradingMode } from '@vegaprotocol/types';
|
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
|
||||||
import type { DeepPartial } from 'react-hook-form';
|
import type { DeepPartial } from 'react-hook-form';
|
||||||
|
|
||||||
export interface MarketsLanding_markets_marketTimestamps {
|
export interface MarketsLanding_markets_marketTimestamps {
|
||||||
@ -11,6 +11,7 @@ export interface MarketsLanding_markets {
|
|||||||
__typename: 'Market';
|
__typename: 'Market';
|
||||||
id: string;
|
id: string;
|
||||||
tradingMode: MarketTradingMode;
|
tradingMode: MarketTradingMode;
|
||||||
|
state: MarketState;
|
||||||
marketTimestamps: MarketsLanding_markets_marketTimestamps;
|
marketTimestamps: MarketsLanding_markets_marketTimestamps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ export const generateMarketsLanding = (
|
|||||||
{
|
{
|
||||||
id: 'market-0',
|
id: 'market-0',
|
||||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
|
state: MarketState.STATE_ACTIVE,
|
||||||
marketTimestamps: {
|
marketTimestamps: {
|
||||||
__typename: 'MarketTimestamps',
|
__typename: 'MarketTimestamps',
|
||||||
open: '1',
|
open: '1',
|
||||||
@ -35,6 +37,7 @@ export const generateMarketsLanding = (
|
|||||||
{
|
{
|
||||||
id: 'market-1',
|
id: 'market-1',
|
||||||
tradingMode: MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
|
tradingMode: MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
|
||||||
|
state: MarketState.STATE_SUSPENDED,
|
||||||
marketTimestamps: {
|
marketTimestamps: {
|
||||||
__typename: 'MarketTimestamps',
|
__typename: 'MarketTimestamps',
|
||||||
open: '2',
|
open: '2',
|
||||||
|
@ -30,30 +30,38 @@ export const generateWithdrawPageQuery = (
|
|||||||
],
|
],
|
||||||
__typename: 'Party',
|
__typename: 'Party',
|
||||||
},
|
},
|
||||||
assets: [
|
assetsConnection: {
|
||||||
{
|
edges: [
|
||||||
id: 'asset-0',
|
{
|
||||||
symbol: 'AST0',
|
node: {
|
||||||
name: 'Asset 0',
|
id: 'asset-0',
|
||||||
decimals: 5,
|
symbol: 'AST0',
|
||||||
source: {
|
name: 'Asset 0',
|
||||||
__typename: 'ERC20',
|
decimals: 5,
|
||||||
contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
source: {
|
||||||
|
__typename: 'ERC20',
|
||||||
|
contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
||||||
|
},
|
||||||
|
__typename: 'Asset',
|
||||||
|
},
|
||||||
|
__typename: 'AssetEdge',
|
||||||
},
|
},
|
||||||
__typename: 'Asset',
|
{
|
||||||
},
|
node: {
|
||||||
{
|
id: 'asset-1',
|
||||||
id: 'asset-1',
|
symbol: 'AST1',
|
||||||
symbol: 'AST1',
|
name: 'Asset 1',
|
||||||
name: 'Asset 1',
|
decimals: 5,
|
||||||
decimals: 5,
|
source: {
|
||||||
source: {
|
__typename: 'ERC20',
|
||||||
__typename: 'ERC20',
|
contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
||||||
contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81',
|
},
|
||||||
|
__typename: 'Asset',
|
||||||
|
},
|
||||||
|
__typename: 'AssetEdge',
|
||||||
},
|
},
|
||||||
__typename: 'Asset',
|
],
|
||||||
},
|
},
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return merge(defaultResult, override);
|
return merge(defaultResult, override);
|
||||||
|
@ -12,10 +12,6 @@ declare global {
|
|||||||
|
|
||||||
export function addMockGQLCommand() {
|
export function addMockGQLCommand() {
|
||||||
Cypress.Commands.add('mockGQL', (handler: RouteHandler) => {
|
Cypress.Commands.add('mockGQL', (handler: RouteHandler) => {
|
||||||
cy.intercept(
|
cy.intercept('POST', '**/graphql', handler).as('GQL');
|
||||||
'POST',
|
|
||||||
'https://api.n11.testnet.vega.xyz/graphql',
|
|
||||||
handler
|
|
||||||
).as('GQL');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user