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

test: add native filter default value e2e #17398

Merged
merged 3 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ describe('Nativefilters Sanity test', () => {
cy.get(nativeFilters.modal.container).should('be.visible');
});
it('User can add a new native filter', () => {
cy.get(nativeFilters.filterFromDashboardView.expand)
.should('be.visible')
.click();
cy.get(nativeFilters.filterFromDashboardView.expand).click({ force: true });
cy.get(nativeFilters.createFilterButton).should('be.visible').click();
cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.filterName)
Expand Down Expand Up @@ -208,7 +206,7 @@ describe('Nativefilters Sanity test', () => {
cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.datasetName)
.click()
.type("World Bank's Data{enter}");
.type('wb_health_population{enter}');

cy.get('.loading inline-centered css-101mkpk').should('not.exist');
// hack for unclickable country_name
Expand Down Expand Up @@ -288,6 +286,50 @@ describe('Nativefilters Sanity test', () => {
'By default, each filter loads at most 1000 choices at the initial page load. Check this box if you have more than 1000 filter values and want to enable dynamically searching that loads filter values as users type (may add stress to your database).',
);
});
it("User can check 'Filter has default value'", () => {
cy.get(nativeFilters.filterFromDashboardView.expand).click({ force: true });
cy.get(nativeFilters.createFilterButton)
.should('be.visible')
.click({ force: true });
cy.get(nativeFilters.modal.container).should('be.visible');

cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.datasetName)
.click()
.type('wb_health_population{enter}');
cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.filterName)
.click()
.type('country_name');
// hack for unclickable datetime
cy.wait(5000);
cy.get(nativeFilters.filtersPanel.filterInfoInput)
.last()
.click({ force: true });
cy.get(nativeFilters.filtersPanel.filterInfoInput)
.last()
.type('country_name');
cy.get(nativeFilters.filtersPanel.inputDropdown)
.should('be.visible', { timeout: 20000 })
.last()
.click();
cy.contains('Filter has default value').click();
cy.contains('Default value is required');
cy.get(nativeFilters.modal.defaultValueCheck).should('be.visible');
cy.get(nativeFilters.filtersPanel.columnEmptyInput)
.last()
.type('United States{enter}');
cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.saveButton)
.should('be.visible')
.click({ force: true });
cy.get(nativeFilters.filterFromDashboardView.filterContent).contains(
'United States',
);
cy.get('.line').within(() => {
cy.contains('United States').should('be.visible');
});
});
});

xdescribe('Nativefilters', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export const nativeFilters = {
removeTab: '[aria-label="trash"]',
},
addFilter: dataTestLocator('add-filter-button'),
defaultValueCheck: '.ant-checkbox-checked',
},
filtersPanel: {
filterName: dataTestLocator('filters-config-modal__name-input'),
Expand All @@ -339,6 +340,7 @@ export const nativeFilters = {
expand: dataTestLocator('filter-bar__expand-button'),
collapse: dataTestLocator('filter-bar__collapse-button'),
filterName: dataTestLocator('filter-control-name'),
filterContent: '.ant-select-selection-item-content',
},
createFilterButton: dataTestLocator('filter-bar__create-filter'),
removeFilter: '[aria-label="remove"]',
Expand Down