Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Wait for the chart to settle before the first hover in the legend toggle test (#85698)

Paolo Rascunà471c4028e096
diff --git a/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js b/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
index ddc634030e8..0b32ae36250 100644
--- a/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
+++ b/e2e/test/scenarios/visualizations/charts/legend.cy.spec.js
@@ -465,6 +465,8 @@ describe("scenarios > visualizations > legend", () => {
});
it("should toggle series visibility in the query builder", () => {
+ // Stop the first-chart PUT and its settings refetch during the hovers.
+ H.updateSetting("non-table-chart-generated", true);
H.createQuestion(SINGLE_AGGREGATION_QUESTION, { visitQuestion: true });
H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).should("have.length", 5);
@@ -472,7 +474,10 @@ describe("scenarios > visualizations > legend", () => {
H.chartPathWithFillColor(CATEGORY_COLOR.GIZMO).should("have.length", 5);
H.chartPathWithFillColor(CATEGORY_COLOR.WIDGET).should("have.length", 5);
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover();
+ // trigger() waits until the DebouncedFrame accepts pointer events, then
+ // sends the event at once. realHover() sends one mouse move that the
+ // frame can drop.
+ firstDoohickeyBar().trigger("mousemove");
H.assertEChartsTooltip({
header: "2025",
rows: [
@@ -505,7 +510,7 @@ describe("scenarios > visualizations > legend", () => {
H.chartPathWithFillColor(CATEGORY_COLOR.GIZMO).should("have.length", 0);
H.chartPathWithFillColor(CATEGORY_COLOR.WIDGET).should("have.length", 5);
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover();
+ firstDoohickeyBar().trigger("mousemove");
H.assertEChartsTooltip({
header: "2025",
rows: [
@@ -565,7 +570,7 @@ describe("scenarios > visualizations > legend", () => {
cy.wait(1000);
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover();
+ firstDoohickeyBar().trigger("mousemove");
H.assertEChartsTooltip({
header: "2025",
rows: [
@@ -581,7 +586,7 @@ describe("scenarios > visualizations > legend", () => {
hideSeries(2); // Gizmo
hideSeries(3); // Widget
- H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first().realHover();
+ firstDoohickeyBar().trigger("mousemove");
H.assertEChartsTooltip({
header: "2025",
rows: [
@@ -678,6 +683,10 @@ function showSeries(legendItemIndex) {
.click({ scrollBehavior: "nearest" });
}
+function firstDoohickeyBar() {
+ return H.chartPathWithFillColor(CATEGORY_COLOR.DOOHICKEY).first();
+}
+
function hideSeriesByName(name) {
cy.findByText(name)
.closest("[data-testid=legend-item]")