Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f01f998
refactor(charts): migrate Cypress tests to Playwright Component Tests
Lukas742 May 15, 2026
0ff342a
Delete summary.md
Lukas742 May 15, 2026
1163429
fix(charts): resolve remaining test.fixme tests
Lukas742 May 15, 2026
02975f1
fix(charts): resolve all remaining fixme tests
Lukas742 May 15, 2026
b011116
Merge branch 'refactor/charts-test-playwright' of https://github.com/…
Lukas742 May 15, 2026
002eac7
fix(charts): restore ColumnChartWithTrend Cypress test and add functi…
Lukas742 May 15, 2026
28a7b3c
refactor(charts): migrate ColumnChartWithTrend to Playwright and fill…
Lukas742 May 15, 2026
a8340a7
fix(charts): add active-shape and Space keyup activation tests
Lukas742 May 15, 2026
ec8b4b8
test(charts): cover untested library logic across all charts
Lukas742 May 18, 2026
c85fd23
docs(charts): note dropped wheel-zoom rescaling test in TimelineChart
Lukas742 May 19, 2026
63d6d85
ci(charts): route charts coverage through Playwright
Lukas742 May 19, 2026
a76cf3f
test(charts): import test from main-fixtures to enable coverage colle…
Lukas742 May 19, 2026
112d5e9
ci: report all Playwright coverage under one flag
Lukas742 May 19, 2026
8447240
Update componentFactories.tsx
Lukas742 May 19, 2026
ed2d221
test(charts): de-flake BulletChart onDataPointClick
Lukas742 May 19, 2026
e0c81e6
test(charts): consolidate loading-state tests into a shared test factory
Lukas742 May 19, 2026
4dd3a08
test(charts): share zoomingTool, passThrough props, stack totals tests
Lukas742 May 19, 2026
d129e38
Update BulletChart.spec.tsx
Lukas742 May 20, 2026
7e7e8ed
Merge branch 'main' into refactor/charts-test-playwright
Lukas742 May 20, 2026
748590e
ci(charts): restore react-is@18 override for the Playwright job
Lukas742 May 20, 2026
bfc11f5
ci(coverage): exclude generated CSS module type defs and barrel files
Lukas742 May 20, 2026
35c8604
Merge branch 'main' into refactor/charts-test-playwright
Lukas742 May 20, 2026
a058123
Merge branch 'main' into refactor/charts-test-playwright
Lukas742 May 20, 2026
956cbc0
Merge branch 'main' into refactor/charts-test-playwright
Lukas742 May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ jobs:
- name: Install
run: yarn install --immutable

- name: Override react-is for charts
if: ${{ matrix.react == '18' }}
run: jq '.resolutions["react-is"] = "18"' package.json > tmp.json && mv tmp.json package.json

- name: Install React 18
if: ${{ matrix.react == '18' }}
run: |
Expand Down Expand Up @@ -88,7 +92,6 @@ jobs:
matrix:
spec:
- base
- charts
- cypress-commands
- main/src/components
- main/src/webComponents
Expand All @@ -108,10 +111,6 @@ jobs:
- name: Install
run: yarn install --immutable

- name: Override react-is for charts
if: ${{ matrix.react == '18' && matrix.spec == 'charts' }}
run: jq '.resolutions["react-is"] = "18"' package.json > tmp.json && mv tmp.json package.json

