Commit ab22a7ab authored by isstuev's avatar isstuev

stats updates tests

parent eb360f3d
......@@ -191,7 +191,7 @@ export const averageGasPrice: stats.LineChart = {
],
info: {
title: 'Chart title',
description: 'Chert description',
description: 'Chart description',
id: 'chart',
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 = () => {
mb={ 3 }
isLoading={ isInfoLoading }
backLink={ backLink }
contentAfter={ isMobile ? shareAndMenu : undefined }
afterTitle={ isMobile ? shareAndMenu : undefined }
secondRow={ info?.description || lineQuery.data?.info?.description }
withTextAd
/>
......@@ -175,9 +175,9 @@ const Chart = () => {
<Flex alignItems="center" gap={ 3 } maxW="100%" overflow="hidden">
<Text>Period</Text>
<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
resolution={ resolution }
onResolutionChange={ setResolution }
......@@ -185,7 +185,7 @@ const Chart = () => {
/>
</>
) }
{ (!isZoomResetInitial || resolution !== 'DAY') && (
{ (!isZoomResetInitial || resolution !== DEFAULT_RESOLUTION) && (
isMobile ? (
<IconButton
aria-label="Reset"
......
......@@ -87,6 +87,8 @@ const ChartWidget = ({
isLoaded={ !isLoading }
color="text_secondary"
fontSize="xs"
mt={ 1 }
>
<span>{ description }</span>
</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