mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
* Fix _exists_ filter handling * Add functional test Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
80349f282d
commit
45cdc44eba
3 changed files with 33 additions and 7 deletions
|
@ -103,11 +103,12 @@ export function generateFilters(
|
|||
filter = existing;
|
||||
} else {
|
||||
const tmpIndexPattern = { id: index } as IIndexPattern;
|
||||
|
||||
// exists filter special case: fieldname = '_exists' and value = fieldname
|
||||
const filterType = fieldName === '_exists_' ? FILTERS.EXISTS : FILTERS.PHRASE;
|
||||
const actualFieldObj = fieldName === '_exists_' ? ({ name: value } as IFieldType) : fieldObj;
|
||||
filter = buildFilter(
|
||||
tmpIndexPattern,
|
||||
fieldObj,
|
||||
actualFieldObj,
|
||||
filterType,
|
||||
negate,
|
||||
false,
|
||||
|
|
|
@ -39,14 +39,13 @@ export default function({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
it('should be addable via expanded doc table rows', async function() {
|
||||
it('inclusive filter should be addable via expanded doc table rows', async function() {
|
||||
await docTable.toggleRowExpanded({ isAnchorRow: true });
|
||||
|
||||
await retry.try(async () => {
|
||||
const anchorDetailsRow = await docTable.getAnchorDetailsRow();
|
||||
await docTable.addInclusiveFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
|
||||
await PageObjects.context.waitUntilContextLoadingHasFinished();
|
||||
// await docTable.toggleRowExpanded({ isAnchorRow: true });
|
||||
expect(
|
||||
await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, true)
|
||||
).to.be(true);
|
||||
|
@ -58,7 +57,7 @@ export default function({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
it('should be toggleable via the filter bar', async function() {
|
||||
it('inclusive filter should be toggleable via the filter bar', async function() {
|
||||
await filterBar.addFilter(TEST_ANCHOR_FILTER_FIELD, 'IS', TEST_ANCHOR_FILTER_VALUE);
|
||||
await PageObjects.context.waitUntilContextLoadingHasFinished();
|
||||
// disable filter
|
||||
|
@ -76,5 +75,16 @@ export default function({ getService, getPageObjects }) {
|
|||
expect(hasOnlyFilteredRows).to.be(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('filter for presence should be addable via expanded doc table rows', async function() {
|
||||
await docTable.toggleRowExpanded({ isAnchorRow: true });
|
||||
|
||||
await retry.try(async () => {
|
||||
const anchorDetailsRow = await docTable.getAnchorDetailsRow();
|
||||
await docTable.addExistsFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
|
||||
await PageObjects.context.waitUntilContextLoadingHasFinished();
|
||||
expect(await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, 'exists', true)).to.be(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -98,13 +98,12 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
|
|||
const $ = await table.parseDomContent();
|
||||
const rowLocator = options.isAnchorRow ? '~docTableAnchorRow' : '~docTableRow';
|
||||
const rows = $.findTestSubjects(rowLocator).toArray();
|
||||
const fields = rows.map((row: any) =>
|
||||
return rows.map((row: any) =>
|
||||
$(row)
|
||||
.find('[data-test-subj~="docTableField"]')
|
||||
.toArray()
|
||||
.map((field: any) => $(field).text())
|
||||
);
|
||||
return fields;
|
||||
}
|
||||
|
||||
public async getHeaderFields(): Promise<string[]> {
|
||||
|
@ -144,6 +143,22 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont
|
|||
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
|
||||
}
|
||||
|
||||
public async getAddExistsFilterButton(
|
||||
tableDocViewRow: WebElementWrapper
|
||||
): Promise<WebElementWrapper> {
|
||||
return await tableDocViewRow.findByCssSelector(`[data-test-subj~="addExistsFilterButton"]`);
|
||||
}
|
||||
|
||||
public async addExistsFilter(
|
||||
detailsRow: WebElementWrapper,
|
||||
fieldName: WebElementWrapper
|
||||
): Promise<void> {
|
||||
const tableDocViewRow = await this.getTableDocViewRow(detailsRow, fieldName);
|
||||
const addInclusiveFilterButton = await this.getAddExistsFilterButton(tableDocViewRow);
|
||||
await addInclusiveFilterButton.click();
|
||||
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
|
||||
}
|
||||
|
||||
public async toggleRowExpanded(
|
||||
options: SelectOptions = { isAnchorRow: false, rowIndex: 0 }
|
||||
): Promise<WebElementWrapper> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue