Skip to content
Snippets Groups Projects
Unverified Commit 1870e9ef authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

[E2E] Remove `user` spec from smoke tests (#23460)

parent a8e732e7
No related branches found
No related tags found
No related merge requests found
import {
restore,
sidebar,
popover,
visualize,
startNewQuestion,
summarize,
} from "__support__/e2e/cypress";
describe("smoketest > user", () => {
// Goal: user can use all the features of the simple question and notebook editor
before(restore);
beforeEach(cy.signInAsNormalUser);
it("should be able to ask a custom question", () => {
startNewQuestion();
cy.findByTextEnsureVisible("Sample Database").click();
cy.findByTextEnsureVisible("Products").click();
cy.findByText("Add filters to narrow your answer").click();
cy.findByText("Vendor").click();
cy.findByText("Is").click();
cy.findByText("Not empty").click();
cy.findByText("Add filter").click();
cy.findByText("Pick the metric you want to see").click();
cy.findByText("Average of ...").click();
cy.findByText("Rating").click();
cy.findByText("Pick a column to group by").click();
cy.findByText("Title").click();
cy.findByText("Average of Rating");
visualize();
cy.icon("bar");
cy.findAllByText("Vendor is not empty");
cy.get("svg");
cy.findByText("Visualization");
});
it("should sort via both the header and notebook editor", () => {
cy.intercept("POST", "/api/dataset").as("dataset");
// Sorting by header
cy.wait(1000)
.get(".Icon-table2")
.click();
cy.get(".cellData")
.eq(2)
.as("firstTableCell");
cy.get("@firstTableCell").contains("Aerodynamic Bronze Hat");
cy.get(".cellData")
.contains("Average of Rating")
.click();
cy.icon("arrow_down").click();
cy.wait("@dataset");
cy.get("@firstTableCell").contains("Ergonomic Wool Bag");
// Sorting by notebook editor
cy.icon("notebook").click();
cy.findByText("Sort")
.next() // not ideal, but at least we're making sure 'x' is related to 'Sort'
.within(() => {
cy.icon("close") // Remove previously applied sorting
.click();
});
// Add new sort (by Title)
cy.findByText("Sort").click();
popover().within(() => {
cy.findAllByText("Title").click();
});
visualize();
cy.get("@firstTableCell").contains("Aerodynamic Bronze Hat");
cy.icon("table2").click();
});
it("should filter via the sidebar, header, and notebook editor", () => {
// Sidebar filter
cy.wait(1000)
.findByText("Visualize")
.should("not.exist");
cy.findAllByText("Filter")
.first()
.click();
cy.findByText("Category").click();
cy.findByText("Is");
cy.findByText("Gadget").click();
cy.findByText("Add filter").click();
cy.findByText("Vendor is not empty");
// Can delete filter in header
cy.findByText("Category is Gadget").click(140, 10);
cy.findByText("Category is Gadget").should("not.exist");
// Notebook editor filter
cy.icon("notebook").click();
cy.wait(1000)
.get(".Icon-filter")
.click();
cy.icon("int").click();
cy.findByText("Equal to").click();
cy.findByText("Greater than or equal to").click();
cy.get("input[placeholder='Enter a number']").type("5");
cy.findByText("Add filter").click();
visualize();
cy.get("svg");
cy.findByText("Average of Rating is greater than or equal to 5");
// Can delete filter in header again
cy.findByText("Average of Rating is greater than or equal to 5").click(
300,
10,
);
cy.findByText("Average of Rating is greater than or equal to 5").should(
"not.exist",
);
// Header filter
cy.get(".TableInteractive-cellWrapper--lastColumn")
.eq(1)
.contains("0");
cy.findAllByText("Average of Rating").click();
cy.findByText("Filter by this column").click();
cy.findByText("Equal to").click();
cy.findByText("Greater than or equal to").click();
cy.get("input[placeholder='Enter a number']").type("4");
cy.findByText("Add filter").click();
cy.get(".TableInteractive-cellWrapper--lastColumn")
.eq(1)
.contains("4.2");
// Can minimize Filter dispay in header
cy.icon("filter")
.first()
.click();
cy.findByText("Vendor is not empty").should("not.exist");
});
it("should summarize via both the sidebar and notebook editor", () => {
cy.intercept("POST", "/api/dataset").as("dataset");
// Sidebar summary
summarize();
cy.findByText("Category").click();
cy.wait("@dataset");
cy.findByText("Done").click();
// Delete summary from sidebar
summarize();
sidebar().within(() => {
cy.icon("close")
.first()
.click();
});
cy.wait("@dataset");
cy.findByText("Done").click();
cy.findByText("Average of Rating by Category").should("not.exist");
cy.get("span")
.findByText("Group")
.should("not.exist");
// Notebook editor summary
cy.icon("notebook").click();
summarize({ mode: "notebook" });
cy.findByText("Count of rows").click();
cy.findByText("Pick a column to group by").click();
cy.icon("calendar").click();
visualize();
cy.get("svg").should("be.visible");
cy.findAllByText("Created At");
});
it.skip("should be able to use all notebook editor functions", () => {
// Custom JOINs
cy.icon("notebook").click();
cy.icon("join_left_outer").click();
cy.findByText("People").click(); // column selection happens automatcially
visualize();
cy.findByText("User → ID");
cy.findByText("Created At");
cy.findByText("Orders + People");
// Setting Row limit
cy.icon("notebook").click();
cy.findByText("Row limit").click();
cy.get("input[type='number']").type("10");
visualize();
cy.get(".TableInteractive-cellWrapper--firstColumn").should(
"have.length",
11,
);
// Can view the SQL query
cy.icon("notebook", { timeout: 20000 }).click();
cy.icon("sql")
.last()
.click();
cy.contains('SELECT "source"."ID"');
cy.icon("close")
.last()
.click();
});
it.skip("should be able to do header actions", () => {
// Reset question
cy.findAllByText("Orders")
.first()
.click();
cy.findByText("Products").click();
// Distinctions
// *** This test needs to be improved with variables that will change if the Sample data changes
visualize();
cy.findByText("Category").click();
cy.findByText("Distinct values").click();
cy.findByText("4");
cy.findByText("3").should("not.exist");
cy.icon("close")
.last()
.click();
// Distributing
cy.findByText("Rating").click();
cy.findByText("Distribution").click();
cy.icon("table2").click();
cy.findByText("Count");
cy.findByText("Created At").should("not.exist");
cy.get(".cellData").should("have.length", 14);
// Formatting
// Refresh works
cy.icon("refresh")
.first()
.click();
// *** check that refresh has happened
cy.findByText("Sample Database");
});
it.skip("should ensuring that header actions are appropriate for different data types", () => {
// *** Currently Longitude is an integer while zip codes and dates are strings in terms of header options
cy.findAllByText("Summarize")
.first()
.click();
sidebar()
.find(".Icon-close")
.first()
.click();
cy.findByText("Done").click();
// ID column
cy.findByText("ID").click();
cy.icon("arrow_up");
cy.icon("arrow_down");
cy.findByText("Distinct values");
cy.findByText("Distribution").should("not.exist");
cy.icon("filter");
cy.findByText("Formatting");
// String column
cy.findAllByText("Title")
.last()
.click();
cy.icon("arrow_up");
cy.icon("arrow_down");
cy.findByText("Distinct values");
cy.findByText("Distribution");
cy.icon("filter");
cy.findByText("Formatting");
cy.get(".PopoverBody")
.findByText("Sum")
.should("not.exist");
// Integer column
cy.findAllByText("Price")
.last()
.click();
cy.icon("arrow_up");
cy.icon("arrow_down");
cy.findByText("Sum");
cy.findByText("Min");
cy.findByText("Max");
cy.findByText("Distinct values");
cy.findByText("Sum over time");
cy.findByText("Distribution");
cy.icon("filter");
cy.findByText("Formatting");
// Longitude column (first switch to people table)
cy.icon("notebook").click();
cy.findAllByText("Products")
.last()
.click();
cy.findByText("People").click();
visualize();
cy.findByText("Longitude").click();
cy.icon("arrow_up");
cy.icon("arrow_down");
cy.findByText("Sum");
cy.findByText("Min");
cy.findByText("Max");
cy.findByText("Distinct values");
cy.findByText("Sum over time");
cy.findByText("Distribution");
cy.icon("filter");
cy.findByText("Formatting");
// Boolean column contians appropriate options
// *** The sample data does not contain any boolean columns
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment