test: 2059 migrate trading e2e tests to use vegawallet v2 (#2175)
* test: trading e2e switched to use v2 wallet * chore: fix remove transaction from storage * chore: mock for v2 wallet transactions added * test: added new mock for transaction, updated deal ticket and withdraw tests * chore: skipped some mock to allow wallet connection * chore: remove unused function * chore: dont make chain id check when in test * chore: fix lint warnings * chore: fix trading fills test by ensuring correct pubkey is used for connection * chore: add comment for cypress check in json rpc connect flow * chore: add chainID mock * chore: add data-testId to order list status cell * chore: fix testid * chore: fix trading-portfolio test * chore: revert marigin test changes * chore: improve tests regarding wallet connection * chore: reuse ordersubmission type in test * chore: apply connect vega wallet changes to console-lite-e2e * chore: trigger lint Co-authored-by: Matthew Russell <mattrussell36@gmail.com> Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
This commit is contained in:
parent
081c9f44ae
commit
71890d662a
@ -1,4 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
generateMarket,
|
||||
@ -52,7 +51,7 @@ describe('market selector', { tags: '@smoke' }, () => {
|
||||
it('should be properly rendered', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').should(
|
||||
'have.value',
|
||||
markets[0].tradableInstrument.instrument.name
|
||||
@ -76,7 +75,7 @@ describe('market selector', { tags: '@smoke' }, () => {
|
||||
it('typing should change list', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.getByTestId('market-pane')
|
||||
.children()
|
||||
@ -112,7 +111,7 @@ describe('market selector', { tags: '@smoke' }, () => {
|
||||
it.skip('keyboard navigation should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('input[placeholder="Search"]').type('{backspace}');
|
||||
cy.get('input[placeholder="Search"]').clear();
|
||||
cy.focused().realPress('ArrowDown');
|
||||
@ -134,7 +133,7 @@ describe('market selector', { tags: '@smoke' }, () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('[role="dialog"]').should('not.exist');
|
||||
cy.getByTestId('arrow-button').click();
|
||||
cy.get('[role="dialog"]').should('be.visible');
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
generateSimpleMarkets,
|
||||
@ -63,7 +62,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('side selector should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').should(
|
||||
'have.text',
|
||||
'Long'
|
||||
@ -82,7 +81,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('next-button').scrollIntoView().click();
|
||||
|
||||
cy.get('button[aria-label="Open long position"]').should(
|
||||
@ -114,7 +113,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('size slider should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -136,7 +135,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('percentage selection should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -163,7 +162,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('size input should work well', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -191,7 +190,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('slippage value should be displayed', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -207,7 +206,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('allow slippage value to be adjusted', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -235,7 +234,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('notional position size should be present', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -262,7 +261,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('total fees should be displayed', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[1].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-1-control [aria-label^="Selected value"]').click();
|
||||
cy.get('button[aria-label="Open short position"]').click();
|
||||
cy.get('#step-2-control').click();
|
||||
@ -280,7 +279,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
it('order review should display proper calculations', () => {
|
||||
if (markets?.length) {
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-3-control').click();
|
||||
|
||||
cy.getByTestId('review-trade')
|
||||
@ -310,7 +309,7 @@ describe('Market trade', { tags: '@smoke' }, () => {
|
||||
if (markets?.length) {
|
||||
cy.viewport('iphone-xr');
|
||||
cy.visit(`/trading/${markets[0].id}`);
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.get('#step-3-control').click();
|
||||
|
||||
// Start from the bottom tooltip to ensure the tooltip above
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import {
|
||||
generatePositions,
|
||||
@ -22,7 +21,7 @@ describe('Portfolio page - wallet', { tags: '@smoke' }, () => {
|
||||
cy.visit('/');
|
||||
cy.get('[href="/portfolio"]').eq(0).click();
|
||||
cy.getByTestId('trading-connect-wallet').should('be.visible');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('trading-connect-wallet').should('not.exist');
|
||||
});
|
||||
});
|
||||
@ -43,7 +42,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
|
||||
it('certain tabs should exist', () => {
|
||||
cy.visit('/portfolio');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
cy.getByTestId('assets').click();
|
||||
cy.location('pathname').should('eq', '/portfolio/assets');
|
||||
@ -74,7 +73,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
aliasQuery(req, 'Assets', generateAssets());
|
||||
});
|
||||
cy.visit('/portfolio/assets');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('data should be properly rendered', () => {
|
||||
@ -105,7 +104,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
aliasQuery(req, 'Assets', generateAssets());
|
||||
});
|
||||
cy.visit('/portfolio/positions');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('data should be properly rendered', () => {
|
||||
@ -122,7 +121,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
aliasQuery(req, 'Markets', generateFillsMarkets());
|
||||
});
|
||||
cy.visit('/portfolio/orders');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('data should be properly rendered', () => {
|
||||
@ -139,7 +138,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
aliasQuery(req, 'Markets', generateFillsMarkets());
|
||||
});
|
||||
cy.visit('/portfolio/fills');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('data should be properly rendered', () => {
|
||||
@ -166,7 +165,7 @@ describe('Portfolio page tabs', { tags: '@smoke' }, () => {
|
||||
aliasQuery(req, 'MarketsData', generateMarketsData());
|
||||
});
|
||||
cy.visit('/portfolio');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('"No data to display" should be always displayed', () => {
|
||||
|
@ -1,12 +0,0 @@
|
||||
export const connectVegaWallet = () => {
|
||||
const form = 'rest-connector-form';
|
||||
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
|
||||
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
|
||||
cy.getByTestId('connect-vega-wallet').click();
|
||||
cy.getByTestId('connectors-list')
|
||||
.find('[data-testid="connector-gui"]')
|
||||
.click();
|
||||
cy.getByTestId(form).find('#wallet').click().type(walletName);
|
||||
cy.getByTestId(form).find('#passphrase').click().type(walletPassphrase);
|
||||
cy.getByTestId('rest-connector-form').find('button[type=submit]').click();
|
||||
};
|
@ -12,3 +12,4 @@ NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
CYPRESS_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
|
||||
CYPRESS_EXPLORER_URL=https://stagnet3.explorer.vega.xyz
|
||||
CYPRESS_VEGA_ENV=STAGNET3
|
||||
|
@ -1,6 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
const connectEthWalletBtn = 'connect-eth-wallet-btn';
|
||||
const assetSelectField = 'select[name="asset"]';
|
||||
const toAddressField = 'input[name="to"]';
|
||||
const amountField = 'input[name="amount"]';
|
||||
@ -14,14 +11,20 @@ describe('deposit form validation', { tags: '@smoke' }, () => {
|
||||
cy.visit('/#/portfolio');
|
||||
cy.get('main[data-testid="/portfolio"]').should('exist');
|
||||
cy.getByTestId('Deposits').click();
|
||||
|
||||
cy.getByTestId('tab-deposits').contains('Connect your Vega wallet');
|
||||
connectVegaWallet();
|
||||
// validateFillsDisplayed();
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('deposit-button').click();
|
||||
cy.wait('@Assets');
|
||||
});
|
||||
|
||||
it('unable to select assets not enabled', () => {
|
||||
cy.getByTestId('deposit-submit').click();
|
||||
// Assets not enabled in mocks
|
||||
cy.get(assetSelectField + ' option:contains(Asset 2)').should('not.exist');
|
||||
cy.get(assetSelectField + ' option:contains(Asset 3)').should('not.exist');
|
||||
cy.get(assetSelectField + ' option:contains(Asset 4)').should('not.exist');
|
||||
});
|
||||
|
||||
it('handles empty fields', () => {
|
||||
// Submit form to trigger any empty validation messages
|
||||
cy.getByTestId('deposit-submit').click();
|
||||
@ -53,27 +56,4 @@ describe('deposit form validation', { tags: '@smoke' }, () => {
|
||||
.next(`[data-testid="${formFieldError}"]`)
|
||||
.should('have.text', 'Insufficient amount in Ethereum wallet');
|
||||
});
|
||||
|
||||
it('unable to select assets not enabled', () => {
|
||||
cy.getByTestId('deposit-submit').click();
|
||||
// Assets not enabled in mocks
|
||||
cy.get(assetSelectField + ' option:contains(Asset 2)').should('not.exist');
|
||||
cy.get(assetSelectField + ' option:contains(Asset 3)').should('not.exist');
|
||||
cy.get(assetSelectField + ' option:contains(Asset 4)').should('not.exist');
|
||||
});
|
||||
|
||||
it('able to disconnect eth wallet', () => {
|
||||
const ethWalletAddress = Cypress.env('ETHEREUM_WALLET_ADDRESS');
|
||||
|
||||
cy.get('#ethereum-address').should('have.value', ethWalletAddress).click();
|
||||
cy.getByTestId('dialog-content').within(() => {
|
||||
cy.get('p').should('have.text', `Connected with ${ethWalletAddress}`);
|
||||
cy.getByTestId('disconnect-ethereum-wallet')
|
||||
.should('have.text', 'Disconnect Ethereum Wallet')
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.getByTestId('connect-eth-wallet-msg').should('exist');
|
||||
cy.getByTestId(connectEthWalletBtn).should('exist');
|
||||
});
|
||||
});
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { generateNetworkParameters } from '../support/mocks/generate-network-parameters';
|
||||
|
||||
describe('vega wallet', { tags: '@smoke' }, () => {
|
||||
const connectVegaBtn = 'connect-vega-wallet';
|
||||
const manageVegaBtn = 'manage-vega-wallet';
|
||||
const form = 'rest-connector-form';
|
||||
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
|
||||
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
|
||||
const connectEthWalletBtn = 'connect-eth-wallet-btn';
|
||||
const connectVegaBtn = 'connect-vega-wallet';
|
||||
const manageVegaBtn = 'manage-vega-wallet';
|
||||
const form = 'rest-connector-form';
|
||||
const dialogContent = 'dialog-content';
|
||||
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
|
||||
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
|
||||
|
||||
describe('vega wallet v1', { tags: '@smoke' }, () => {
|
||||
beforeEach(() => {
|
||||
// Using portfolio page as it requires vega wallet connection
|
||||
cy.visit('/#/portfolio');
|
||||
@ -59,16 +60,34 @@ describe('vega wallet', { tags: '@smoke' }, () => {
|
||||
.next('[data-testid="input-error-text"]')
|
||||
.should('have.text', 'Required');
|
||||
});
|
||||
});
|
||||
|
||||
// skipped as it was blocking CI jobs
|
||||
it.skip('can change selected public key and disconnect', () => {
|
||||
describe('vega wallet v2', { tags: '@smoke' }, () => {
|
||||
beforeEach(() => {
|
||||
// Using portfolio page as it requires vega wallet connection
|
||||
cy.visit('/#/portfolio');
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription();
|
||||
cy.get('main[data-testid="/portfolio"]').should('exist');
|
||||
});
|
||||
|
||||
it('can connect', () => {
|
||||
cy.getByTestId(connectVegaBtn).click();
|
||||
cy.getByTestId('connectors-list')
|
||||
.find('[data-testid="connector-cli"]')
|
||||
.click();
|
||||
cy.getByTestId(dialogContent).should('not.exist');
|
||||
cy.getByTestId(manageVegaBtn).should('exist');
|
||||
});
|
||||
|
||||
it('can change selected public key and disconnect', () => {
|
||||
const key2 = Cypress.env('VEGA_PUBLIC_KEY2');
|
||||
const truncatedKey2 = Cypress.env('TRUNCATED_VEGA_PUBLIC_KEY2');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('manage-vega-wallet').click();
|
||||
cy.getByTestId('keypair-list').should('exist');
|
||||
cy.getByTestId(`key-${key2}`).should('contain.text', truncatedKey2);
|
||||
cy.getByTestId(`key-${key2}`).click();
|
||||
cy.get(`[data-testid="key-${key2}"] > .mr-2`).click();
|
||||
cy.getByTestId('disconnect').click();
|
||||
cy.getByTestId('connect-vega-wallet').should('exist');
|
||||
cy.getByTestId('manage-vega-wallet').should('not.exist');
|
||||
@ -96,4 +115,20 @@ describe('ethereum wallet', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('web3-connector-list').should('not.exist');
|
||||
cy.getByTestId('tab-withdrawals').should('not.be.empty');
|
||||
});
|
||||
|
||||
it('able to disconnect eth wallet', () => {
|
||||
const ethWalletAddress = Cypress.env('ETHEREUM_WALLET_ADDRESS');
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('Deposits').click();
|
||||
cy.getByTestId('deposit-button').click();
|
||||
cy.get('#ethereum-address').should('have.value', ethWalletAddress).click();
|
||||
cy.getByTestId('dialog-content').within(() => {
|
||||
cy.get('p').should('have.text', `Connected with ${ethWalletAddress}`);
|
||||
cy.getByTestId('disconnect-ethereum-wallet')
|
||||
.should('have.text', 'Disconnect Ethereum Wallet')
|
||||
.click();
|
||||
});
|
||||
cy.getByTestId('connect-eth-wallet-msg').should('exist');
|
||||
cy.getByTestId(connectEthWalletBtn).should('exist');
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Schema, MarketTradingModeMapping } from '@vegaprotocol/types';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
const marketInfoBtn = 'Info';
|
||||
const row = 'key-value-table-row';
|
||||
@ -229,7 +228,7 @@ describe('market states', { tags: '@smoke' }, function () {
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
it.skip('must display correct market state');
|
||||
//7002-/SORD-/061 no state displayed
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.mockTradingPage();
|
||||
cy.mockWeb3Provider();
|
||||
@ -12,9 +10,10 @@ describe('accounts', { tags: '@smoke' }, () => {
|
||||
const tradingAccountRowId = '[row-id="asset-0"]';
|
||||
cy.getByTestId('Collateral').click();
|
||||
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
cy.getByTestId('tab-accounts').should('be.visible');
|
||||
|
||||
cy.getByTestId('tab-accounts')
|
||||
.get(tradingAccountRowId)
|
||||
.find('[col-id="asset.symbol"]')
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { generateEstimateOrder } from '../support/mocks/generate-fees';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import { testOrder } from '../support/deal-ticket-transaction';
|
||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
||||
|
||||
const orderSizeField = 'order-size';
|
||||
const orderPriceField = 'order-price';
|
||||
const orderTIFDropDown = 'order-tif';
|
||||
const placeOrderBtn = 'place-order';
|
||||
const dialogTitle = 'dialog-title';
|
||||
const orderTransactionHash = 'tx-block-explorer';
|
||||
const toggleShort = 'order-side-SIDE_SELL';
|
||||
const toggleLong = 'order-side-SIDE_BUY';
|
||||
const toggleLimit = 'order-type-TYPE_LIMIT';
|
||||
@ -48,97 +47,19 @@ const TIFlist = [
|
||||
},
|
||||
];
|
||||
|
||||
interface Order {
|
||||
type: 'TYPE_MARKET' | 'TYPE_LIMIT';
|
||||
side: 'SIDE_BUY' | 'SIDE_SELL';
|
||||
size: string;
|
||||
price?: string;
|
||||
timeInForce:
|
||||
| 'TIME_IN_FORCE_GTT'
|
||||
| 'TIME_IN_FORCE_GTC'
|
||||
| 'TIME_IN_FORCE_IOC'
|
||||
| 'TIME_IN_FORCE_FOK'
|
||||
| 'TIME_IN_FORCE_GFN'
|
||||
| 'TIME_IN_FORCE_GFA';
|
||||
expiresAt?: string;
|
||||
}
|
||||
|
||||
const mockTx = {
|
||||
txHash: 'test-tx-hash',
|
||||
tx: {
|
||||
signature: {
|
||||
value:
|
||||
'd86138bba739bbc1069b3dc975d20b3a1517c2b9bdd401c70eeb1a0ecbc502ec268cf3129824841178b8b506b0b7d650c76644dbd96f524a6cb2158fb7121800',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const displayTomorrow = () => {
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
return tomorrow.toISOString().substring(0, 16);
|
||||
};
|
||||
|
||||
const testOrder = (order: Order, expected?: Partial<Order>) => {
|
||||
const { type, side, size, price, timeInForce, expiresAt } = order;
|
||||
|
||||
cy.getByTestId(`order-type-${type}`).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');
|
||||
}
|
||||
// select expiry
|
||||
cy.getByTestId('date-picker-field').type(expiresAt);
|
||||
}
|
||||
cy.getByTestId(placeOrderBtn).click();
|
||||
|
||||
const expectedOrder = {
|
||||
...order,
|
||||
...expected,
|
||||
};
|
||||
|
||||
cy.wait('@VegaCommandSync')
|
||||
.its('request.body')
|
||||
.should('deep.equal', {
|
||||
pubKey: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
propagate: true,
|
||||
orderSubmission: {
|
||||
marketId: 'market-0',
|
||||
...expectedOrder,
|
||||
},
|
||||
});
|
||||
cy.getByTestId(dialogTitle).should(
|
||||
'have.text',
|
||||
'Awaiting network confirmation'
|
||||
);
|
||||
cy.getByTestId(orderTransactionHash)
|
||||
.invoke('attr', 'href')
|
||||
.should('include', `${Cypress.env('EXPLORER_URL')}/txs/0xtest-tx-hash`);
|
||||
cy.getByTestId('dialog-close').click();
|
||||
};
|
||||
|
||||
const clearPersistedOrder = () => {
|
||||
cy.clearLocalStorage().should((ls) => {
|
||||
expect(ls.getItem('deal-ticket-order-market-0')).to.be.null;
|
||||
});
|
||||
};
|
||||
|
||||
beforeEach(() => clearPersistedOrder());
|
||||
afterEach(() => clearPersistedOrder());
|
||||
|
||||
describe('time in force default values', () => {
|
||||
before(() => {
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('must have market order set up to IOC by default', function () {
|
||||
@ -167,66 +88,80 @@ describe('must submit order', { tags: '@smoke' }, () => {
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.window().then(function (window) {
|
||||
cy.wrap(window.localStorage.getItem('vega_wallet_config')).as('cfg');
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.window().then(function (window) {
|
||||
window.localStorage.setItem('vega_wallet_config', this.cfg);
|
||||
});
|
||||
});
|
||||
|
||||
it('successfully places market buy order', () => {
|
||||
//7002-SORD-010
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_MARKET',
|
||||
side: 'SIDE_BUY',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_MARKET,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
size: '100',
|
||||
timeInForce: 'TIME_IN_FORCE_FOK',
|
||||
};
|
||||
testOrder(order);
|
||||
});
|
||||
|
||||
it('successfully places market sell order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_MARKET',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_MARKET,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC,
|
||||
size: '100',
|
||||
timeInForce: 'TIME_IN_FORCE_IOC',
|
||||
};
|
||||
testOrder(order);
|
||||
});
|
||||
|
||||
it('successfully places limit buy order', () => {
|
||||
// 7002-SORD-017
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_BUY',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '200',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '20000000' });
|
||||
});
|
||||
|
||||
it('successfully places limit sell order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GFN,
|
||||
size: '100',
|
||||
price: '50000',
|
||||
timeInForce: 'TIME_IN_FORCE_GFN',
|
||||
};
|
||||
testOrder(order, { price: '5000000000' });
|
||||
});
|
||||
|
||||
it('successfully places GTT limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
cy.mockVegaWalletTransaction();
|
||||
const expiresAt = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
||||
size: '100',
|
||||
price: '1.00',
|
||||
timeInForce: 'TIME_IN_FORCE_GTT',
|
||||
expiresAt: expiresAt.toISOString().substring(0, 16),
|
||||
};
|
||||
testOrder(order, {
|
||||
@ -250,41 +185,53 @@ describe(
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.window().then(function (window) {
|
||||
cy.wrap(window.localStorage.getItem('vega_wallet_config')).as('cfg');
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.window().then(function (window) {
|
||||
window.localStorage.setItem('vega_wallet_config', this.cfg);
|
||||
});
|
||||
});
|
||||
|
||||
it('successfully places limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_BUY',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '200',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '20000000' });
|
||||
});
|
||||
|
||||
it('successfully places limit sell order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '50000',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '5000000000' });
|
||||
});
|
||||
|
||||
it('successfully places GTT limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
||||
size: '100',
|
||||
price: '1.00',
|
||||
timeInForce: 'TIME_IN_FORCE_GTT',
|
||||
expiresAt: displayTomorrow(),
|
||||
};
|
||||
testOrder(order, {
|
||||
@ -309,41 +256,53 @@ describe(
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.window().then(function (window) {
|
||||
cy.wrap(window.localStorage.getItem('vega_wallet_config')).as('cfg');
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.window().then(function (window) {
|
||||
window.localStorage.setItem('vega_wallet_config', this.cfg);
|
||||
});
|
||||
});
|
||||
|
||||
it('successfully places limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_BUY',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '200',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '20000000' });
|
||||
});
|
||||
|
||||
it('successfully places limit sell order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '50000',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '5000000000' });
|
||||
});
|
||||
|
||||
it('successfully places GTT limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
||||
size: '100',
|
||||
price: '1.00',
|
||||
timeInForce: 'TIME_IN_FORCE_GTT',
|
||||
expiresAt: displayTomorrow(),
|
||||
};
|
||||
testOrder(order, {
|
||||
@ -368,41 +327,53 @@ describe(
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.window().then(function (window) {
|
||||
cy.wrap(window.localStorage.getItem('vega_wallet_config')).as('cfg');
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.window().then(function (window) {
|
||||
window.localStorage.setItem('vega_wallet_config', this.cfg);
|
||||
});
|
||||
});
|
||||
|
||||
it('successfully places limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_BUY',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_BUY,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '200',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '20000000' });
|
||||
});
|
||||
|
||||
it('successfully places limit sell order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
size: '100',
|
||||
price: '50000',
|
||||
timeInForce: 'TIME_IN_FORCE_GTC',
|
||||
};
|
||||
testOrder(order, { price: '5000000000' });
|
||||
});
|
||||
|
||||
it('successfully places GTT limit buy order', () => {
|
||||
cy.mockVegaCommandSync(mockTx);
|
||||
const order: Order = {
|
||||
type: 'TYPE_LIMIT',
|
||||
side: 'SIDE_SELL',
|
||||
cy.mockVegaWalletTransaction();
|
||||
const order: OrderSubmission = {
|
||||
marketId: 'market-0',
|
||||
type: Schema.OrderType.TYPE_LIMIT,
|
||||
side: Schema.Side.SIDE_SELL,
|
||||
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTT,
|
||||
size: '100',
|
||||
price: '1.00',
|
||||
timeInForce: 'TIME_IN_FORCE_GTT',
|
||||
expiresAt: displayTomorrow(),
|
||||
};
|
||||
testOrder(order, {
|
||||
@ -467,7 +438,7 @@ describe('deal ticket size validation', { tags: '@smoke' }, function () {
|
||||
cy.mockTradingPage();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('must warn if order size input has too many digits after the decimal place', function () {
|
||||
@ -501,7 +472,7 @@ describe('limit order validations', { tags: '@smoke' }, () => {
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.wait('@Market');
|
||||
cy.getByTestId(toggleLimit).click();
|
||||
});
|
||||
@ -638,7 +609,7 @@ describe('suspended market validation', { tags: '@regression' }, () => {
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.wait('@Market');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
});
|
||||
|
||||
it('should show warning for market order', function () {
|
||||
@ -694,7 +665,7 @@ describe('account validation', { tags: '@regression' }, () => {
|
||||
});
|
||||
cy.mockGQLSubscription();
|
||||
cy.visit('/#/markets/market-0');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.wait('@Market');
|
||||
});
|
||||
|
||||
@ -711,6 +682,7 @@ describe('account validation', { tags: '@regression' }, () => {
|
||||
});
|
||||
|
||||
it('should display info and button for deposit', () => {
|
||||
//7002-SORD-003
|
||||
// warning should show immediately
|
||||
cy.getByTestId('dealticket-warning-margin').should(
|
||||
'contain.text',
|
||||
|
@ -1,12 +1,22 @@
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import { generateFills } from '../support/mocks/generate-fills';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
describe('fills', { tags: '@regression' }, () => {
|
||||
beforeEach(() => {
|
||||
// Ensure page loads with correct key
|
||||
cy.window().then((window) => {
|
||||
cy.wrap(
|
||||
window.localStorage.setItem(
|
||||
'vega_wallet_key',
|
||||
Cypress.env('VEGA_PUBLIC_KEY')
|
||||
)
|
||||
);
|
||||
});
|
||||
cy.mockTradingPage();
|
||||
const fills = generateFills();
|
||||
console.log(fills);
|
||||
cy.mockGQL((req) => {
|
||||
aliasQuery(req, 'Fills', generateFills());
|
||||
aliasQuery(req, 'Fills', fills);
|
||||
});
|
||||
cy.mockGQLSubscription();
|
||||
});
|
||||
@ -16,7 +26,7 @@ describe('fills', { tags: '@regression' }, () => {
|
||||
cy.get('main[data-testid="/portfolio"]').should('exist');
|
||||
cy.getByTestId('Fills').click();
|
||||
cy.getByTestId('tab-fills').contains('Connect your Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
validateFillsDisplayed();
|
||||
});
|
||||
|
||||
@ -25,7 +35,7 @@ describe('fills', { tags: '@regression' }, () => {
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.getByTestId('Fills').click();
|
||||
cy.getByTestId('tab-fills').contains('Please connect Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
validateFillsDisplayed();
|
||||
});
|
||||
|
||||
@ -44,17 +54,17 @@ describe('fills', { tags: '@regression' }, () => {
|
||||
.each(($amount) => {
|
||||
cy.wrap($amount).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.getByTestId('tab-positions')
|
||||
cy.getByTestId('tab-fills')
|
||||
.get('[role="gridcell"][col-id="price"]')
|
||||
.each(($prices) => {
|
||||
cy.wrap($prices).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.getByTestId('tab-positions')
|
||||
cy.getByTestId('tab-fills')
|
||||
.get('[role="gridcell"][col-id="price_1"]')
|
||||
.each(($total) => {
|
||||
cy.wrap($total).invoke('text').should('not.be.empty');
|
||||
});
|
||||
cy.getByTestId('tab-positions')
|
||||
cy.getByTestId('tab-fills')
|
||||
.get('[role="gridcell"][col-id="aggressor"]')
|
||||
.each(($role) => {
|
||||
cy.wrap($role)
|
||||
@ -64,7 +74,7 @@ describe('fills', { tags: '@regression' }, () => {
|
||||
expect(roles.indexOf(text.trim())).to.be.greaterThan(-1);
|
||||
});
|
||||
});
|
||||
cy.getByTestId('tab-positions')
|
||||
cy.getByTestId('tab-fills')
|
||||
.get(
|
||||
'[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]'
|
||||
)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Schema } from '@vegaprotocol/types';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import {
|
||||
updateOrder,
|
||||
getSubscriptionMocks,
|
||||
@ -26,7 +25,7 @@ describe('orders list', { tags: '@smoke' }, () => {
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.getByTestId('Orders').click();
|
||||
cy.getByTestId('tab-orders').contains('Please connect Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.wait('@Orders').then(() => {
|
||||
expect(subscriptionMocks.OrdersUpdate).to.be.calledOnce;
|
||||
});
|
||||
@ -130,7 +129,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.getByTestId('Orders').click();
|
||||
cy.getByTestId('tab-orders').contains('Please connect Vega wallet');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.wait('@Orders').then(() => {
|
||||
expect(subscriptionMocks.OrdersUpdate).to.be.calledOnce;
|
||||
});
|
||||
@ -144,19 +143,18 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_ACTIVE,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Active'
|
||||
);
|
||||
});
|
||||
|
||||
it('must see an expired order', () => {
|
||||
// 7002-SORD-042
|
||||
updateOrder({
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_EXPIRED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Expired'
|
||||
);
|
||||
@ -169,7 +167,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_CANCELLED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Cancelled'
|
||||
);
|
||||
@ -182,7 +180,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_STOPPED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Stopped'
|
||||
);
|
||||
@ -196,14 +194,14 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
size: '5',
|
||||
remaining: '1',
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'PartiallyFilled'
|
||||
);
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderRemaining}]`).should(
|
||||
'have.text',
|
||||
'4/5'
|
||||
);
|
||||
cy.get(`[data-testid=order-status-${orderId}]`)
|
||||
.parent()
|
||||
.siblings(`[col-id=${orderRemaining}]`)
|
||||
.should('have.text', '4/5');
|
||||
});
|
||||
|
||||
it('must see a filled order', () => {
|
||||
@ -213,7 +211,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_FILLED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Filled'
|
||||
);
|
||||
@ -226,7 +224,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
status: Schema.OrderStatus.STATUS_REJECTED,
|
||||
rejectionReason: Schema.OrderRejectionReason.ORDER_ERROR_INTERNAL_ERROR,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Rejected: Internal error'
|
||||
);
|
||||
@ -239,7 +237,7 @@ describe('subscribe orders', { tags: '@smoke' }, () => {
|
||||
id: orderId,
|
||||
status: Schema.OrderStatus.STATUS_PARKED,
|
||||
});
|
||||
cy.get(`[row-id=${orderId}] [col-id=${orderStatus}]`).should(
|
||||
cy.get(`[data-testid=order-status-${orderId}]`).should(
|
||||
'have.text',
|
||||
'Parked'
|
||||
);
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||
import { generateLedgerEntries } from '../support/mocks/generate-ledger-entries';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
import { generateAssets } from '../support/mocks/generate-assets';
|
||||
import { generateMarkets } from '../support/mocks/generate-markets';
|
||||
|
||||
@ -16,7 +15,7 @@ describe('Portfolio page', { tags: '@smoke' }, () => {
|
||||
describe('Ledger entries', () => {
|
||||
it('List should be properly rendered', () => {
|
||||
cy.visit('/#/portfolio');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
cy.getByTestId('"Ledger entries"').click();
|
||||
const headers = [
|
||||
'Sender',
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.mockTradingPage();
|
||||
|
||||
@ -12,13 +10,13 @@ describe('positions', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('Positions').click();
|
||||
cy.getByTestId('tab-positions').contains('Please connect Vega wallet');
|
||||
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
validatePositionsDisplayed();
|
||||
});
|
||||
|
||||
it('renders positions on portfolio page', () => {
|
||||
cy.visit('/#/portfolio');
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
validatePositionsDisplayed();
|
||||
});
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
import { connectEthereumWallet } from '../support/ethereum-wallet';
|
||||
import { connectVegaWallet } from '../support/vega-wallet';
|
||||
|
||||
describe('withdraw', { tags: '@smoke' }, () => {
|
||||
const formFieldError = 'input-error-text';
|
||||
const toAddressField = 'input[name="to"]';
|
||||
const assetSelectField = 'select[name="asset"]';
|
||||
const amountField = 'input[name="amount"]';
|
||||
const useMaximumAmount = 'use-maximum';
|
||||
const submitWithdrawBtn = 'submit-withdrawal';
|
||||
const ethAddressValue = Cypress.env('ETHEREUM_WALLET_ADDRESS');
|
||||
const asset1Name = 'Sepolia tBTC';
|
||||
const asset2Name = 'Euro';
|
||||
const formFieldError = 'input-error-text';
|
||||
const toAddressField = 'input[name="to"]';
|
||||
const assetSelectField = 'select[name="asset"]';
|
||||
const amountField = 'input[name="amount"]';
|
||||
const useMaximumAmount = 'use-maximum';
|
||||
const submitWithdrawBtn = 'submit-withdrawal';
|
||||
const ethAddressValue = Cypress.env('ETHEREUM_WALLET_ADDRESS');
|
||||
const asset1Name = 'Sepolia tBTC';
|
||||
const asset2Name = 'Euro';
|
||||
|
||||
beforeEach(() => {
|
||||
describe('withdraw form validation', { tags: '@smoke' }, () => {
|
||||
before(() => {
|
||||
cy.mockWeb3Provider();
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription();
|
||||
@ -21,7 +20,7 @@ describe('withdraw', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('Withdrawals').click();
|
||||
|
||||
// Withdraw page requires vega wallet connection
|
||||
connectVegaWallet();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
// It also requires connection Ethereum wallet
|
||||
connectEthereumWallet();
|
||||
@ -31,7 +30,7 @@ describe('withdraw', { tags: '@smoke' }, () => {
|
||||
cy.wait('@Assets');
|
||||
});
|
||||
|
||||
it('form validation', () => {
|
||||
it('empty fields', () => {
|
||||
cy.getByTestId(submitWithdrawBtn).click();
|
||||
|
||||
cy.getByTestId(formFieldError).should('contain.text', 'Required');
|
||||
@ -65,17 +64,30 @@ describe('withdraw', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId(useMaximumAmount).click();
|
||||
cy.get(amountField).should('have.value', '1000.00000');
|
||||
});
|
||||
});
|
||||
|
||||
describe('withdraw actions', { tags: '@regression' }, () => {
|
||||
before(() => {
|
||||
cy.mockWeb3Provider();
|
||||
cy.mockTradingPage();
|
||||
cy.mockGQLSubscription();
|
||||
|
||||
cy.visit('/#/portfolio');
|
||||
cy.getByTestId('Withdrawals').click();
|
||||
|
||||
// Withdraw page requires vega wallet connection
|
||||
cy.connectVegaWallet();
|
||||
|
||||
// It also requires connection Ethereum wallet
|
||||
connectEthereumWallet();
|
||||
|
||||
cy.getByTestId('withdraw-dialog-button').click();
|
||||
cy.wait('@Accounts');
|
||||
cy.wait('@Assets');
|
||||
cy.mockVegaWalletTransaction();
|
||||
});
|
||||
|
||||
it('triggers transaction when submitted', () => {
|
||||
cy.mockVegaCommandSync({
|
||||
txHash: 'test-tx-hash',
|
||||
tx: {
|
||||
signature: {
|
||||
value:
|
||||
'd86138bba739bbc1069b3dc975d20b3a1517c2b9bdd401c70eeb1a0ecbc502ec268cf3129824841178b8b506b0b7d650c76644dbd96f524a6cb2158fb7121800',
|
||||
},
|
||||
},
|
||||
});
|
||||
selectAsset(asset1Name);
|
||||
cy.getByTestId('BALANCE_AVAILABLE_label').should(
|
||||
'contain.text',
|
||||
@ -102,13 +114,13 @@ describe('withdraw', { tags: '@smoke' }, () => {
|
||||
|
||||
it.skip('creates a withdrawal on submit'); // Needs capsule
|
||||
it.skip('creates a withdrawal on submit and prompts to complete withdrawal'); // Needs capsule
|
||||
|
||||
const selectAsset = (assetName: string) => {
|
||||
cy.get(assetSelectField).select(assetName);
|
||||
// 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(1000);
|
||||
};
|
||||
});
|
||||
|
||||
const selectAsset = (assetName: string) => {
|
||||
cy.get(assetSelectField).select(assetName);
|
||||
// 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);
|
||||
};
|
||||
|
75
apps/trading-e2e/src/support/deal-ticket-transaction.ts
Normal file
75
apps/trading-e2e/src/support/deal-ticket-transaction.ts
Normal file
@ -0,0 +1,75 @@
|
||||
import { ethers } from 'ethers';
|
||||
import type {
|
||||
Transaction,
|
||||
OrderSubmissionBody,
|
||||
OrderSubmission,
|
||||
} from '@vegaprotocol/wallet';
|
||||
|
||||
const orderSizeField = 'order-size';
|
||||
const orderPriceField = 'order-price';
|
||||
const orderTIFDropDown = 'order-tif';
|
||||
const placeOrderBtn = 'place-order';
|
||||
const dialogTitle = 'dialog-title';
|
||||
const orderTransactionHash = 'tx-block-explorer';
|
||||
|
||||
/**
|
||||
* Base64 encode a transaction object
|
||||
*/
|
||||
const encodeTransaction = (tx: Transaction): string => {
|
||||
return ethers.utils.base64.encode(
|
||||
ethers.utils.toUtf8Bytes(JSON.stringify(tx))
|
||||
);
|
||||
};
|
||||
|
||||
export const testOrder = (
|
||||
order: OrderSubmission,
|
||||
expected?: Partial<OrderSubmission>
|
||||
) => {
|
||||
const { type, side, size, price, timeInForce, expiresAt } = order;
|
||||
|
||||
cy.getByTestId(`order-type-${type}`).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');
|
||||
}
|
||||
// select expiry
|
||||
cy.getByTestId('date-picker-field').type(expiresAt);
|
||||
}
|
||||
cy.getByTestId(placeOrderBtn).click();
|
||||
|
||||
const expectedOrder = {
|
||||
...order,
|
||||
...expected,
|
||||
};
|
||||
|
||||
expectedOrder.expiresAt = expectedOrder.expiresAt || undefined;
|
||||
expectedOrder.price = expectedOrder.price || undefined;
|
||||
|
||||
const transaction: OrderSubmissionBody = {
|
||||
orderSubmission: expectedOrder,
|
||||
};
|
||||
|
||||
cy.wait('@VegaWalletTransaction')
|
||||
.its('request.body.params')
|
||||
.should('deep.equal', {
|
||||
token: JSON.parse(localStorage.getItem('vega_wallet_config') || '{}')
|
||||
?.token,
|
||||
publicKey: Cypress.env('VEGA_PUBLIC_KEY2'),
|
||||
sendingMode: 'TYPE_SYNC',
|
||||
encodedTransaction: encodeTransaction(transaction),
|
||||
});
|
||||
cy.getByTestId(dialogTitle).should(
|
||||
'have.text',
|
||||
'Awaiting network confirmation'
|
||||
);
|
||||
cy.getByTestId(orderTransactionHash)
|
||||
.invoke('attr', 'href')
|
||||
.should('include', `${Cypress.env('EXPLORER_URL')}/txs/0xtest-tx-hash`);
|
||||
cy.getByTestId('dialog-close').click();
|
||||
};
|
@ -46,7 +46,7 @@ export const generateFills = (
|
||||
|
||||
const defaultResult: FillsQuery = {
|
||||
party: {
|
||||
id: 'buyer-id',
|
||||
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
tradesConnection: {
|
||||
__typename: 'TradeConnection',
|
||||
edges: fills.map((f) => {
|
||||
|
@ -4,7 +4,6 @@ import type { CyHttpMessages } from 'cypress/types/net-stubbing';
|
||||
import { generateAccounts } from './mocks/generate-accounts';
|
||||
import { generateAsset, generateAssets } from './mocks/generate-assets';
|
||||
import { generateCandles } from './mocks/generate-candles';
|
||||
import { generateChainId } from './mocks/generate-chain-id';
|
||||
import { generateChart } from './mocks/generate-chart';
|
||||
import { generateMarket, generateMarketData } from './mocks/generate-market';
|
||||
import { generateMarketDepth } from './mocks/generate-market-depth';
|
||||
@ -17,7 +16,6 @@ import {
|
||||
import { generateNetworkParameters } from './mocks/generate-network-parameters';
|
||||
import { generateOrders } from './mocks/generate-orders';
|
||||
import { generateMargins, generatePositions } from './mocks/generate-positions';
|
||||
import { generateStatistics } from './mocks/generate-statistics';
|
||||
import { generateTrades } from './mocks/generate-trades';
|
||||
import { generateWithdrawals } from './mocks/generate-withdrawals';
|
||||
import {
|
||||
@ -27,6 +25,8 @@ import {
|
||||
generatePartyMarketData,
|
||||
} from './mocks/generate-fees';
|
||||
import { generateMarketProposals } from './mocks/generate-proposals';
|
||||
import { generateStatistics } from './mocks/generate-statistics';
|
||||
import { generateChainId } from './mocks/generate-chain-id';
|
||||
|
||||
const mockTradingPage = (
|
||||
req: CyHttpMessages.IncomingHttpRequest,
|
||||
@ -34,6 +34,7 @@ const mockTradingPage = (
|
||||
tradingMode?: Schema.MarketTradingMode,
|
||||
trigger?: Schema.AuctionTrigger
|
||||
) => {
|
||||
// Skipped, to allow v2 wallet connection in tests
|
||||
aliasQuery(req, 'ChainId', generateChainId());
|
||||
aliasQuery(req, 'Statistics', generateStatistics());
|
||||
aliasQuery(
|
||||
|
@ -1,14 +0,0 @@
|
||||
export const connectVegaWallet = () => {
|
||||
const form = 'rest-connector-form';
|
||||
const manageVegaBtn = 'manage-vega-wallet';
|
||||
const walletName = Cypress.env('TRADING_TEST_VEGA_WALLET_NAME');
|
||||
const walletPassphrase = Cypress.env('TRADING_TEST_VEGA_WALLET_PASSPHRASE');
|
||||
cy.getByTestId('connect-vega-wallet').click();
|
||||
cy.getByTestId('connectors-list')
|
||||
.find('[data-testid="connector-gui"]')
|
||||
.click();
|
||||
cy.getByTestId(form).find('#wallet').click().type(walletName);
|
||||
cy.getByTestId(form).find('#passphrase').click().type(walletPassphrase);
|
||||
cy.getByTestId('rest-connector-form').find('button[type=submit]').click();
|
||||
cy.getByTestId(manageVegaBtn).should('exist');
|
||||
};
|
@ -3,7 +3,6 @@ import {
|
||||
addMockGQLCommand,
|
||||
addMockGQLSubscriptionCommand,
|
||||
} from './lib/commands/mock-gql';
|
||||
import { addMockVegaWalletCommands } from './lib/commands/mock-vega-wallet';
|
||||
import { addMockWeb3ProviderCommand } from './lib/commands/mock-web3-provider';
|
||||
import { addSlackCommand } from './lib/commands/slack';
|
||||
import { addHighlightLog } from './lib/commands/highlight-log';
|
||||
@ -13,12 +12,12 @@ import { addContainsExactly } from './lib/commands/contains-exactly';
|
||||
import { addGetNetworkParameters } from './lib/commands/get-network-parameters';
|
||||
import { addUpdateCapsuleMultiSig } from './lib/commands/add-validators-to-multisig';
|
||||
import { addVegaWalletConnect } from './lib/commands/vega-wallet-connect';
|
||||
import { addMockTransactionResponse } from './lib/commands/mock-transaction-response';
|
||||
|
||||
addGetTestIdcommand();
|
||||
addSlackCommand();
|
||||
addMockGQLCommand();
|
||||
addMockGQLSubscriptionCommand();
|
||||
addMockVegaWalletCommands();
|
||||
addMockWeb3ProviderCommand();
|
||||
addHighlightLog();
|
||||
addVegaWalletReceiveFaucetedAsset();
|
||||
@ -27,6 +26,7 @@ addContainsExactly();
|
||||
addGetNetworkParameters();
|
||||
addUpdateCapsuleMultiSig();
|
||||
addVegaWalletConnect();
|
||||
addMockTransactionResponse();
|
||||
|
||||
export * from './lib/graphql-test-utils';
|
||||
export type { onMessage } from './lib/commands/mock-gql';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { V1TransactionResponse } from '@vegaprotocol/wallet';
|
||||
import type { TransactionResponse } from '@vegaprotocol/wallet';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
|
||||
declare global {
|
||||
@ -7,32 +7,35 @@ declare global {
|
||||
namespace Cypress {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface Chainable<Subject> {
|
||||
mockVegaCommandSync(override: PartialDeep<V1TransactionResponse>): void;
|
||||
mockVegaWalletTransaction(
|
||||
override?: PartialDeep<TransactionResponse>
|
||||
): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function addMockVegaWalletCommands() {
|
||||
export function addMockTransactionResponse() {
|
||||
Cypress.Commands.add(
|
||||
'mockVegaCommandSync',
|
||||
(override?: PartialDeep<V1TransactionResponse>) => {
|
||||
'mockVegaWalletTransaction',
|
||||
(override?: PartialDeep<TransactionResponse>) => {
|
||||
const defaultTransactionResponse = {
|
||||
txHash: 'tx-hash',
|
||||
transactionHash: 'test-tx-hash',
|
||||
sentAt: new Date().toISOString(),
|
||||
receivedAt: new Date().toISOString(),
|
||||
tx: {
|
||||
transaction: {
|
||||
input_data:
|
||||
'CPe6vpiqsPqxDBDC1w7KPkoKQGE4Y2M0NjUwMjhiMGY4OTM4YTYzZTEzNDViYzM2ODc3ZWRmODg4MjNmOWU0ZmI4ZDRlN2VkMmFlMzAwNzA3ZTMYASABKAM4Ag==',
|
||||
signature: {
|
||||
// sig value needs to be 'real' so sigToId function doesn't error out
|
||||
value: 'signature',
|
||||
value:
|
||||
'd86138bba739bbc1069b3dc975d20b3a1517c2b9bdd401c70eeb1a0ecbc502ec268cf3129824841178b8b506b0b7d650c76644dbd96f524a6cb2158fb7121800',
|
||||
algo: 'vega/ed25519',
|
||||
version: 1,
|
||||
},
|
||||
From: {
|
||||
PubKey: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||
},
|
||||
version: 2,
|
||||
version: 3,
|
||||
pow: {
|
||||
tid: '0CEEC2FDFDB5D68BC0C1E2640440E4AA11E49986CB2929E0F3572E16CB7DC59C',
|
||||
nonce: 23525,
|
||||
@ -40,9 +43,13 @@ export function addMockVegaWalletCommands() {
|
||||
},
|
||||
};
|
||||
|
||||
cy.intercept('POST', 'http://localhost:1789/api/v1/command/sync', {
|
||||
body: merge(defaultTransactionResponse, override),
|
||||
}).as('VegaCommandSync');
|
||||
cy.intercept('POST', 'http://localhost:1789/api/v2/requests', {
|
||||
body: {
|
||||
jsonrpc: '2.0',
|
||||
result: merge(defaultTransactionResponse, override),
|
||||
id: '1',
|
||||
},
|
||||
}).as('VegaWalletTransaction');
|
||||
}
|
||||
);
|
||||
}
|
@ -20,6 +20,7 @@ export function addVegaWalletConnect() {
|
||||
'contain.text',
|
||||
'Successfully connected'
|
||||
);
|
||||
cy.getByTestId('dialog-close').click();
|
||||
cy.get('[data-testid=dialog-content]').should('not.exist');
|
||||
});
|
||||
}
|
||||
|
@ -259,6 +259,17 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
}
|
||||
return value ? OrderStatusMapping[value] : '';
|
||||
}}
|
||||
cellRenderer={({
|
||||
valueFormatted,
|
||||
data,
|
||||
}: {
|
||||
valueFormatted: string;
|
||||
data: Order;
|
||||
}) => (
|
||||
<span data-testId={`order-status-${data?.id}`}>
|
||||
{valueFormatted}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
<AgGridColumn
|
||||
headerName={t('Filled')}
|
||||
|
@ -15,7 +15,7 @@ export interface UndelegateSubmissionBody {
|
||||
};
|
||||
}
|
||||
|
||||
interface OrderSubmission {
|
||||
export interface OrderSubmission {
|
||||
marketId: string;
|
||||
reference?: string;
|
||||
type: Schema.OrderType;
|
||||
|
@ -32,7 +32,12 @@ export const useJsonRpcConnect = (onConnect: () => void) => {
|
||||
setStatus(Status.GettingChainId);
|
||||
const chainIdResult = await connector.getChainId();
|
||||
|
||||
if (chainIdResult.chainID !== appChainId) {
|
||||
// Dont throw in when cypress is running as trading app relies on
|
||||
// mocks which result in a mismatch between chainId for app and
|
||||
// chainId for wallet
|
||||
const isTest = !('Cypress' in window);
|
||||
|
||||
if (chainIdResult.chainID !== appChainId && isTest) {
|
||||
// Throw wallet error for consitent error handling
|
||||
throw ClientErrors.WRONG_NETWORK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user