2022-11-15 12:31:25 +00:00
|
|
|
import { Schema } from '@vegaprotocol/types';
|
2022-06-10 19:00:02 +00:00
|
|
|
|
2022-10-14 08:15:34 +00:00
|
|
|
describe('markets table', { tags: '@smoke' }, () => {
|
2022-06-10 19:00:02 +00:00
|
|
|
beforeEach(() => {
|
2022-10-19 11:14:52 +00:00
|
|
|
cy.mockTradingPage(
|
2022-11-15 12:31:25 +00:00
|
|
|
Schema.MarketState.STATE_ACTIVE,
|
|
|
|
Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION,
|
|
|
|
Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY
|
2022-10-19 11:14:52 +00:00
|
|
|
);
|
2022-09-22 09:15:20 +00:00
|
|
|
cy.mockGQLSubscription();
|
2022-09-01 12:24:16 +00:00
|
|
|
cy.visit('/');
|
feat: liquidity provisions view (#1133)
* feat(#473): add positions metrics data provider
* feat(#473) add positions stats
* feat(#473) add positions stats
* feat(#473): add positions stats
* feat(#473): add positions stats
* feat(#473): position metrics, test and refactoring
* feat(#473): add unit tests to positions table
* feat(#473): fix spelling, order positions by updated at desc
* feat(#473): protect from division by 0
* feat(#473): fix trading positions e2e tests
* feat(#473): fix e2e data mocks
* feat(#473): post code review clean up
* feat(#993): dependencies handling in data provider
* feat(#993): fix e2e tests data mocks
* feat(#993): remove position metrics mocks, add market data market id
* feat: #994 add price monitoring bounds and candles update interface
* fix: move best bid price to diff section
* feat(#993): add missing mocks, fix combine function
* fix: add insurance pool and calc volume 24h
* feat: display some oracle min info, asset id, insurance pool, move open interest and 24hVol
* fix: add market-info.cy.ts case
* fix: remove # from numbered price monitoring settings
* fix: add insurance pool test
* fix: format 24hvol
* feat(#993): set loading initially to true, add unit tests
* feat(#993): cleanup, add comments
* feat(#993): remove undefined from client type
* fix: remove indicativeVolume and oracleSpecBinding from market info
* feat(#993): cosmetic changes
* fix: add oracleSpecBinding back
* Update libs/deal-ticket/src/components/info-market.tsx
Co-authored-by: botond <105208209+notbot00@users.noreply.github.com>
* feat: add initial queries
* fix: memo yesterday's timestamp
* fix: add back info
* fix: update query
* fix: add view full oracle details link and update mappings
* fix: regen code, make link reactnode, fix index.ts
* feat: add liquidity lib, refactor info market
* fix: remove liquidity query from deal-ticket
* feat:(#993): pass informaton about update callback cause
* fix: small ui tweaks
* fix: display in grid
* feat: navigate to oracle by termination id
* feat: #491 add use liquidity provision merging
* fix: remove logs, add extra check on my liquidity provision
* fix: type number trivially inferred from a number literal, remove type annotation
* fix: cypress tests and formatting for market info
* Update libs/deal-ticket/src/components/market-info/info-market.tsx
* fix: use position decimal places for stake and market value proxy
* fix: #491 use size/position decimal places for obligation, supplied and commitment amount
* fix: add size component and use decimal places
* fix: update readme liquidity
* fix: #491 add correct asset decimal formatters
* Update libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx
Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com>
* fix: make link instead of button to open liquidity
* fix: #491 add liquidity page, link to trading mode tooltip, tabs hidden or choose active
* fix: remove LP dialog, use only link to page
* fix: add market id in LP view
* fix: follow trade grid design
* fix: add one line tabs , remove link styling, remove any, add value formatters
* fix: remove falsy check LP undefined
* fix: keep date formatter in LP table
* fix: add generic type market info, hooks in body function
* fix: revert number formatters
* fix: use one param only in network params query
* fix: use network param in web3 lib
* fix: move lp container to trading app
* fix: remove resizable panel
* feat: add header component, remove isEstimate
* chore: remove unnecessary type cast
* fix: fix build with children map clone element
* chore: lint
* fix: move use network params to react helpers
* fix: add const for LP tabs
* fix: fix formatting on LP page
* fix: only show tilde for liquidity monitoring auction end date
* fix: market id being rendered twice in market info
* chore: fix lint
* fix: types for generate withdraw form query
* chore: fix intermittent failing withdrawal test
* Update libs/deal-ticket/src/components/market-info/info-market.tsx
* chore: add another wait for market
Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
Co-authored-by: botond <105208209+notbot00@users.noreply.github.com>
Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Joe <joe@vega.xyz>
2022-09-07 11:05:28 +00:00
|
|
|
cy.wait('@Market');
|
2022-09-13 10:14:06 +00:00
|
|
|
cy.wait('@Markets');
|
2022-10-03 17:28:32 +00:00
|
|
|
cy.wait('@MarketsData');
|
|
|
|
cy.wait('@MarketsCandles');
|
2022-10-14 08:15:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('renders markets correctly', () => {
|
2022-09-30 13:42:42 +00:00
|
|
|
cy.get('[data-testid^="market-link-"]').should('not.be.empty');
|
2022-08-16 07:35:33 +00:00
|
|
|
cy.getByTestId('price').invoke('text').should('not.be.empty');
|
|
|
|
cy.getByTestId('settlement-asset').should('not.be.empty');
|
|
|
|
cy.getByTestId('price-change-percentage').should('not.be.empty');
|
|
|
|
cy.getByTestId('price-change').should('not.be.empty');
|
|
|
|
cy.getByTestId('sparkline-svg').should('be.visible');
|
2022-06-10 19:00:02 +00:00
|
|
|
});
|
|
|
|
|
2022-08-16 07:35:33 +00:00
|
|
|
it('renders market list drop down', () => {
|
|
|
|
openMarketDropDown();
|
|
|
|
cy.getByTestId('price').invoke('text').should('not.be.empty');
|
2022-10-12 07:55:23 +00:00
|
|
|
cy.getByTestId('trading-mode-col').should('not.be.empty');
|
2022-08-16 07:35:33 +00:00
|
|
|
cy.getByTestId('taker-fee').should('contain.text', '%');
|
|
|
|
cy.getByTestId('market-volume').should('not.be.empty');
|
|
|
|
cy.getByTestId('market-name').should('not.be.empty');
|
|
|
|
});
|
2022-06-10 19:00:02 +00:00
|
|
|
|
2022-10-28 12:41:33 +00:00
|
|
|
it('able to select market from dropdown', () => {
|
2022-08-16 07:35:33 +00:00
|
|
|
openMarketDropDown();
|
2022-10-28 12:41:33 +00:00
|
|
|
cy.getByTestId('market-link-market-0').first().should('be.visible').click();
|
2022-10-14 08:15:34 +00:00
|
|
|
cy.contains('ACTIVE MARKET').should('be.visible');
|
2022-06-10 19:00:02 +00:00
|
|
|
cy.url().should('include', '/markets/market-0');
|
2022-10-12 07:55:23 +00:00
|
|
|
cy.getByTestId('popover-trigger').should('not.be.empty');
|
2022-06-10 19:00:02 +00:00
|
|
|
});
|
2022-06-29 12:57:42 +00:00
|
|
|
|
2022-10-28 12:41:33 +00:00
|
|
|
it('able to open and sort full market list - market page', () => {
|
2022-09-02 14:31:30 +00:00
|
|
|
const ExpectedSortedMarkets = [
|
|
|
|
'AAPL.MF21',
|
|
|
|
'BTCUSD.MF21',
|
|
|
|
'ETHBTC.QM21',
|
|
|
|
'SOLUSD',
|
|
|
|
];
|
2022-11-08 00:53:43 +00:00
|
|
|
cy.getByTestId('view-market-list-link')
|
2022-11-08 07:23:38 +00:00
|
|
|
.should('have.attr', 'href', '#/markets')
|
2022-11-08 00:53:43 +00:00
|
|
|
.click();
|
2022-11-08 07:23:38 +00:00
|
|
|
cy.url().should('eq', Cypress.config('baseUrl') + '/#/markets');
|
2022-09-02 14:31:30 +00:00
|
|
|
cy.contains('AAPL.MF21').should('be.visible');
|
|
|
|
cy.contains('Market').click(); // sort by market name
|
|
|
|
for (let i = 0; i < ExpectedSortedMarkets.length; i++) {
|
|
|
|
cy.get(`[row-index=${i}]`)
|
|
|
|
.find('[col-id="tradableInstrument.instrument.code"]')
|
|
|
|
.should('have.text', ExpectedSortedMarkets[i]);
|
|
|
|
}
|
|
|
|
});
|
2022-11-16 14:36:03 +00:00
|
|
|
|
|
|
|
it('proposed markets tab should be rendered properly', () => {
|
|
|
|
cy.getByTestId('view-market-list-link')
|
|
|
|
.should('have.attr', 'href', '#/markets')
|
|
|
|
.click();
|
|
|
|
cy.get('[data-testid="Active markets"]').should(
|
|
|
|
'have.attr',
|
|
|
|
'data-state',
|
|
|
|
'active'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="Proposed markets"]').should(
|
|
|
|
'have.attr',
|
|
|
|
'data-state',
|
|
|
|
'inactive'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="Proposed markets"]').click();
|
|
|
|
cy.get('[data-testid="Proposed markets"]').should(
|
|
|
|
'have.attr',
|
|
|
|
'data-state',
|
|
|
|
'active'
|
|
|
|
);
|
|
|
|
cy.getByTestId('tab-proposed-markets').should('be.visible');
|
|
|
|
cy.get('.ag-body-viewport .ag-center-cols-container .ag-row').should(
|
|
|
|
'have.length',
|
|
|
|
10
|
|
|
|
);
|
|
|
|
cy.getByTestId('external-link')
|
2022-11-17 08:49:29 +00:00
|
|
|
.should('have.length', 11)
|
|
|
|
.last()
|
|
|
|
.should('have.text', 'Propose a new market')
|
|
|
|
.and(
|
|
|
|
'have.attr',
|
|
|
|
'href',
|
2022-11-22 10:52:31 +00:00
|
|
|
'https://stagnet3.token.vega.xyz/governance/propose/new-market'
|
2022-11-17 08:49:29 +00:00
|
|
|
);
|
2022-11-16 14:36:03 +00:00
|
|
|
});
|
2022-06-10 19:00:02 +00:00
|
|
|
});
|
2022-10-27 09:59:09 +00:00
|
|
|
|
|
|
|
function openMarketDropDown() {
|
|
|
|
cy.getByTestId('dialog-close').click();
|
|
|
|
cy.getByTestId('popover-trigger').click();
|
|
|
|
cy.contains('Loading market data...').should('not.exist');
|
|
|
|
}
|