Test/626 oracle info (#1294)

* test: update market info tests

* test: update withdrawal test to include new info

* chore: re add withdrawal mock

* chore: wait for mock

* chore: change cypress browser to electron

* chore: resolved pr comments
This commit is contained in:
Joe Tsang 2022-09-09 10:36:53 +01:00 committed by GitHub
parent 4db77a8e8a
commit 8958db0612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 20 deletions

View File

@ -133,7 +133,7 @@ jobs:
working-directory: frontend-monorepo
- name: Run Cypress tests
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}

View File

@ -117,7 +117,7 @@ jobs:
working-directory: frontend-monorepo
- name: Run Cypress tests
run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}

View File

@ -130,7 +130,7 @@ jobs:
working-directory: frontend-monorepo
- name: Run Cypress tests
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
working-directory: frontend-monorepo
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}

View File

@ -12,6 +12,8 @@ describe('home', () => {
mockTradingPage(req, MarketState.STATE_ACTIVE);
});
cy.visit('/');
cy.wait('@Market');
cy.get('main[data-testid="market"]', { timeout: 20000 }).should('exist'); // Wait for page to be rendered to before checking url
// Overlay should be shown

View File

@ -4,6 +4,7 @@ import { mockTradingPage } from '../support/trading';
const marketInfoBtn = 'Info';
const row = 'key-value-table-row';
const marketTitle = 'accordion-title';
const externalLink = 'external-link';
describe('market info is displayed', () => {
before(() => {
@ -25,9 +26,9 @@ describe('market info is displayed', () => {
it('market price', () => {
cy.getByTestId(marketTitle).contains('Market price').click();
validateMarketDataRow(0, 'Mark Price', '57.49');
validateMarketDataRow(1, 'Best Bid Price', '6,817.65');
validateMarketDataRow(2, 'Best Offer Price', '6,817.69');
validateMarketDataRow(0, 'Mark Price', '0.05749');
validateMarketDataRow(1, 'Best Bid Price', '6.81765 ');
validateMarketDataRow(2, 'Best Offer Price', '6.81769 ');
});
it('market volume displayed', () => {
@ -71,11 +72,7 @@ describe('market info is displayed', () => {
validateMarketDataRow(0, 'Name', 'tBTC TEST');
validateMarketDataRow(1, 'Symbol', 'tBTC');
validateMarketDataRow(
2,
'Asset ID',
'5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c'
);
validateMarketDataRow(2, 'Asset ID', 'market-0');
});
it('metadata displayed', () => {
@ -114,9 +111,9 @@ describe('market info is displayed', () => {
it('price monitoring bound displayed', () => {
cy.getByTestId(marketTitle).contains('Price monitoring bound 1').click();
validateMarketDataRow(0, 'Min Valid Price', '6,547.01');
validateMarketDataRow(1, 'Max Valid Price', '7,973.23');
validateMarketDataRow(2, 'Reference Price', '7,226.25');
validateMarketDataRow(0, 'Min Valid Price', '6.54701 ');
validateMarketDataRow(1, 'Max Valid Price', '7.97323 ');
validateMarketDataRow(2, 'Reference Price', '7.22625 ');
});
it('liquidity monitoring parameters displayed', () => {
@ -129,6 +126,20 @@ describe('market info is displayed', () => {
validateMarketDataRow(2, 'Scaling Factor', '10');
});
it('liquidity displayed', () => {
cy.getByTestId('accordion-toggle').eq(14).click();
validateMarketDataRow(0, 'Target Stake', '0.56789 tBTC');
validateMarketDataRow(1, 'Supplied Stake', '0.56767 tBTC');
validateMarketDataRow(2, 'Market Value Proxy', '6.77678 tBTC');
cy.getByTestId(externalLink).should(
'have.attr',
'href',
'/liquidity/market-0'
);
});
it('oracle displayed', () => {
cy.getByTestId(marketTitle).contains('Oracle').click();
@ -148,6 +159,19 @@ describe('market info is displayed', () => {
'Termination Oracle',
'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f'
);
cy.getByTestId(externalLink)
.should('have.attr', 'href')
.and('contain', '/oracles');
});
it('proposal displayed', () => {
cy.getByTestId(marketTitle).contains('Proposal').click();
cy.getByTestId(externalLink)
.should('have.text', 'View governance proposal')
.and('have.attr', 'href')
.and('contain', '/governance/market-0');
});
afterEach('close toggle', () => {

View File

@ -83,6 +83,18 @@ describe('withdraw', () => {
},
});
cy.get(assetSelectField).select('Asset 0');
cy.getByTestId('balance-available')
.should('contain.text', 'Balance available')
.find('td')
.should('have.text', '1000');
cy.getByTestId('withdrawal-threshold')
.should('contain.text', 'Delayed withdrawal threshold')
.find('td')
.should('contain.text', '1m+');
cy.getByTestId('delay-time')
.should('contain.text', 'Delay time')
.find('td')
.should('have.text', 'None');
cy.get(amountField).clear().type('10');
cy.getByTestId(submitWithdrawBtn).click();
cy.getByTestId('dialog-title').should(

View File

@ -15,7 +15,7 @@ export const generateMarketInfoQuery = (
market: {
__typename: 'Market',
id: 'market-0',
decimalPlaces: 2,
decimalPlaces: 5,
positionDecimalPlaces: 0,
state: MarketState.STATE_ACTIVE,
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
@ -144,10 +144,10 @@ export const generateMarketInfoQuery = (
quoteName: 'BTC',
settlementAsset: {
__typename: 'Asset',
id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
id: 'market-0',
symbol: 'tBTC',
name: 'tBTC TEST',
decimals: 1,
decimals: 5,
},
oracleSpecForSettlementPrice: {
__typename: 'OracleSpec',

View File

@ -33,17 +33,17 @@ export const WithdrawLimits = ({
return (
<table className="w-full text-sm">
<tbody>
<tr>
<tr data-testid="balance-available">
<th className="text-left font-normal">{t('Balance available')}</th>
<td className="text-right">{balance.toString()}</td>
</tr>
<tr>
<tr data-testid="withdrawal-threshold">
<th className="text-left font-normal">
{t('Delayed withdrawal threshold')}
</th>
<td className="text-right">{text}</td>
</tr>
<tr>
<tr data-testid="delay-time">
<th className="text-left font-normal">{t('Delay time')}</th>
<td className="text-right">{delayTime}</td>
</tr>