Commit ab22a7ab authored by isstuev's avatar isstuev

stats updates tests

parent eb360f3d
...@@ -191,7 +191,7 @@ export const averageGasPrice: stats.LineChart = { ...@@ -191,7 +191,7 @@ export const averageGasPrice: stats.LineChart = {
], ],
info: { info: {
title: 'Chart title', title: 'Chart title',
description: 'Chert description', description: 'Chart description',
id: 'chart', id: 'chart',
resolutions: [ 'DAY', 'MONTH' ], resolutions: [ 'DAY', 'MONTH' ],
}, },
......
import React from 'react';
import * as statsLineMock from 'mocks/stats/line';
import { test, expect } from 'playwright/lib';
import formatDate from 'ui/shared/chart/utils/formatIntervalDate';
import Chart from './Chart';
const CHART_ID = 'averageGasPrice';
test.beforeEach(async({ mockTextAd }) => {
await mockTextAd();
});
const hooksConfig = {
router: {
query: { id: CHART_ID },
},
};
test('base view +@dark-mode +@mobile', async({ render, mockApiResponse, page }) => {
const date = new Date();
date.setMonth(date.getMonth() - 1);
const chartApiUrl = await mockApiResponse(
'stats_line',
statsLineMock.averageGasPrice,
{
pathParams: { id: CHART_ID },
queryParams: {
from: formatDate(date),
to: '2022-11-11',
resolution: 'DAY',
},
},
);
const component = await render(<Chart/>, { hooksConfig });
await page.waitForResponse(chartApiUrl);
await page.waitForFunction(() => {
return document.querySelector('path[data-name="chart-Charttitle-fullscreen"]')?.getAttribute('opacity') === '1';
});
await expect(component).toHaveScreenshot();
});
...@@ -167,7 +167,7 @@ const Chart = () => { ...@@ -167,7 +167,7 @@ const Chart = () => {
mb={ 3 } mb={ 3 }
isLoading={ isInfoLoading } isLoading={ isInfoLoading }
backLink={ backLink } backLink={ backLink }
contentAfter={ isMobile ? shareAndMenu : undefined } afterTitle={ isMobile ? shareAndMenu : undefined }
secondRow={ info?.description || lineQuery.data?.info?.description } secondRow={ info?.description || lineQuery.data?.info?.description }
withTextAd withTextAd
/> />
...@@ -175,9 +175,9 @@ const Chart = () => { ...@@ -175,9 +175,9 @@ const Chart = () => {
<Flex alignItems="center" gap={ 3 } maxW="100%" overflow="hidden"> <Flex alignItems="center" gap={ 3 } maxW="100%" overflow="hidden">
<Text>Period</Text> <Text>Period</Text>
<ChartIntervalSelect interval={ interval } onIntervalChange={ setIntervalState }/> <ChartIntervalSelect interval={ interval } onIntervalChange={ setIntervalState }/>
{ lineQuery.data?.info?.resolutions && lineQuery.data?.info?.resolutions.length > 2 && ( { lineQuery.data?.info?.resolutions && lineQuery.data?.info?.resolutions.length > 1 && (
<> <>
<Text ml={ 3 }>{ isMobile ? 'Res.' : 'Resolution' }</Text> <Text ml={{ base: 0, lg: 3 }}>{ isMobile ? 'Res.' : 'Resolution' }</Text>
<ChartResolutionSelect <ChartResolutionSelect
resolution={ resolution } resolution={ resolution }
onResolutionChange={ setResolution } onResolutionChange={ setResolution }
...@@ -185,7 +185,7 @@ const Chart = () => { ...@@ -185,7 +185,7 @@ const Chart = () => {
/> />
</> </>
) } ) }
{ (!isZoomResetInitial || resolution !== 'DAY') && ( { (!isZoomResetInitial || resolution !== DEFAULT_RESOLUTION) && (
isMobile ? ( isMobile ? (
<IconButton <IconButton
aria-label="Reset" aria-label="Reset"
......
...@@ -87,6 +87,8 @@ const ChartWidget = ({ ...@@ -87,6 +87,8 @@ const ChartWidget = ({
isLoaded={ !isLoading } isLoaded={ !isLoading }
color="text_secondary" color="text_secondary"
fontSize="xs" fontSize="xs"
mt={ 1 }
> >
<span>{ description }</span> <span>{ description }</span>
</Skeleton> </Skeleton>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment