test: trading fills tab on accounts (#1168)

This commit is contained in:
Joe Tsang 2022-08-31 07:03:56 +01:00 committed by GitHub
parent 509a68d795
commit 3a3b5cbc9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,11 @@
import { aliasQuery } from '@vegaprotocol/cypress';
import { generateFill, generateFills } from '../support/mocks/generate-fills';
import { Side } from '@vegaprotocol/types';
import { MarketState } from '@vegaprotocol/types';
import { connectVegaWallet } from '../support/vega-wallet';
import { mockTradingPage } from '../support/trading';
import { generateNetworkParameters } from '../support/mocks/generate-network-parameters';
describe('fills', () => {
before(() => {
const fills = [
generateFill({
buyer: {
@ -57,20 +57,36 @@ describe('fills', () => {
},
},
});
describe('fills', () => {
beforeEach(() => {
cy.mockGQL((req) => {
aliasQuery(req, 'Fills', result);
aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters());
});
cy.visit('/portfolio');
cy.get('main[data-testid="portfolio"]').should('exist');
});
it('renders fills', () => {
it('renders fills on portfolio page', () => {
cy.visit('/portfolio');
cy.get('main[data-testid="portfolio"]').should('exist');
cy.getByTestId('Fills').click();
cy.getByTestId('tab-fills').contains('Connect your Vega wallet');
connectVegaWallet();
validateFillsDisplayed();
});
it('renders fills on trading tab', () => {
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);
});
cy.visit('/markets/market-0');
cy.getByTestId('Fills').click();
cy.getByTestId('tab-fills').contains('Please connect Vega wallet');
connectVegaWallet();
validateFillsDisplayed();
});
function validateFillsDisplayed() {
cy.getByTestId('tab-fills').should('be.visible');
cy.getByTestId('tab-fills')
@ -118,5 +134,5 @@ describe('fills', () => {
cy.wrap($tradeDateTime).invoke('text').should('match', dateTimeRegex);
}
});
});
}
});