ac16ca9ee5
* test: add tags for slow tests * chore: remove old flows * test: added smoke tags to view tests * test: add tags for trading tests * test: tags for explorer tests added * chore: add tags to remaining tests and tidy files * chore: pass env in test command * chore: fix build errors * chore: re-add teardown for manual flow * chore: ability to only run smoke tests in manual flow * chore: fix manual input flow
88 lines
2.9 KiB
TypeScript
88 lines
2.9 KiB
TypeScript
import { aliasQuery } from '@vegaprotocol/cypress';
|
|
import { generateFills } from '../support/mocks/generate-fills';
|
|
import { MarketState } from '@vegaprotocol/types';
|
|
import { connectVegaWallet } from '../support/vega-wallet';
|
|
import { mockTradingPage } from '../support/trading';
|
|
|
|
describe('fills', { tags: '@regression' }, () => {
|
|
beforeEach(() => {
|
|
cy.mockGQL((req) => {
|
|
mockTradingPage(req, MarketState.STATE_ACTIVE);
|
|
aliasQuery(req, 'Fills', generateFills());
|
|
});
|
|
cy.mockGQLSubscription();
|
|
});
|
|
|
|
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')
|
|
.get(
|
|
'[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]'
|
|
)
|
|
.each(($marketSymbol) => {
|
|
cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
|
|
});
|
|
cy.getByTestId('tab-fills')
|
|
.get('[role="gridcell"][col-id="size"]')
|
|
.each(($amount) => {
|
|
cy.wrap($amount).invoke('text').should('not.be.empty');
|
|
});
|
|
cy.getByTestId('tab-positions')
|
|
.get('[role="gridcell"][col-id="price"]')
|
|
.each(($prices) => {
|
|
cy.wrap($prices).invoke('text').should('not.be.empty');
|
|
});
|
|
cy.getByTestId('tab-positions')
|
|
.get('[role="gridcell"][col-id="price_1"]')
|
|
.each(($total) => {
|
|
cy.wrap($total).invoke('text').should('not.be.empty');
|
|
});
|
|
cy.getByTestId('tab-positions')
|
|
.get('[role="gridcell"][col-id="aggressor"]')
|
|
.each(($role) => {
|
|
cy.wrap($role)
|
|
.invoke('text')
|
|
.then((text) => {
|
|
const roles = ['Maker', 'Taker'];
|
|
expect(roles.indexOf(text.trim())).to.be.greaterThan(-1);
|
|
});
|
|
});
|
|
cy.getByTestId('tab-positions')
|
|
.get(
|
|
'[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]'
|
|
)
|
|
.each(($fees) => {
|
|
cy.wrap($fees).invoke('text').should('not.be.empty');
|
|
});
|
|
const dateTimeRegex =
|
|
/(\d{1,2})\/(\d{1,2})\/(\d{4}), (\d{1,2}):(\d{1,2}):(\d{1,2})/gm;
|
|
cy.get('[col-id="createdAt"]').each(($tradeDateTime, index) => {
|
|
if (index != 0) {
|
|
//ignore header
|
|
cy.wrap($tradeDateTime).invoke('text').should('match', dateTimeRegex);
|
|
}
|
|
});
|
|
}
|
|
});
|