569 re enable simple trading app tests (#572)
* feat: [console-lite] - simple market list toolbar - fixes in unit tests * feat: [console-lite] - simple market list toolbar - fixes in unit tests * feat: [console-lite] - simple market list toolbar - fixes in unit tests * fix: [console-lite] - fix and re-enable skipped tests * fix: [console-lite] - fix and re-enable skipped tests * fix: [console-lite] - fix int test * fix: [console-lite] - improve int test, fix formats Co-authored-by: maciek <maciek@vegaprotocol.io>
This commit is contained in:
parent
4c88eefe3a
commit
2141bb6fc3
@ -17,19 +17,25 @@ describe('market list', () => {
|
||||
cy.get('select[name="states"]').select('All');
|
||||
cy.location('pathname').should('equal', '/markets/all');
|
||||
|
||||
let asset = '';
|
||||
cy.getByTestId('market-assets-menu')
|
||||
.children()
|
||||
.last()
|
||||
.find('button')
|
||||
.click();
|
||||
cy.location('pathname').should('equal', '/markets/all/tEURO');
|
||||
|
||||
cy.get('button').contains('Future').click();
|
||||
cy.location('pathname').should('equal', '/markets/all/tEURO/Future');
|
||||
|
||||
cy.get('button').contains('All Markets').click();
|
||||
cy.location('pathname').should('equal', '/markets/all/tEURO');
|
||||
.then((children) => {
|
||||
if (children.length > 1) {
|
||||
asset = children[1].innerText;
|
||||
if (asset) {
|
||||
cy.wrap(children[1]).click();
|
||||
cy.location('pathname').should('equal', `/markets/all/${asset}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (asset) {
|
||||
cy.get('button').contains('Future').click();
|
||||
cy.location('pathname').should('equal', `/markets/all/${asset}/Future`);
|
||||
|
||||
cy.get('button').contains('All Markets').click();
|
||||
cy.location('pathname').should('equal', `/markets/all/${asset}`);
|
||||
}
|
||||
cy.getByTestId('market-assets-menu')
|
||||
.children()
|
||||
.find('button')
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import { MockedProvider } from '@apollo/client/testing';
|
||||
import type { MockedResponse } from '@apollo/client/testing';
|
||||
import { MarketState } from '@vegaprotocol/types';
|
||||
@ -38,8 +38,7 @@ describe('SimpleMarketList', () => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
// [EH] Flaky test disabled, see #1304
|
||||
it.skip('should be properly renderer as empty', async () => {
|
||||
it('should be properly renderer as empty', async () => {
|
||||
const mocks: MockedResponse<SimpleMarkets> = {
|
||||
request: {
|
||||
query: MARKETS_QUERY,
|
||||
@ -59,8 +58,9 @@ describe('SimpleMarketList', () => {
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
|
||||
expect(screen.getByText('No data to display')).toBeInTheDocument();
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('No data to display')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('should be properly rendered with some data', async () => {
|
||||
@ -124,10 +124,11 @@ describe('SimpleMarketList', () => {
|
||||
<SimpleMarketList />
|
||||
</MockedProvider>
|
||||
);
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
expect(screen.getByTestId('simple-market-list')).toBeInTheDocument();
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('simple-market-list')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByTestId('simple-market-list').children).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
||||
import { MockedProvider } from '@apollo/react-testing';
|
||||
import SimpleMarketToolbar from './simple-market-toolbar';
|
||||
import type { MockedResponse } from '@apollo/client/testing';
|
||||
@ -30,8 +30,7 @@ describe('SimpleMarketToolbar', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
// [EH] Flaky test disabled, see #1304
|
||||
it.skip('should be properly rendered', async () => {
|
||||
it('should be properly rendered', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<MockedProvider mocks={[filterMock]} addTypename={false}>
|
||||
@ -40,14 +39,15 @@ describe('SimpleMarketToolbar', () => {
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('market-assets-menu')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByTestId('market-products-menu').children).toHaveLength(3);
|
||||
expect(screen.getByTestId('market-assets-menu').children).toHaveLength(6);
|
||||
expect(screen.getByRole('combobox').children).toHaveLength(10);
|
||||
});
|
||||
|
||||
// [EH] Flaky test disabled, see #1304
|
||||
it.skip('navigation should work well', async () => {
|
||||
it('navigation should work well', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<MockedProvider mocks={[filterMock]} addTypename={false}>
|
||||
@ -56,7 +56,9 @@ describe('SimpleMarketToolbar', () => {
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('market-assets-menu')).toBeInTheDocument();
|
||||
});
|
||||
fireEvent.click(
|
||||
screen
|
||||
.getByTestId('market-products-menu')
|
||||
|
Loading…
Reference in New Issue
Block a user