test(trading): tests for ac - 7005-FILL-fills (#3529)

This commit is contained in:
daro-maj 2023-04-25 10:19:37 +02:00 committed by GitHub
parent b9869da492
commit f589f4a9fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,18 @@
import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { aliasGQLQuery } from '@vegaprotocol/cypress';
import { fillsQuery } from '@vegaprotocol/mock'; import { fillsQuery } from '@vegaprotocol/mock';
const tabFills = 'tab-fills';
describe('fills', { tags: '@regression' }, () => { describe('fills', { tags: '@regression' }, () => {
// 7005-FILL-001
// 7005-FILL-002
// 7005-FILL-003
// 7005-FILL-004
// 7005-FILL-005
// 7005-FILL-006
// 7005-FILL-007
// 7005-FILL-008
beforeEach(() => { beforeEach(() => {
// Ensure page loads with correct key // Ensure page loads with correct key
cy.window().then((window) => { cy.window().then((window) => {
@ -38,31 +49,37 @@ describe('fills', { tags: '@regression' }, () => {
}); });
function validateFillsDisplayed() { function validateFillsDisplayed() {
cy.getByTestId('tab-fills').should('be.visible'); cy.getByTestId(tabFills).should('be.visible');
cy.getByTestId(tabFills).contains('Market');
cy.getByTestId('tab-fills') cy.getByTestId(tabFills)
.get( .get(
'[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]' '[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]'
) )
.each(($marketSymbol) => { .each(($marketSymbol) => {
cy.wrap($marketSymbol).invoke('text').should('not.be.empty'); cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
}); });
cy.getByTestId('tab-fills') cy.getByTestId(tabFills).contains('Size');
cy.get(`[col-id='size']`).eq(1).should('contain.text', '+');
cy.get(`[col-id='size']`).eq(2).should('contain.text', '-');
cy.getByTestId(tabFills)
.get('[role="gridcell"][col-id="size"]') .get('[role="gridcell"][col-id="size"]')
.each(($amount) => { .each(($amount) => {
cy.wrap($amount).invoke('text').should('not.be.empty'); cy.wrap($amount).invoke('text').should('not.be.empty');
}); });
cy.getByTestId('tab-fills') cy.getByTestId(tabFills).contains('Price');
cy.getByTestId(tabFills)
.get('[role="gridcell"][col-id="price"]') .get('[role="gridcell"][col-id="price"]')
.each(($prices) => { .each(($prices) => {
cy.wrap($prices).invoke('text').should('not.be.empty'); cy.wrap($prices).invoke('text').should('not.be.empty');
}); });
cy.getByTestId('tab-fills') cy.getByTestId(tabFills).contains('Notional');
cy.getByTestId(tabFills)
.get('[role="gridcell"][col-id="price_1"]') .get('[role="gridcell"][col-id="price_1"]')
.each(($total) => { .each(($total) => {
cy.wrap($total).invoke('text').should('not.be.empty'); cy.wrap($total).invoke('text').should('not.be.empty');
}); });
cy.getByTestId('tab-fills') cy.getByTestId(tabFills).contains('Role');
cy.getByTestId(tabFills)
.get('[role="gridcell"][col-id="aggressor"]') .get('[role="gridcell"][col-id="aggressor"]')
.each(($role) => { .each(($role) => {
cy.wrap($role) cy.wrap($role)
@ -72,13 +89,15 @@ describe('fills', { tags: '@regression' }, () => {
expect(roles.indexOf(text.trim())).to.be.greaterThan(-1); expect(roles.indexOf(text.trim())).to.be.greaterThan(-1);
}); });
}); });
cy.getByTestId('tab-fills') cy.getByTestId(tabFills).contains('Fee');
cy.getByTestId(tabFills)
.get( .get(
'[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]' '[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]'
) )
.each(($fees) => { .each(($fees) => {
cy.wrap($fees).invoke('text').should('not.be.empty'); cy.wrap($fees).invoke('text').should('not.be.empty');
}); });
cy.getByTestId(tabFills).contains('Date');
const dateTimeRegex = const dateTimeRegex =
/(\d{1,2})\/(\d{1,2})\/(\d{4}), (\d{1,2}):(\d{1,2}):(\d{1,2})/gm; /(\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) => { cy.get('[col-id="createdAt"]').each(($tradeDateTime, index) => {