diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GlobalSearch/GlobalSearch_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GlobalSearch/GlobalSearch_spec.js index 66ded15072..1d44b9b5b2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GlobalSearch/GlobalSearch_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GlobalSearch/GlobalSearch_spec.js @@ -70,36 +70,29 @@ describe("GlobalSearch", function() { }); it("navigatesToDatasourceHavingAQuery", () => { - cy.window() - .its("store") - .invoke("getState") - .then((state) => { - cy.createPostgresDatasource(); - cy.NavigateToQueryEditor(); + cy.createPostgresDatasource(); + cy.get("@createDatasource").then((httpResponse) => { + const expectedDatasource = httpResponse.response.body.data; + cy.NavigateToQueryEditor(); + cy.contains(".t--datasource-name", expectedDatasource.name) + .find(queryLocators.createQuery) + .click(); - const { datasources } = state.entities; - const expectedDatasource = - datasources.list[datasources.list.length - 1]; + cy.get(commonlocators.globalSearchTrigger).click({ force: true }); + cy.wait(1000); // modal open transition should be deterministic + cy.get(commonlocators.globalSearchClearInput).click({ force: true }); + cy.get(commonlocators.globalSearchInput).type("Page1"); + cy.get("body").type("{enter}"); - cy.contains(".t--datasource-name", expectedDatasource.name) - .find(queryLocators.createQuery) - .click(); - - cy.get(commonlocators.globalSearchTrigger).click({ force: true }); - cy.wait(1000); - cy.get(commonlocators.globalSearchClearInput).click({ force: true }); - cy.get(commonlocators.globalSearchInput).type("Page1"); - cy.get("body").type("{enter}"); - - cy.get(commonlocators.globalSearchTrigger).click({ force: true }); - cy.wait(1000); - cy.get(commonlocators.globalSearchClearInput).click({ force: true }); - cy.get(commonlocators.globalSearchInput).type(expectedDatasource.name); - cy.get("body").type("{enter}"); - cy.location().should((loc) => { - expect(loc.pathname).includes(expectedDatasource.id); - }); + cy.get(commonlocators.globalSearchTrigger).click({ force: true }); + cy.wait(1000); // modal open transition should be deterministic + cy.get(commonlocators.globalSearchClearInput).click({ force: true }); + cy.get(commonlocators.globalSearchInput).type(expectedDatasource.name); + cy.get("body").type("{enter}"); + cy.location().should((loc) => { + expect(loc.pathname).includes(expectedDatasource.id); }); + }); }); it("navigatesToPage", () => { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/Onboarding_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/Onboarding_spec.js index f466810ef0..d35a620c79 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/Onboarding_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Onboarding/Onboarding_spec.js @@ -15,49 +15,59 @@ describe("Onboarding", function() { 201, ); cy.wait("@getDataSources"); - cy.wait("@getPluginForm").should( - "have.nested.property", - "response.body.responseMeta.status", - 200, - ); - cy.get(".t--start-building") - .should("be.visible") - .click({ force: true }); - // Create and run query - cy.get(".t--onboarding-indicator").should("be.visible"); - cy.get(".t--create-query").click(); - cy.runQuery(); - // Add widget - cy.get(".t--add-widget").click(); - cy.dragAndDropToCanvas("tablewidget", { x: 30, y: -30 }); - - // Click on "Show me how" and then copy hint - cy.get(".t--onboarding-action").click(); - cy.get(".t--onboarding-snippet").click({ force: true }); - - cy.get(".t--property-control-tabledata" + " .CodeMirror textarea") - .first() - .focus({ force: true }) - .type("{uparrow}", { force: true }) - .type("{ctrl}{shift}{downarrow}", { force: true }); - cy.focused().then(() => { - cy.get(".t--property-control-tabledata" + " .CodeMirror") - .first() - .then((editor) => { - editor[0].CodeMirror.setValue("{{fetch_standup_updates.data}}"); + cy.window() + .its("store") + .invoke("getState") + .then((state) => { + const datasources = state.entities.datasources.list; + let onboardingDatasource = datasources.find((datasource) => { + const name = datasource.name; + return name === "Super Updates DB"; }); - }); - cy.closePropertyPane(); - cy.get(explorer.closeWidgets).click(); - cy.openPropertyPane("tablewidget"); - cy.closePropertyPane(); - cy.get(".t--application-feedback-btn").should("not.exist"); + if (!onboardingDatasource) { + cy.wait("@createDatasource"); + } - cy.contains(".t--onboarding-helper-title", "Capture Hero Updates"); - cy.get(".t--onboarding-cheat-action").click(); - cy.contains(".t--onboarding-helper-title", "Deploy the Standup Dashboard"); + cy.get(".t--start-building").click(); + + // Create and run query + cy.get(".t--onboarding-indicator").should("be.visible"); + cy.get(".t--create-query").click(); + cy.runQuery(); + + // Add widget + cy.get(".t--add-widget").click(); + cy.dragAndDropToCanvas("tablewidget", { x: 30, y: -30 }); + + // Click on "Show me how" and then copy hint + cy.get(".t--onboarding-action").click(); + cy.get(".t--onboarding-snippet").click({ force: true }); + + cy.get(".t--property-control-tabledata" + " .CodeMirror textarea") + .first() + .focus({ force: true }) + .type("{uparrow}", { force: true }) + .type("{ctrl}{shift}{downarrow}", { force: true }); + cy.focused().then(() => { + cy.get(".t--property-control-tabledata" + " .CodeMirror") + .first() + .then((editor) => { + editor[0].CodeMirror.setValue("{{fetch_standup_updates.data}}"); + }); + }); + cy.closePropertyPane(); + cy.get(explorer.closeWidgets).click(); + + cy.openPropertyPane("tablewidget"); + cy.closePropertyPane(); + cy.get(".t--application-feedback-btn").should("not.exist"); + + cy.contains(".t--onboarding-helper-title", "Capture Hero Updates"); + cy.get(".t--onboarding-cheat-action").click(); + cy.contains(".t--onboarding-helper-title", "Deploy the Standup Dashboard"); + }); }); // Similar to PublishtheApp command with little changes diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 7fa89a6ad3..ffa0d16b98 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1656,8 +1656,7 @@ Cypress.Commands.add( .click({ force: true }); cy.get(widgetsPage.menubar) .contains("Show Message") - .click({ force: true }) - .should("have.text", "Show Message"); + .click({ force: true }); cy.get(alertcss) .click({ force: true }) @@ -1960,7 +1959,7 @@ Cypress.Commands.add("openPropertyPane", (widgetType) => { const selector = `.t--draggable-${widgetType}`; cy.get(selector) .first() - .trigger("mouseover") + .trigger("mouseover", { force: true }) .wait(500); cy.get(`${selector}:first-of-type .t--widget-propertypane-toggle`) .first()