test(trading): update e2e tests for acs - closed all and proposed markets (#4094)

This commit is contained in:
daro-maj 2023-06-14 16:00:04 +02:00 committed by GitHub
parent d775573543
commit bdf1663709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 16 deletions

View File

@ -450,3 +450,17 @@ describe('Closed markets', { tags: '@smoke' }, () => {
.should('have.text', 'View on Explorer'); .should('have.text', 'View on Explorer');
}); });
}); });
describe('no closed markets', { tags: '@smoke', testIsolation: true }, () => {
before(() => {
cy.mockTradingPage();
cy.mockSubscription();
cy.visit('/#/markets/all');
cy.get('[data-testid="Closed markets"]').click();
});
it('can see no markets message', () => {
// 6001-MARK-034
cy.getByTestId('tab-closed-markets').should('contain.text', 'No markets');
});
});

View File

@ -1,7 +1,10 @@
import { aliasGQLQuery } from '@vegaprotocol/cypress';
import type { MarketsQuery } from '@vegaprotocol/markets';
import * as Schema from '@vegaprotocol/types'; import * as Schema from '@vegaprotocol/types';
const rowSelector = const rowSelector =
'[data-testid="tab-all-markets"] .ag-center-cols-container .ag-row'; '[data-testid="tab-all-markets"] .ag-center-cols-container .ag-row';
const colInstrumentCode = '[col-id="tradableInstrument.instrument.code"]';
describe('markets all table', { tags: '@smoke' }, () => { describe('markets all table', { tags: '@smoke' }, () => {
beforeEach(() => { beforeEach(() => {
@ -60,7 +63,7 @@ describe('markets all table', { tags: '@smoke' }, () => {
// 6001-MARK-035 // 6001-MARK-035
cy.get(rowSelector) cy.get(rowSelector)
.first() .first()
.find('[col-id="tradableInstrument.instrument.code"]') .find(colInstrumentCode)
.should('have.text', 'SOLUSD'); .should('have.text', 'SOLUSD');
// 6001-MARK-036 // 6001-MARK-036
@ -155,6 +158,7 @@ describe('markets all table', { tags: '@smoke' }, () => {
}); });
it('able to open and sort full market list - market page', () => { it('able to open and sort full market list - market page', () => {
// 6001-MARK-064
const ExpectedSortedMarkets = [ const ExpectedSortedMarkets = [
'AAPL.MF21', 'AAPL.MF21',
'BTCUSD.MF21', 'BTCUSD.MF21',
@ -167,8 +171,38 @@ describe('markets all table', { tags: '@smoke' }, () => {
cy.get('.ag-header-cell-label').contains('Market').click(); // sort by market name cy.get('.ag-header-cell-label').contains('Market').click(); // sort by market name
for (let i = 0; i < ExpectedSortedMarkets.length; i++) { for (let i = 0; i < ExpectedSortedMarkets.length; i++) {
cy.get(`[row-index=${i}]`) cy.get(`[row-index=${i}]`)
.find('[col-id="tradableInstrument.instrument.code"]') .find(colInstrumentCode)
.should('have.text', ExpectedSortedMarkets[i]); .should('have.text', ExpectedSortedMarkets[i]);
} }
}); });
it('can drag and drop columns', () => {
// 6001-MARK-065
cy.get('.ag-overlay-loading-wrapper').should('not.be.visible');
cy.get(colInstrumentCode)
.realMouseDown()
.realMouseMove(700, 15)
.realMouseUp();
cy.get(colInstrumentCode).should(($element) => {
const attributeValue = $element.attr('aria-colindex');
expect(attributeValue).not.to.equal('1');
});
});
});
describe('no all markets', { tags: '@smoke', testIsolation: true }, () => {
before(() => {
cy.mockTradingPage();
const markets: MarketsQuery = {};
cy.mockGQL((req) => {
aliasGQLQuery(req, 'Markets', markets);
});
cy.mockSubscription();
cy.visit('/#/markets/all');
});
it('can see no markets message', () => {
// 6001-MARK-048
cy.getByTestId('tab-all-markets').should('contain.text', 'No markets');
});
}); });

View File

@ -25,6 +25,7 @@ describe('markets selector', { tags: '@smoke' }, () => {
cy.wait('@MarketsCandles'); cy.wait('@MarketsCandles');
}); });
// 6001-MARK-066
it('can toggle the sidebar', () => { it('can toggle the sidebar', () => {
cy.getByTestId('market-selector').should('be.visible'); cy.getByTestId('market-selector').should('be.visible');
cy.getByTestId('sidebar-toggle').click(); cy.getByTestId('sidebar-toggle').click();
@ -84,7 +85,7 @@ describe('markets selector', { tags: '@smoke' }, () => {
}); });
}); });
// 6001-MARK-27 // 6001-MARK-027
it('can use the filter options', () => { it('can use the filter options', () => {
// product type // product type
cy.getByTestId('product-Spot').click(); cy.getByTestId('product-Spot').click();
@ -94,7 +95,7 @@ describe('markets selector', { tags: '@smoke' }, () => {
cy.getByTestId('product-Future').click(); cy.getByTestId('product-Future').click();
cy.getByTestId(list).find('a').should('have.length', 4); cy.getByTestId(list).find('a').should('have.length', 4);
// 6001-MARK-29 // 6001-MARK-029
cy.getByTestId(searchInput).clear().type('btc'); cy.getByTestId(searchInput).clear().type('btc');
cy.getByTestId(list).find('a').should('have.length', 2); cy.getByTestId(list).find('a').should('have.length', 2);
cy.getByTestId(list).find('a').eq(1).contains('BTCUSD.MF21'); cy.getByTestId(list).find('a').eq(1).contains('BTCUSD.MF21');

View File

@ -1,17 +1,17 @@
import { checkSorting } from '@vegaprotocol/cypress'; import { aliasGQLQuery, checkSorting } from '@vegaprotocol/cypress';
import type { ProposalsListQuery } from '@vegaprotocol/proposals';
const rowSelector = const rowSelector =
'[data-testid="tab-proposed-markets"] .ag-center-cols-container .ag-row'; '[data-testid="tab-proposed-markets"] .ag-center-cols-container .ag-row';
const colMarketId = '[col-id="market"]';
describe('markets proposed table', { tags: '@smoke' }, () => { describe('markets proposed table', { tags: '@smoke' }, () => {
beforeEach(() => { before(() => {
cy.clearLocalStorage().then(() => {
cy.mockTradingPage(); cy.mockTradingPage();
cy.mockSubscription(); cy.mockSubscription();
cy.visit('/#/markets/all'); cy.visit('/#/markets/all');
cy.get('[data-testid="Proposed markets"]').click(); cy.get('[data-testid="Proposed markets"]').click();
}); });
});
it('can see table headers', () => { it('can see table headers', () => {
const headers = [ const headers = [
@ -35,10 +35,7 @@ describe('markets proposed table', { tags: '@smoke' }, () => {
it('renders markets correctly', () => { it('renders markets correctly', () => {
// 6001-MARK-049 // 6001-MARK-049
cy.get(rowSelector) cy.get(rowSelector).first().find(colMarketId).should('have.text', 'ETHUSD');
.first()
.find('[col-id="market"]')
.should('have.text', 'ETHUSD');
// 6001-MARK-050 // 6001-MARK-050
cy.get(rowSelector) cy.get(rowSelector)
@ -119,6 +116,7 @@ describe('markets proposed table', { tags: '@smoke' }, () => {
); );
}); });
it('proposed markets tab should be sorted properly', () => { it('proposed markets tab should be sorted properly', () => {
// 6001-MARK-062
cy.get('[data-testid="Proposed markets"]').click({ force: true }); cy.get('[data-testid="Proposed markets"]').click({ force: true });
const marketColDefault = [ const marketColDefault = [
'ETHUSD', 'ETHUSD',
@ -196,4 +194,31 @@ describe('markets proposed table', { tags: '@smoke' }, () => {
]; ];
checkSorting('state', stateColDefault, stateColAsc, stateColDesc); checkSorting('state', stateColDefault, stateColAsc, stateColDesc);
}); });
it('can drag and drop columns', () => {
// 6001-MARK-063
cy.get(colMarketId).realMouseDown().realMouseMove(700, 15).realMouseUp();
cy.get(colMarketId).should(($element) => {
const attributeValue = $element.attr('aria-colindex');
expect(attributeValue).not.to.equal('1');
});
});
});
describe('no markets proposed', { tags: '@smoke', testIsolation: true }, () => {
before(() => {
cy.mockTradingPage();
const proposal: ProposalsListQuery = {};
cy.mockGQL((req) => {
aliasGQLQuery(req, 'ProposalsList', proposal);
});
cy.mockSubscription();
cy.visit('/#/markets/all');
cy.get('[data-testid="Proposed markets"]').click();
});
it('can see no markets message', () => {
// 6001-MARK-061
cy.getByTestId('tab-proposed-markets').should('contain.text', 'No markets');
});
}); });