diff --git a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx index 080fe6df352c7..c8cc85bde823e 100644 --- a/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/multi_select_filter.tsx @@ -155,6 +155,10 @@ export const MultiSelectFilter = ({ closePopover={() => setIsPopoverOpen(false)} panelPaddingSize="none" repositionOnScroll + panelProps={{ + 'data-test-subj': `options-filter-popover-panel-${id}`, + }} + data-test-subj={`options-filter-popover-${id}`} > {isInvalid && ( <> diff --git a/x-pack/test/functional/services/cases/list.ts b/x-pack/test/functional/services/cases/list.ts index bce45cb13280b..b449b6f18438a 100644 --- a/x-pack/test/functional/services/cases/list.ts +++ b/x-pack/test/functional/services/cases/list.ts @@ -179,10 +179,6 @@ export function CasesTableServiceProvider( await testSubjects.click(`options-filter-popover-item-${status}`); // to close the popup await testSubjects.click('options-filter-popover-button-status'); - - await testSubjects.missingOrFail(`options-filter-popover-item-${status}`, { - timeout: 5000, - }); }, async filterBySeverity(severity: CaseSeverity) { @@ -202,18 +198,22 @@ export function CasesTableServiceProvider( await casesCommon.selectFirstRowInAssigneesPopover(); }, - async filterByOwner( - owner: string, - options: { popupAlreadyOpen: boolean } = { popupAlreadyOpen: false } - ) { - if (!options.popupAlreadyOpen) { - await common.clickAndValidate( - 'options-filter-popover-button-owner', - `options-filter-popover-item-${owner}` - ); + async filterByOwner(owner: string) { + const isAlreadyOpen = await testSubjects.exists('options-filter-popover-panel-owner'); + + if (isAlreadyOpen) { + await testSubjects.click(`options-filter-popover-item-${owner}`); + await header.waitUntilLoadingHasFinished(); + return; } + await retry.waitFor(`filterByOwner popover opened`, async () => { + await testSubjects.click('options-filter-popover-button-owner'); + return await testSubjects.exists('options-filter-popover-panel-owner'); + }); + await testSubjects.click(`options-filter-popover-item-${owner}`); + await header.waitUntilLoadingHasFinished(); }, async refreshTable() { diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts index 8909d8cea2ec5..c45df81316e81 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts @@ -62,6 +62,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const lens = getPageObject('lens'); const listingTable = getService('listingTable'); const toasts = getService('toasts'); + const browser = getService('browser'); const createAttachmentAndNavigate = async (attachment: AttachmentRequest) => { const caseData = await cases.api.createCase({ @@ -262,8 +263,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/178690 - describe.skip('Modal', () => { + describe('Modal', () => { const createdCases = new Map(); const openModal = async () => { @@ -273,6 +273,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { const closeModal = async () => { await find.clickByCssSelector('[data-test-subj="all-cases-modal"] > button'); + await testSubjects.missingOrFail('all-cases-modal'); }; before(async () => { @@ -282,6 +283,10 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { } }); + beforeEach(async () => { + await browser.refresh(); + }); + after(async () => { await deleteAllCaseItems(es); }); @@ -292,29 +297,22 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await testSubjects.existOrFail('options-filter-popover-button-owner'); for (const [, currentCaseId] of createdCases.entries()) { - await testSubjects.existOrFail(`cases-table-row-${currentCaseId}`); + await cases.casesTable.getCaseById(currentCaseId); } await closeModal(); }); - it('filters correctly', async () => { + it('filters correctly with owner cases', async () => { for (const [owner, currentCaseId] of createdCases.entries()) { await openModal(); - await cases.casesTable.filterByOwner(owner); - await cases.casesTable.waitForTableToFinishLoading(); - await testSubjects.existOrFail(`cases-table-row-${currentCaseId}`); - + await cases.casesTable.getCaseById(currentCaseId); /** - * We ensure that the other cases are not shown + * The select button matched the query of the + * [data-test-subj*="cases-table-row-" query */ - for (const otherCaseId of createdCases.values()) { - if (otherCaseId !== currentCaseId) { - await testSubjects.missingOrFail(`cases-table-row-${otherCaseId}`); - } - } - + await cases.casesTable.validateCasesTableHasNthRows(2); await closeModal(); } }); @@ -322,16 +320,22 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { it('filters with multiple selection', async () => { await openModal(); - let popupAlreadyOpen = false; for (const [owner] of createdCases.entries()) { - await cases.casesTable.filterByOwner(owner, { popupAlreadyOpen }); - popupAlreadyOpen = true; + await cases.casesTable.filterByOwner(owner); } + await cases.casesTable.waitForTableToFinishLoading(); + /** + * The select button matched the query of the + * [data-test-subj*="cases-table-row-" query + */ + await cases.casesTable.validateCasesTableHasNthRows(6); + for (const caseId of createdCases.values()) { - await testSubjects.existOrFail(`cases-table-row-${caseId}`); + await cases.casesTable.getCaseById(caseId); } + await closeModal(); }); @@ -340,7 +344,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await openModal(); await cases.casesTable.waitForTableToFinishLoading(); - await testSubjects.existOrFail(`cases-table-row-${currentCaseId}`); + await cases.casesTable.getCaseById(currentCaseId); await testSubjects.click(`cases-table-row-select-${currentCaseId}`); await cases.common.expectToasterToContain('has been updated'); diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts index c6704ea2d3466..f1b4e4ea8485a 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts @@ -284,8 +284,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/178991 - describe.skip('filtering', () => { + describe('filtering', () => { const caseTitle = 'matchme'; let caseIds: string[] = []; const profiles: UserProfile[] = []; @@ -753,8 +752,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { expect(await testSubjects.exists('all-cases-clear-filters-link-icon')).to.be(false); }); - // FLAKY: https://github.com/elastic/kibana/issues/176716 - describe.skip('assignees filtering', () => { + describe('assignees filtering', () => { it('filters cases by the first cases all user assignee', async () => { await cases.casesTable.filterByAssignee('all'); await cases.casesTable.validateCasesTableHasNthRows(1); @@ -796,8 +794,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/179016 - describe.skip('severity filtering', () => { + describe('severity filtering', () => { before(async () => { await cases.navigation.navigateToApp(); await cases.api.createCase({ severity: CaseSeverity.LOW });