- name: Install 18
if: ${{ matrix.react == '18' }}
run: |
Expand Down Expand Up @@ -154,4 +153,4 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: 'base,charts,cypress-commands,main/src/components,main/src/internal,playwright'
carryforward: 'base,cypress-commands,main/src/components,main/src/internal,playwright'
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineConfig({
'**/src/enums/*',
'**/*.stories.tsx',
'**/*.test.{ts,tsx}',
'**/*.module.css.ts',
'**/node_modules/**',
'**/dist/**',
'packages/*/src/index.ts',
Expand Down
110 changes: 0 additions & 110 deletions packages/charts/src/components/BarChart/BarChart.cy.tsx

This file was deleted.

92 changes: 92 additions & 0 deletions packages/charts/src/components/BarChart/test/BarChart.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { expect, test } from '../../../../../../playwright/fixtures/main-fixtures.js';
import { complexDataSet } from '../../../resources/DemoProps.js';
import {
testLoadingStates,
testPassThroughProps,
testStackAggregateTotals,
testZoomingTool,
} from '../../../test-utils/sharedTests.js';
import { BarChart } from '../index.js';
import {
BarChartClickTest,
BarChartDataPointClickTest,
BarChartHighlightColorTest,
BarChartLegendConfigTest,
BarChartSecondYAxisTest,
} from './BarChartTestComponents.js';

const dimensions = [{ accessor: 'name', interval: 0 }];
const measures = [
{ accessor: 'users', label: 'Users' },
{ accessor: 'sessions', label: 'Active Sessions' },
{ accessor: 'volume', label: 'Vol.' },
];
const baseProps = { dataset: complexDataSet, dimensions, measures };

test.describe('BarChart', () => {
test('Basic', async ({ mount, page }) => {
await mount(<BarChart {...baseProps} />);
await expect(page.locator('.recharts-responsive-container')).toBeVisible();
await expect(page.locator('.recharts-bar')).toHaveCount(3);
await expect(page.locator('.recharts-bar-rectangles')).toHaveCount(3);
});

test('click handlers', async ({ mount, page }) => {
await mount(<BarChartClickTest />);

await page.getByText('January').click();
await expect(page.getByTestId('click-count')).toHaveText('1');

await page.locator('[name="January"]').first().click();
await expect(page.getByTestId('click-count')).toHaveText('2');
await expect(page.getByTestId('last-payload')).toHaveText(JSON.stringify(complexDataSet[0]));

await page.locator('.recharts-legend-item-text').filter({ hasText: 'Users' }).click();
await expect(page.getByTestId('legend-click-count')).toHaveText('1');
await expect(page.getByTestId('last-legend-value')).toHaveText('Users');

await page.locator('.recharts-legend-item-text').filter({ hasText: 'Vol.' }).click();
await expect(page.getByTestId('last-legend-datakey')).toHaveText('volume');
});

testLoadingStates(BarChart, baseProps, { dimensions: [], measures: [] }, '.recharts-bar');

test('legendConfig', async ({ mount, page }) => {
await mount(<BarChartLegendConfigTest />);
await expect(page.getByTestId('catval').first()).toBeVisible();
});

testZoomingTool(BarChart, baseProps);

testPassThroughProps(BarChart, { dimensions: [], measures: [] });

testStackAggregateTotals(BarChart, { dataset: complexDataSet.slice(0, 3), dimensions }, [
{ accessor: 'users', stackId: 'A', label: 'Users' },
{ accessor: 'sessions', stackId: 'A', label: 'Active Sessions' },
]);

test('onDataPointClick', async ({ mount, page }) => {
await mount(<BarChartDataPointClickTest />);

await page.locator('[name="January"]').first().click();
await expect(page.getByTestId('dp-click-count')).toHaveText('1');
await expect(page.getByTestId('dp-last-datakey')).not.toHaveText('');
await expect(page.getByTestId('dp-last-value')).not.toHaveText('');
await expect(page.getByTestId('dp-last-data-index')).not.toHaveText('-1');
await expect(page.getByTestId('dp-last-payload')).toHaveText(JSON.stringify(complexDataSet[0]));
});

test('highlightColor', async ({ mount, page }) => {
await mount(<BarChartHighlightColorTest />);

// January has users=100 (<=200 → green), February has users=230 (>200 → red)
await expect(page.locator('.recharts-bar-rectangle [fill="green"]').first()).toBeAttached();
await expect(page.locator('.recharts-bar-rectangle [fill="red"]').first()).toBeAttached();
});

test('secondYAxis', async ({ mount, page }) => {
await mount(<BarChartSecondYAxisTest />);
// BarChart is horizontal so the secondary "Y" axis renders as an additional XAxis
await expect(page.locator('.recharts-xAxis')).toHaveCount(2);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { complexDataSet } from '../../../resources/DemoProps.js';
import {
createClickTestComponent,
createDataPointClickTestComponent,
createHighlightColorTestComponent,
createLegendConfigTestComponent,
createSecondYAxisTestComponent,
} from '../../../test-utils/componentFactories.js';
import { BarChart } from '../index.js';

const dimensions = [{ accessor: 'name', interval: 0 }];

const measures = [
{
accessor: (data: Record<string, number>) => data.users,
label: 'Users',
formatter: (val: number) => val.toLocaleString('en'),
},
{
accessor: (data: Record<string, number>) => data.sessions,
label: 'Active Sessions',
formatter: (val: number) => `${val} sessions`,
hideDataLabel: true,
},
{ accessor: 'volume', label: 'Vol.' },
];

const baseProps = { dataset: complexDataSet, dimensions, measures };

export const BarChartClickTest = createClickTestComponent(BarChart, baseProps, {
trackLegendValue: true,
});

export const BarChartLegendConfigTest = createLegendConfigTestComponent(BarChart, baseProps);

export const BarChartDataPointClickTest = createDataPointClickTestComponent(BarChart, baseProps);

export const BarChartHighlightColorTest = createHighlightColorTestComponent(BarChart, baseProps, [
{
accessor: 'users',
label: 'Users',
highlightColor: (value: number) => (value > 200 ? 'red' : 'green'),
},
{ accessor: 'sessions', label: 'Active Sessions' },
{ accessor: 'volume', label: 'Vol.' },
]);

export const BarChartSecondYAxisTest = createSecondYAxisTestComponent(BarChart, baseProps, 'volume');
89 changes: 0 additions & 89 deletions packages/charts/src/components/BulletChart/BulletChart.cy.tsx

This file was deleted.

Loading
Loading