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 test: warn about unsaved changes when navigating away while save modal is open (#75482)

Nemanja Glumac530bae6edc8b
diff --git a/e2e/test/scenarios/data-studio/transforms/reproductions.cy.spec.ts b/e2e/test/scenarios/data-studio/transforms/reproductions.cy.spec.ts
index 814aec90010..ecc2cdcf16a 100644
--- a/e2e/test/scenarios/data-studio/transforms/reproductions.cy.spec.ts
+++ b/e2e/test/scenarios/data-studio/transforms/reproductions.cy.spec.ts
@@ -243,6 +243,14 @@ describe("issue GDGT-2429", () => {
H.leaveConfirmationModal().should("be.visible");
cy.log("pressing Esc should close the warning, not the saving modal");
+ // Wait for Mantine's focus trap to move focus inside the leave-confirm modal
+ // before pressing Escape. `be.visible` passes during the open transition,
+ // before the trap engages, so an early Escape lands outside the modal's
+ // focus-trapped content (where its closeOnEscape handler lives) and is lost,
+ // leaving the modal open.
+ H.leaveConfirmationModal().within(() => {
+ cy.get(":focus").should("exist");
+ });
cy.realPress("Escape");
H.leaveConfirmationModal().should("not.exist");
H.modal().findByText("Save your transform").should("be.visible");