Skip to content

Commit 2ffe44f

Browse files
test(app): find the heatmap tooltip in the page body in e2e tests
The tooltip now renders into the body, so the page object can't find it inside the chart container anymore. Look it up by test id instead.
1 parent 77558d6 commit 2ffe44f

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎packages/app/src/components/DBHeatmapChart/HeatmapTooltip.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function HeatmapTooltip({
7272
/>
7373
{createPortal(
7474
<div
75+
data-testid="heatmap-tooltip"
7576
className="px-2 py-1 fs-8"
7677
style={{
7778
position: 'fixed',

‎packages/app/tests/e2e/components/HeatmapComponent.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@ export class HeatmapComponent {
2929
return this.root.getByText('Not enough data points to render heatmap');
3030
}
3131

32+
/** The open cell tooltip, rendered into the page body rather than the chart. */
33+
private get tooltipRoot() {
34+
return this.page.getByTestId('heatmap-tooltip');
35+
}
36+
3237
/**
3338
* The hover tooltip, which only appears for a cell with a non-zero count.
3439
* Series-axis heatmaps label the cell's series instead of its count.
3540
*/
3641
get tooltip() {
37-
return this.container.getByText(/^(Count Value|Series):$/);
42+
return this.tooltipRoot.getByText(/^(Count Value|Series):$/);
3843
}
3944

4045
/**
@@ -70,7 +75,7 @@ export class HeatmapComponent {
7075

7176
/** The series named by the open cell tooltip of a series-axis heatmap. */
7277
async hoveredSeriesName() {
73-
const row = this.container
78+
const row = this.tooltipRoot
7479
.getByText('Series:', { exact: true })
7580
.locator('..');
7681
await expect(row).toBeVisible();
@@ -79,7 +84,7 @@ export class HeatmapComponent {
7984

8085
/** A labelled value of the open cell tooltip, e.g. `Count Value`. */
8186
async hoveredTooltipValue(label: 'Count Value' | 'Y Value' | 'Bucket') {
82-
const row = this.container
87+
const row = this.tooltipRoot
8388
.getByText(`${label}:`, { exact: true })
8489
.locator('..');
8590
await expect(row).toBeVisible();

0 commit comments

Comments
 (0)