Skip to content

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

UXW-2497 fix remote-sync flaky test (#68368)

Denis Berezin7a96e1f1426f
diff --git a/e2e/support/helpers/e2e-remote-sync-helpers.ts b/e2e/support/helpers/e2e-remote-sync-helpers.ts
index 21437ce306e..545f0ddf5d5 100644
--- a/e2e/support/helpers/e2e-remote-sync-helpers.ts
+++ b/e2e/support/helpers/e2e-remote-sync-helpers.ts
@@ -213,12 +213,12 @@ export const waitForTask = (
if (retries > 3) {
throw Error(`Too many retries waiting for ${taskName}`);
}
- cy.wait("@currentTask").then(({ response }) => {
+ return cy.wait("@currentTask").then(({ response }) => {
const { body } = response || {};
if (body?.sync_task_type !== taskName) {
- waitForTask({ taskName });
+ return waitForTask({ taskName });
} else if (body?.status !== "successful") {
- waitForTask({ taskName }, retries + 1);
+ return waitForTask({ taskName }, retries + 1);
}
});
};
diff --git a/e2e/test/scenarios/admin/remote-sync.cy.spec.ts b/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
index 5ec1a1ed83c..76368c1fd9e 100644
--- a/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
+++ b/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
@@ -374,21 +374,24 @@ describe("Remote Sync", () => {
cy.button(/Push changes/).click();
});
- H.waitForTask({ taskName: "export" });
+ H.waitForTask({ taskName: "export" }).then(() => {
+ H.getGitSyncControls().should("contain.text", NEW_BRANCH);
+ H.collectionTable().within(() => {
+ cy.findByText("Orders").should("exist");
+ cy.findByText(REMOTE_QUESTION_NAME).should("exist");
+ });
- H.getGitSyncControls().should("contain.text", NEW_BRANCH);
- H.collectionTable().within(() => {
- cy.findByText("Orders").should("exist");
- cy.findByText(REMOTE_QUESTION_NAME).should("exist");
- });
+ H.modal().findByText("Pushing to Git").should("not.exist");
- H.getSwitchBranchOption().click();
- H.popover().findByRole("option", { name: "main" }).click();
+ H.getSwitchBranchOption().click();
+ H.popover().findByRole("option", { name: "main" }).click();
- H.waitForTask({ taskName: "import" });
- H.collectionTable().within(() => {
- cy.findByText("Orders").should("not.exist");
- cy.findByText(REMOTE_QUESTION_NAME).should("exist");
+ H.waitForTask({ taskName: "import" }).then(() => {
+ H.collectionTable().within(() => {
+ cy.findByText("Orders").should("not.exist");
+ cy.findByText(REMOTE_QUESTION_NAME).should("exist");
+ });
+ });
});
});