Skip to content

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

Fix flaky onboarding/command-palette test (#64678)

Kamil Mielnikfe858b408a40
diff --git a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js
index 3f450fd181c..dd70a96d4c4 100644
--- a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js
+++ b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js
@@ -31,6 +31,12 @@ const TAB_4 = {
name: "Tab 4",
};
+/**
+ * When keys are pressed too fast redux won't have enough time to update the state,
+ * so conditions in subsequently called event handlers may not have been updated yet.
+ */
+const REAL_PRESS_DELAY = 1;
+
describe("command palette", () => {
beforeEach(() => {
H.restore();
@@ -680,12 +686,14 @@ H.describeWithSnowplow("shortcuts", { tags: ["@actions"] }, () => {
// Sidesheet
cy.realPress("]");
cy.findByRole("dialog", { name: "Info" }).should("exist");
+ cy.wait(REAL_PRESS_DELAY);
cy.realPress("]");
cy.findByRole("dialog", { name: "Info" }).should("not.exist");
// Viz Settings
cy.realPress("y");
cy.findByTestId("chartsettings-sidebar").should("exist");
+ cy.wait(REAL_PRESS_DELAY);
cy.realPress("y");
cy.findByTestId("chartsettings-sidebar").should("not.exist");