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

[Dashboard filters coverage] Add initial set of tests for dashboard location filters (#17191)

parent 7748d094
Branches
Tags
No related merge requests found
import {
restore,
popover,
mockSessionProperty,
filterWidget,
editDashboard,
saveDashboard,
setFilter,
} from "__support__/e2e/cypress";
import { DASHBOARD_LOCATION_FILTERS } from "./helpers/e2e-dashboard-filter-data-objects";
import { addWidgetStringFilter } from "../native-filters/helpers/e2e-field-filter-helpers";
Object.entries(DASHBOARD_LOCATION_FILTERS).forEach(
([filter, { value, representativeResult }]) => {
describe("scenarios > dashboard > filters > location", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
mockSessionProperty("field-filter-operators-enabled?", true);
cy.visit("/dashboard/1");
editDashboard();
setFilter("Location", filter);
cy.findByText("Column to filter on")
.next("a")
.click();
popover()
.contains("City")
.click();
});
it(`should work for "${filter}" when set through the filter widget`, () => {
saveDashboard();
filterWidget().click();
addWidgetStringFilter(value);
cy.get(".Card").within(() => {
cy.contains(representativeResult);
});
});
it(`should work for "${filter}" when set as the default filter`, () => {
cy.findByText("Default value")
.next()
.click();
addWidgetStringFilter(value);
saveDashboard();
cy.get(".Card").within(() => {
cy.contains(representativeResult);
});
});
});
},
);
......@@ -58,3 +58,30 @@ export const DASHBOARD_NUMBER_FILTERS = {
representativeResult: "29.8",
},
};
export const DASHBOARD_LOCATION_FILTERS = {
Dropdown: {
value: "Abbeville",
representativeResult: "1510",
},
"Is not": {
value: "Abbeville",
representativeResult: "37.65",
},
Contains: {
value: "Abb",
representativeResult: "1510",
},
"Does not contain": {
value: "Abb",
representativeResult: "37.65",
},
"Starts with": {
value: "Abb",
representativeResult: "1510",
},
"Ends with": {
value: "y",
representativeResult: "115.24",
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment