2026-06-24 20:31:05 +05:00

42 lines
1.9 KiB
TypeScript

import {expect} from '@playwright/test';
import QLPage from '../../../../page-objects/ql/QLPage';
import {openTestPage} from '../../../../utils';
import datalensTest from '../../../../utils/playwright/globalTestDefinition';
import {WizardVisualizationId} from '../../../../../src/shared';
import {PlaceholderName} from '../../../../page-objects/wizard/SectionVisualization';
import {COMMON_CHARTKIT_SELECTORS} from '../../../../page-objects/constants/chartkit';
datalensTest.describe('QL', () => {
datalensTest.describe('Pie chart', () => {
datalensTest.beforeEach(async ({page, config}) => {
await openTestPage(page, config.ql.urls.NewQLChartWithConnection);
const qlPage = new QLPage({page});
await qlPage.setVisualization(WizardVisualizationId.Pie);
await qlPage.setScript(config.ql.queries.citySales);
await qlPage.runScript();
});
datalensTest('"Column names" in Labels section @screenshot', async ({page}) => {
const qlPage = new QLPage({page});
const previewLoader = page.locator('.grid-loader');
const chart = page.locator(COMMON_CHARTKIT_SELECTORS.chart);
await qlPage.sectionVisualization.addFieldByClick(PlaceholderName.Labels, 'city');
await expect(previewLoader).not.toBeVisible();
const labelsWithColorFieldScreenshot = await chart.screenshot();
await qlPage.sectionVisualization.removeFieldByClick(PlaceholderName.Labels, 'city');
await qlPage.sectionVisualization.addFieldByClick(
PlaceholderName.Labels,
'Column Names',
);
await expect(previewLoader).not.toBeVisible();
// @ts-ignore
// The labels for "Column Names" must match the labels for the field in the Colors section
await expect(await chart.screenshot()).toMatchSnapshot(labelsWithColorFieldScreenshot);
});
});
});