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:
parent
4db77a8e8a
commit
8958db0612
@ -133,7 +133,7 @@ jobs:
|
|||||||
working-directory: frontend-monorepo
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
- name: Run Cypress tests
|
- 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
|
working-directory: frontend-monorepo
|
||||||
env:
|
env:
|
||||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||||
|
@ -117,7 +117,7 @@ jobs:
|
|||||||
working-directory: frontend-monorepo
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
- name: Run Cypress tests
|
- 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
|
working-directory: frontend-monorepo
|
||||||
env:
|
env:
|
||||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||||
|
2
.github/workflows/capsule-cypress.yml
vendored
2
.github/workflows/capsule-cypress.yml
vendored
@ -130,7 +130,7 @@ jobs:
|
|||||||
working-directory: frontend-monorepo
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
- name: Run Cypress tests
|
- 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
|
working-directory: frontend-monorepo
|
||||||
env:
|
env:
|
||||||
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
|
||||||
|
@ -12,6 +12,8 @@ describe('home', () => {
|
|||||||
mockTradingPage(req, MarketState.STATE_ACTIVE);
|
mockTradingPage(req, MarketState.STATE_ACTIVE);
|
||||||
});
|
});
|
||||||
cy.visit('/');
|
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
|
cy.get('main[data-testid="market"]', { timeout: 20000 }).should('exist'); // Wait for page to be rendered to before checking url
|
||||||
|
|
||||||
// Overlay should be shown
|
// Overlay should be shown
|
||||||
|
@ -4,6 +4,7 @@ import { mockTradingPage } from '../support/trading';
|
|||||||
const marketInfoBtn = 'Info';
|
const marketInfoBtn = 'Info';
|
||||||
const row = 'key-value-table-row';
|
const row = 'key-value-table-row';
|
||||||
const marketTitle = 'accordion-title';
|
const marketTitle = 'accordion-title';
|
||||||
|
const externalLink = 'external-link';
|
||||||
|
|
||||||
describe('market info is displayed', () => {
|
describe('market info is displayed', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
@ -25,9 +26,9 @@ describe('market info is displayed', () => {
|
|||||||
|
|
||||||
it('market price', () => {
|
it('market price', () => {
|
||||||
cy.getByTestId(marketTitle).contains('Market price').click();
|
cy.getByTestId(marketTitle).contains('Market price').click();
|
||||||
validateMarketDataRow(0, 'Mark Price', '57.49');
|
validateMarketDataRow(0, 'Mark Price', '0.05749');
|
||||||
validateMarketDataRow(1, 'Best Bid Price', '6,817.65');
|
validateMarketDataRow(1, 'Best Bid Price', '6.81765 ');
|
||||||
validateMarketDataRow(2, 'Best Offer Price', '6,817.69');
|
validateMarketDataRow(2, 'Best Offer Price', '6.81769 ');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('market volume displayed', () => {
|
it('market volume displayed', () => {
|
||||||
@ -71,11 +72,7 @@ describe('market info is displayed', () => {
|
|||||||
|
|
||||||
validateMarketDataRow(0, 'Name', 'tBTC TEST');
|
validateMarketDataRow(0, 'Name', 'tBTC TEST');
|
||||||
validateMarketDataRow(1, 'Symbol', 'tBTC');
|
validateMarketDataRow(1, 'Symbol', 'tBTC');
|
||||||
validateMarketDataRow(
|
validateMarketDataRow(2, 'Asset ID', 'market-0');
|
||||||
2,
|
|
||||||
'Asset ID',
|
|
||||||
'5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('metadata displayed', () => {
|
it('metadata displayed', () => {
|
||||||
@ -114,9 +111,9 @@ describe('market info is displayed', () => {
|
|||||||
it('price monitoring bound displayed', () => {
|
it('price monitoring bound displayed', () => {
|
||||||
cy.getByTestId(marketTitle).contains('Price monitoring bound 1').click();
|
cy.getByTestId(marketTitle).contains('Price monitoring bound 1').click();
|
||||||
|
|
||||||
validateMarketDataRow(0, 'Min Valid Price', '6,547.01');
|
validateMarketDataRow(0, 'Min Valid Price', '6.54701 ');
|
||||||
validateMarketDataRow(1, 'Max Valid Price', '7,973.23');
|
validateMarketDataRow(1, 'Max Valid Price', '7.97323 ');
|
||||||
validateMarketDataRow(2, 'Reference Price', '7,226.25');
|
validateMarketDataRow(2, 'Reference Price', '7.22625 ');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('liquidity monitoring parameters displayed', () => {
|
it('liquidity monitoring parameters displayed', () => {
|
||||||
@ -129,6 +126,20 @@ describe('market info is displayed', () => {
|
|||||||
validateMarketDataRow(2, 'Scaling Factor', '10');
|
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', () => {
|
it('oracle displayed', () => {
|
||||||
cy.getByTestId(marketTitle).contains('Oracle').click();
|
cy.getByTestId(marketTitle).contains('Oracle').click();
|
||||||
|
|
||||||
@ -148,6 +159,19 @@ describe('market info is displayed', () => {
|
|||||||
'Termination Oracle',
|
'Termination Oracle',
|
||||||
'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f'
|
'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', () => {
|
afterEach('close toggle', () => {
|
||||||
|
@ -83,6 +83,18 @@ describe('withdraw', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
cy.get(assetSelectField).select('Asset 0');
|
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.get(amountField).clear().type('10');
|
||||||
cy.getByTestId(submitWithdrawBtn).click();
|
cy.getByTestId(submitWithdrawBtn).click();
|
||||||
cy.getByTestId('dialog-title').should(
|
cy.getByTestId('dialog-title').should(
|
||||||
|
@ -15,7 +15,7 @@ export const generateMarketInfoQuery = (
|
|||||||
market: {
|
market: {
|
||||||
__typename: 'Market',
|
__typename: 'Market',
|
||||||
id: 'market-0',
|
id: 'market-0',
|
||||||
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,
|
||||||
@ -144,10 +144,10 @@ export const generateMarketInfoQuery = (
|
|||||||
quoteName: 'BTC',
|
quoteName: 'BTC',
|
||||||
settlementAsset: {
|
settlementAsset: {
|
||||||
__typename: 'Asset',
|
__typename: 'Asset',
|
||||||
id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
|
id: 'market-0',
|
||||||
symbol: 'tBTC',
|
symbol: 'tBTC',
|
||||||
name: 'tBTC TEST',
|
name: 'tBTC TEST',
|
||||||
decimals: 1,
|
decimals: 5,
|
||||||
},
|
},
|
||||||
oracleSpecForSettlementPrice: {
|
oracleSpecForSettlementPrice: {
|
||||||
__typename: 'OracleSpec',
|
__typename: 'OracleSpec',
|
||||||
|
@ -33,17 +33,17 @@ export const WithdrawLimits = ({
|
|||||||
return (
|
return (
|
||||||
<table className="w-full text-sm">
|
<table className="w-full text-sm">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr data-testid="balance-available">
|
||||||
<th className="text-left font-normal">{t('Balance available')}</th>
|
<th className="text-left font-normal">{t('Balance available')}</th>
|
||||||
<td className="text-right">{balance.toString()}</td>
|
<td className="text-right">{balance.toString()}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr data-testid="withdrawal-threshold">
|
||||||
<th className="text-left font-normal">
|
<th className="text-left font-normal">
|
||||||
{t('Delayed withdrawal threshold')}
|
{t('Delayed withdrawal threshold')}
|
||||||
</th>
|
</th>
|
||||||
<td className="text-right">{text}</td>
|
<td className="text-right">{text}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr data-testid="delay-time">
|
||||||
<th className="text-left font-normal">{t('Delay time')}</th>
|
<th className="text-left font-normal">{t('Delay time')}</th>
|
||||||
<td className="text-right">{delayTime}</td>
|
<td className="text-right">{delayTime}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user