Test/637 settlement expiry (#1209)

* test: add test for settlement expiry

* chore: change before each hook

* chore: correct d.p. in deal ticket query
This commit is contained in:
Joe Tsang 2022-09-01 13:24:16 +01:00 committed by GitHub
parent acbbd03716
commit 2a0f79d1d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 8 deletions

View File

@ -29,6 +29,7 @@ module.exports = defineConfig({
defaultCommandTimeout: 10000, defaultCommandTimeout: 10000,
viewportWidth: 1440, viewportWidth: 1440,
viewportHeight: 900, viewportHeight: 900,
responseTimeout: 10000,
}, },
env: { env: {
TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test', TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test',

View File

@ -9,11 +9,11 @@ describe('markets table', () => {
mockTradingPage(req, MarketState.STATE_ACTIVE); mockTradingPage(req, MarketState.STATE_ACTIVE);
aliasQuery(req, 'MarketList', generateMarketList()); aliasQuery(req, 'MarketList', generateMarketList());
}); });
cy.visit('/');
cy.wait('@MarketList', { timeout: 5000 });
}); });
it('renders markets correctly', () => { it('renders markets correctly', () => {
cy.visit('/');
cy.wait('@MarketList');
cy.get('[data-testid^="market-link-"]') cy.get('[data-testid^="market-link-"]')
.should('not.be.empty') .should('not.be.empty')
.and('have.attr', 'href'); .and('have.attr', 'href');
@ -25,6 +25,8 @@ describe('markets table', () => {
}); });
it('renders market list drop down', () => { it('renders market list drop down', () => {
cy.visit('/');
cy.wait('@MarketList');
openMarketDropDown(); openMarketDropDown();
cy.getByTestId('price').invoke('text').should('not.be.empty'); cy.getByTestId('price').invoke('text').should('not.be.empty');
cy.getByTestId('trading-mode').should('not.be.empty'); cy.getByTestId('trading-mode').should('not.be.empty');
@ -34,6 +36,8 @@ describe('markets table', () => {
}); });
it('Able to select market from dropdown', () => { it('Able to select market from dropdown', () => {
cy.visit('/');
cy.wait('@MarketList');
openMarketDropDown(); openMarketDropDown();
cy.getByTestId('market-link-market-0').should('be.visible').click(); cy.getByTestId('market-link-market-0').should('be.visible').click();
@ -43,6 +47,22 @@ describe('markets table', () => {
verifyMarketSummaryDisplayed(); verifyMarketSummaryDisplayed();
}); });
it('Settlement expiry is displayed', () => {
cy.visit('/markets/market-0');
cy.wait('@Market');
cy.getByTestId('trading-expiry')
.should('have.text', 'Not time-based')
.realHover();
cy.getByTestId('expiry-tool-tip').should(
'contain.text',
'This market expires when triggered by its oracle, not on a set date.'
);
cy.getByTestId('link')
.should('have.attr', 'href')
.and('include', 'https://explorer.fairground.wtf/');
});
it('Auction conditions are displayed', () => { it('Auction conditions are displayed', () => {
const toolTipLabel = 'tooltip-label'; const toolTipLabel = 'tooltip-label';
const toolTipValue = 'tooltip-value'; const toolTipValue = 'tooltip-value';
@ -55,10 +75,6 @@ describe('markets table', () => {
'Est uncrossing vol', 'Est uncrossing vol',
]; ];
cy.mockGQL((req) => {
mockTradingPage(req, MarketState.STATE_ACTIVE);
});
cy.visit('/markets/market-0'); cy.visit('/markets/market-0');
cy.wait('@Market'); cy.wait('@Market');

View File

@ -33,6 +33,7 @@ describe('deal ticket orders', () => {
mockTradingPage(req, MarketState.STATE_ACTIVE); mockTradingPage(req, MarketState.STATE_ACTIVE);
}); });
cy.visit('/markets/market-0'); cy.visit('/markets/market-0');
cy.wait('@Market');
connectVegaWallet(); connectVegaWallet();
}); });

View File

@ -11,7 +11,7 @@ export const generateDealTicketQuery = (
__typename: 'Market', __typename: 'Market',
id: 'market-0', id: 'market-0',
name: 'ETHBTC Quarterly (30 Jun 2022)', name: 'ETHBTC Quarterly (30 Jun 2022)',
decimalPlaces: 2, decimalPlaces: 5,
positionDecimalPlaces: 0, positionDecimalPlaces: 0,
state: MarketState.STATE_ACTIVE, state: MarketState.STATE_ACTIVE,
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,

View File

@ -92,7 +92,7 @@ const ExpiryTooltipContent = ({
return ( return (
<> <>
<p className="mb-2"> <p data-testid="expiry-tool-tip" className="mb-2">
{t( {t(
'This market expires when triggered by its oracle, not on a set date.' 'This market expires when triggered by its oracle, not on a set date.'
)} )}