This commit is contained in:
Rishabh Saxena 2021-03-17 15:06:08 +05:30 committed by GitHub
parent 8aca378028
commit 0e3901953b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 69 deletions

View File

@ -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", () => {

View File

@ -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

View File

@ -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()