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 part2 #17283

Merged
merged 4 commits into from
Nov 1, 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 @@ -132,6 +132,69 @@ describe('Nativefilters Sanity test', () => {
.click();
cy.get(nativeFilters.modal.container).should('not.exist');
});
it('User can delete a native filter', () => {
cy.get(nativeFilters.createFilterButton).click({ force: true });
cy.get(nativeFilters.modal.container).should('be.visible');

cy.get(nativeFilters.filtersList.removeIcon).first().click();
cy.contains('Restore Filter').should('not.exist', { timeout: 10000 });

cy.get(nativeFilters.modal.footer)
.contains('Save')
.should('be.visible')
.click();
});
it('User can cancel changes in native filter', () => {
cy.get(nativeFilters.createFilterButton).click({ force: true });
cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.filterName)
.click()
.type('suffix');
cy.get(nativeFilters.modal.container)
.find(nativeFilters.filtersPanel.datasetName)
.should('be.visible');
cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.cancelButton)
.should('be.visible')
.click();
cy.get(nativeFilters.modal.alertXUnsavedFilters).should('be.visible');
// remove native filter
cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.yesCancelButton)
.contains('cancel')
.should('be.visible')
.click({ force: true });

cy.get(nativeFilters.createFilterButton).click({ force: true });
cy.get(nativeFilters.filtersList.removeIcon).first().click();
cy.contains('You have removed this filter.').should('be.visible');
cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.saveButton)
.should('be.visible')
.click();
cy.get(nativeFilters.filtersPanel.filterName).should('not.exist');
});
it('User can cancel creating a new filter', () => {
cy.get(nativeFilters.filterFromDashboardView.expand)
.should('be.visible')
.click();
cy.get(nativeFilters.createFilterButton).should('be.visible').click();
cy.get(nativeFilters.modal.container).should('be.visible');

cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.cancelButton)
.should('be.visible')
.click();
cy.get(nativeFilters.modal.alertXUnsavedFilters)
.should('have.text', 'There are unsaved changes.')
.should('be.visible');
cy.get(nativeFilters.modal.footer)
.find(nativeFilters.modal.yesCancelButton)
.contains('cancel')
.should('be.visible')
.click();
cy.get(nativeFilters.modal.container).should('not.exist');
});
});

xdescribe('Nativefilters', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ export const nativeFilters = {
footer: '.ant-modal-footer',
saveButton: dataTestLocator('native-filter-modal-save-button'),
cancelButton: dataTestLocator('native-filter-modal-cancel-button'),
yesCancelButton: '.css-1mljg09',
yesCancelButton: '[type="button"]',
alertXUnsavedFilters: '.ant-alert-message',
tabsList: {
tabsContainer: '[class="ant-tabs-nav-list"]',
tab: '.ant-tabs-tab',
removeTab: '.ant-tabs-tab-remove',
removeTab: '[aria-label="trash"]',
},
addFilter: dataTestLocator('add-filter-button'),
},
Expand Down Expand Up @@ -353,7 +353,7 @@ export const nativeFilters = {
listItemNotActive: '[class="ant-tabs-tab ant-tabs-tab-with-remove"]',
listItemActive:
'[class="ant-tabs-tab ant-tabs-tab-with-remove ant-tabs-tab-active"]',
removeIcon: '[aria-label="remove"]',
removeIcon: '[aria-label="trash"]',
},
filterItem: dataTestLocator('form-item-value'),
filterItemDropdown: '.ant-select-selection-search',
Expand Down