Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown param search fix #5304

Merged
merged 14 commits into from
Dec 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions client/cypress/integration/query/parameter_spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
function openAndSearchAntdDropdown(paramOption) {
// assures filters are working
cy.getByTestId("ParameterValueInput").type(paramOption);

// only the filtered option should be on the DOM
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, your function doesn't enforce this 😝

cy.get(".ant-select-item-option").each($option => {
expect($option).to.contain(paramOption);
});

cy.getByTestId("ParameterValueInput")
.find("input")
.clear();
}
describe("Parameter", () => {
const expectDirtyStateChange = edit => {
cy.getByTestId("ParameterName-test-parameter")
Expand Down Expand Up @@ -91,7 +104,7 @@ describe("Parameter", () => {
});
});

describe.only("Dropdown Parameter", () => {
describe("Dropdown Parameter", () => {
beforeEach(() => {
const queryData = {
name: "Dropdown Parameter",
Expand Down Expand Up @@ -120,15 +133,6 @@ describe("Parameter", () => {
cy.getByTestId("TableVisualization").should("contain", "value2");
});

it("supports filters", () => {
cy.getByTestId("ParameterValueInput").type("value1");

// only the filtered option should be on the DOM
cy.get(".ant-select-item-option").each($option => {
expect($option).to.contain("value1");
});
});

it("supports multi-selection", () => {
cy.clickThrough(`
ParameterSettings-test-parameter
Expand All @@ -149,6 +153,8 @@ describe("Parameter", () => {
}
});

openAndSearchAntdDropdown("value1"); // asserts option filter prop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to place it in the "updates the results after selecting a value", no?

it("updates the results after selecting a value", () => {
  /*cy.getByTestId("ParameterName-test-parameter")
    .find(".ant-select")
    .click();*/ // remove

  openAndSearchAntdDropdown("ParameterName-test-parameter", "value2"); // asserts option filter prop

  cy.contains(".ant-select-item-option", "value2").click();

  cy.getByTestId("ParameterApplyButton").click();
  // ensure that query is being executed
  cy.getByTestId("QueryExecutionStatus").should("exist");

  cy.getByTestId("TableVisualization").should("contain", "value2");
});


cy.getByTestId("QueryEditor").click(); // just to close the select menu

cy.getByTestId("ParameterApplyButton").click();
Expand Down Expand Up @@ -247,6 +253,8 @@ describe("Parameter", () => {
cy.wrap($option).click();
});

openAndSearchAntdDropdown("value1"); // asserts option filter prop
Copy link
Member

@gabrieldutra gabrieldutra Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially thought the Query Based Parameters already had a similar test for only 1 value selection 😅. But I guess we can just create a new one based on the Enum parameter "updates the results after selecting a value"?


cy.getByTestId("QueryEditor").click(); // just to close the select menu

cy.getByTestId("ParameterApplyButton").click();
Expand Down