From a8d4145afbf66c386fb46d98937eb081eb056565 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 30 Apr 2021 10:29:41 +0200 Subject: [PATCH] [Discover] Revert default grid back to legacy (#98508) --- src/plugins/discover/server/ui_settings.ts | 2 +- test/examples/embeddables/dashboard.ts | 2 +- .../apps/dashboard/dashboard_filter_bar.ts | 28 +++++-- .../apps/dashboard/dashboard_time_picker.ts | 40 +++++++--- .../apps/dashboard/saved_search_embeddable.ts | 2 +- .../apps/discover/_data_grid_doc_table.ts | 4 +- .../apps/discover/_date_nanos_mixed.ts | 17 +++-- test/functional/apps/discover/_field_data.ts | 4 +- .../discover/_field_data_with_fields_api.ts | 4 +- .../functional/apps/discover/_large_string.ts | 15 ++-- .../apps/discover/_runtime_fields_editor.ts | 10 ++- .../functional/apps/discover/_shared_links.ts | 12 +-- test/functional/apps/home/_sample_data.ts | 2 +- .../functional/page_objects/dashboard_page.ts | 18 +++-- test/functional/page_objects/discover_page.ts | 74 ++++++++++++++++--- .../services/dashboard/expectations.ts | 14 +++- test/functional/services/doc_table.ts | 4 + .../apps/dashboard/_async_dashboard.ts | 2 +- .../apps/security/doc_level_security_roles.js | 4 +- .../tests/apps/discover/async_search.ts | 10 ++- 20 files changed, 184 insertions(+), 84 deletions(-) diff --git a/src/plugins/discover/server/ui_settings.ts b/src/plugins/discover/server/ui_settings.ts index 5f361ba2711cbf..3b34bbdbd54fd8 100644 --- a/src/plugins/discover/server/ui_settings.ts +++ b/src/plugins/discover/server/ui_settings.ts @@ -157,7 +157,7 @@ export const getUiSettings: () => Record = () => ({ name: i18n.translate('discover.advancedSettings.docTableVersionName', { defaultMessage: 'Use legacy table', }), - value: false, + value: true, description: i18n.translate('discover.advancedSettings.docTableVersionDescription', { defaultMessage: 'Discover uses a new table layout that includes better data sorting, drag-and-drop columns, and a full screen ' + diff --git a/test/examples/embeddables/dashboard.ts b/test/examples/embeddables/dashboard.ts index 70e5ba115c3af8..597846ab6a43d4 100644 --- a/test/examples/embeddables/dashboard.ts +++ b/test/examples/embeddables/dashboard.ts @@ -117,7 +117,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide }); it('saved search', async () => { - await dashboardExpect.savedSearchRowCount(11); + await dashboardExpect.savedSearchRowCount(10); }); }); diff --git a/test/functional/apps/dashboard/dashboard_filter_bar.ts b/test/functional/apps/dashboard/dashboard_filter_bar.ts index ad7e4be9b19352..c2d6cc4c38b6be 100644 --- a/test/functional/apps/dashboard/dashboard_filter_bar.ts +++ b/test/functional/apps/dashboard/dashboard_filter_bar.ts @@ -20,7 +20,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const browser = getService('browser'); - const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); + const PageObjects = getPageObjects([ + 'common', + 'dashboard', + 'discover', + 'header', + 'visualize', + 'timePicker', + ]); describe('dashboard filter bar', () => { before(async () => { @@ -174,13 +181,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('are added when a cell magnifying glass is clicked', async function () { await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search'); await PageObjects.dashboard.waitForRenderComplete(); - const documentCell = await dataGrid.getCellElement(1, 3); - await documentCell.click(); - const expandCellContentButton = await documentCell.findByClassName( - 'euiDataGridRowCell__expandButtonIcon' - ); - await expandCellContentButton.click(); - await testSubjects.click('filterForButton'); + const isLegacyDefault = PageObjects.discover.useLegacyTable(); + if (isLegacyDefault) { + await testSubjects.click('docTableCellFilter'); + } else { + const documentCell = await dataGrid.getCellElement(1, 3); + await documentCell.click(); + const expandCellContentButton = await documentCell.findByClassName( + 'euiDataGridRowCell__expandButtonIcon' + ); + await expandCellContentButton.click(); + await testSubjects.click('filterForButton'); + } const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); }); diff --git a/test/functional/apps/dashboard/dashboard_time_picker.ts b/test/functional/apps/dashboard/dashboard_time_picker.ts index eb7c05079fb448..8a25f941be70f2 100644 --- a/test/functional/apps/dashboard/dashboard_time_picker.ts +++ b/test/functional/apps/dashboard/dashboard_time_picker.ts @@ -12,9 +12,16 @@ import { PIE_CHART_VIS_NAME } from '../../page_objects/dashboard_page'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { + const dashboardExpect = getService('dashboardExpect'); const pieChart = getService('pieChart'); const dashboardVisualizations = getService('dashboardVisualizations'); - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'timePicker']); + const PageObjects = getPageObjects([ + 'dashboard', + 'header', + 'visualize', + 'timePicker', + 'discover', + ]); const browser = getService('browser'); const log = getService('log'); const kibanaServer = getService('kibanaServer'); @@ -49,16 +56,29 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { name: 'saved search', fields: ['bytes', 'agent'], }); - const initialRows = await dataGrid.getDocTableRows(); - expect(initialRows.length).to.be(11); - // Set to time range with no data - await PageObjects.timePicker.setAbsoluteRange( - 'Jan 1, 2000 @ 00:00:00.000', - 'Jan 1, 2000 @ 01:00:00.000' - ); - const noResults = await dataGrid.hasNoResults(); - expect(noResults).to.be.ok(); + const isLegacyDefault = await PageObjects.discover.useLegacyTable(); + if (isLegacyDefault) { + await dashboardExpect.docTableFieldCount(150); + + // Set to time range with no data + await PageObjects.timePicker.setAbsoluteRange( + 'Jan 1, 2000 @ 00:00:00.000', + 'Jan 1, 2000 @ 01:00:00.000' + ); + await dashboardExpect.docTableFieldCount(0); + } else { + const initialRows = await dataGrid.getDocTableRows(); + expect(initialRows.length).to.above(10); + + // Set to time range with no data + await PageObjects.timePicker.setAbsoluteRange( + 'Jan 1, 2000 @ 00:00:00.000', + 'Jan 1, 2000 @ 01:00:00.000' + ); + const noResults = await dataGrid.hasNoResults(); + expect(noResults).to.be.ok(); + } }); it('Timepicker start, end, interval values are set by url', async () => { diff --git a/test/functional/apps/dashboard/saved_search_embeddable.ts b/test/functional/apps/dashboard/saved_search_embeddable.ts index bea5c7d7491623..098f6ccc00d94a 100644 --- a/test/functional/apps/dashboard/saved_search_embeddable.ts +++ b/test/functional/apps/dashboard/saved_search_embeddable.ts @@ -45,7 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const marks = $('mark') .toArray() .map((mark) => $(mark).text()); - expect(marks.length).to.be(11); + expect(marks.length).to.above(10); }); it('removing a filter removes highlights', async function () { diff --git a/test/functional/apps/discover/_data_grid_doc_table.ts b/test/functional/apps/discover/_data_grid_doc_table.ts index feecc7f5355190..f0d6abb23d30fb 100644 --- a/test/functional/apps/discover/_data_grid_doc_table.ts +++ b/test/functional/apps/discover/_data_grid_doc_table.ts @@ -40,10 +40,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await kibanaServer.uiSettings.replace({}); }); - it('should show the first 11 rows by default', async function () { + it('should show rows by default', async function () { // with the default range the number of hits is ~14000 const rows = await dataGrid.getDocTableRows(); - expect(rows.length).to.be(11); + expect(rows.length).to.be.above(0); }); it('should refresh the table content when changing time window', async function () { diff --git a/test/functional/apps/discover/_date_nanos_mixed.ts b/test/functional/apps/discover/_date_nanos_mixed.ts index 47c3a19c069868..a3402cc733431a 100644 --- a/test/functional/apps/discover/_date_nanos_mixed.ts +++ b/test/functional/apps/discover/_date_nanos_mixed.ts @@ -33,14 +33,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('shows a list of records of indices with date & date_nanos fields in the right order', async function () { - const rowData1 = await PageObjects.discover.getDocTableField(1); - expect(rowData1).to.be('Jan 1, 2019 @ 12:10:30.124000000'); - const rowData2 = await PageObjects.discover.getDocTableField(2); - expect(rowData2).to.be('Jan 1, 2019 @ 12:10:30.123498765'); - const rowData3 = await PageObjects.discover.getDocTableField(3); - expect(rowData3).to.be('Jan 1, 2019 @ 12:10:30.123456789'); - const rowData4 = await PageObjects.discover.getDocTableField(4); - expect(rowData4).to.be('Jan 1, 2019 @ 12:10:30.123000000'); + const isLegacy = await PageObjects.discover.useLegacyTable(); + const rowData1 = await PageObjects.discover.getDocTableIndex(1); + expect(rowData1).to.contain('Jan 1, 2019 @ 12:10:30.124000000'); + const rowData2 = await PageObjects.discover.getDocTableIndex(isLegacy ? 3 : 2); + expect(rowData2).to.contain('Jan 1, 2019 @ 12:10:30.123498765'); + const rowData3 = await PageObjects.discover.getDocTableIndex(isLegacy ? 5 : 3); + expect(rowData3).to.contain('Jan 1, 2019 @ 12:10:30.123456789'); + const rowData4 = await PageObjects.discover.getDocTableIndex(isLegacy ? 7 : 4); + expect(rowData4).to.contain('Jan 1, 2019 @ 12:10:30.123000000'); }); }); } diff --git a/test/functional/apps/discover/_field_data.ts b/test/functional/apps/discover/_field_data.ts index 265c39678ce9d4..1831fb9aa73b1f 100644 --- a/test/functional/apps/discover/_field_data.ts +++ b/test/functional/apps/discover/_field_data.ts @@ -90,8 +90,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent'); }); - const field = await PageObjects.discover.getDocTableField(1, 3); - expect(field).to.include.string('"og:description":'); + const field = await PageObjects.discover.getDocTableIndex(1); + expect(field).to.contain('og:description'); const marks = await PageObjects.discover.getMarks(); expect(marks.length).to.be(0); diff --git a/test/functional/apps/discover/_field_data_with_fields_api.ts b/test/functional/apps/discover/_field_data_with_fields_api.ts index 92d36a243370bb..319722e0c88422 100644 --- a/test/functional/apps/discover/_field_data_with_fields_api.ts +++ b/test/functional/apps/discover/_field_data_with_fields_api.ts @@ -94,8 +94,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent'); }); - const field = await PageObjects.discover.getDocTableField(1, 3); - expect(field).to.include.string('relatedContent.url'); + const field = await PageObjects.discover.getDocTableIndex(1); + expect(field).to.contain('relatedContent.url'); const marks = await PageObjects.discover.getMarks(); expect(marks.length).to.be.above(0); diff --git a/test/functional/apps/discover/_large_string.ts b/test/functional/apps/discover/_large_string.ts index 9383f8fdc8c77b..0f6be04212a623 100644 --- a/test/functional/apps/discover/_large_string.ts +++ b/test/functional/apps/discover/_large_string.ts @@ -29,25 +29,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('verify the large string book present', async function () { - const ExpectedDoc = - 'mybookProject Gutenberg EBook of Hamlet, by William Shakespeare' + + const expectedText = + 'Project Gutenberg EBook of Hamlet, by William Shakespeare' + ' This eBook is for the use of anyone anywhere in the United States' + ' and most other parts of the world at no cost and with almost no restrictions whatsoever.' + ' You may copy it, give it away or re-use it under the terms of the' + ' Project Gutenberg License included with this eBook or online at www.gutenberg.org.' + ' If you are not located in the United States,' + ' you’ll have to check the laws of the country where you are' + - ' located before using this ebook.' + - ' Title: Hamlet Author: William Shakespeare Release Date: November 1998 [EBook #1524]' + - ' Last Updated: December 30, 2017 Language: English Character set encoding:' + - ' _id:1 _type: - _index:testlargestring _score:0'; + ' located before using this ebook.'; - let rowData; await PageObjects.common.navigateToApp('discover'); await retry.try(async function tryingForTime() { - rowData = await PageObjects.discover.getDocTableIndex(1); - log.debug('rowData.length=' + rowData.length); - expect(rowData.substring(0, 200)).to.be(ExpectedDoc.substring(0, 200)); + const rowData = await PageObjects.discover.getDocTableIndex(1); + expect(rowData).to.contain(expectedText); }); }); diff --git a/test/functional/apps/discover/_runtime_fields_editor.ts b/test/functional/apps/discover/_runtime_fields_editor.ts index f780f4ecad97c9..62045e3c9a6b17 100644 --- a/test/functional/apps/discover/_runtime_fields_editor.ts +++ b/test/functional/apps/discover/_runtime_fields_editor.ts @@ -12,7 +12,6 @@ import { FtrProviderContext } from './ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); const retry = getService('retry'); - const dataGrid = getService('dataGrid'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); @@ -100,15 +99,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('doc view includes runtime fields', async function () { // navigate to doc view - await dataGrid.clickRowToggle(); + const table = await PageObjects.discover.getDocTable(); + const useLegacyTable = await PageObjects.discover.useLegacyTable(); + await table.clickRowToggle(); // click the open action await retry.try(async () => { - const rowActions = await dataGrid.getRowActions({ rowIndex: 0 }); + const rowActions = await table.getRowActions({ rowIndex: 0 }); if (!rowActions.length) { throw new Error('row actions empty, trying again'); } - await rowActions[0].click(); + const idxToClick = useLegacyTable ? 1 : 0; + await rowActions[idxToClick].click(); }); const hasDocHit = await testSubjects.exists('doc-hit'); diff --git a/test/functional/apps/discover/_shared_links.ts b/test/functional/apps/discover/_shared_links.ts index 555d5ad2d94d27..512e05e4b2d792 100644 --- a/test/functional/apps/discover/_shared_links.ts +++ b/test/functional/apps/discover/_shared_links.ts @@ -19,7 +19,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const toasts = getService('toasts'); const deployment = getService('deployment'); - const dataGrid = getService('dataGrid'); describe('shared links', function describeIndexTests() { let baseUrl: string; @@ -130,13 +129,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { return url.includes('sort:!(!(%27@timestamp%27,desc))'); }); - const row = await dataGrid.getRow({ rowIndex: 0 }); - const firstRowText = await Promise.all( - row.map(async (cell) => await cell.getVisibleText()) - ); - - // sorting requested by ES should be correct - expect(firstRowText).to.contain('Sep 22, 2015 @ 23:50:13.253'); + await retry.waitFor('document table to contain the right timestamp', async () => { + const firstRowText = await PageObjects.discover.getDocTableIndex(1); + return firstRowText.includes('Sep 22, 2015 @ 23:50:13.253'); + }); }); }); }); diff --git a/test/functional/apps/home/_sample_data.ts b/test/functional/apps/home/_sample_data.ts index 5a4bdfeb6b3e83..a35fda2f53ed62 100644 --- a/test/functional/apps/home/_sample_data.ts +++ b/test/functional/apps/home/_sample_data.ts @@ -101,7 +101,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking area, bar and heatmap charts rendered'); await dashboardExpect.seriesElementCount(15); log.debug('Checking saved searches rendered'); - await dashboardExpect.savedSearchRowCount(11); + await dashboardExpect.savedSearchRowCount(10); log.debug('Checking input controls rendered'); await dashboardExpect.inputControlItemCount(3); log.debug('Checking tag cloud rendered'); diff --git a/test/functional/page_objects/dashboard_page.ts b/test/functional/page_objects/dashboard_page.ts index b0610b36eb65f1..576e7e516e251f 100644 --- a/test/functional/page_objects/dashboard_page.ts +++ b/test/functional/page_objects/dashboard_page.ts @@ -24,7 +24,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide const renderable = getService('renderable'); const listingTable = getService('listingTable'); const elasticChart = getService('elasticChart'); - const PageObjects = getPageObjects(['common', 'header', 'visualize']); + const PageObjects = getPageObjects(['common', 'header', 'visualize', 'discover']); interface SaveDashboardOptions { /** @@ -223,12 +223,18 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide */ public async expectToolbarPaginationDisplayed() { - const subjects = ['pagination-button-previous', 'pagination-button-next']; + const isLegacyDefault = PageObjects.discover.useLegacyTable(); + if (isLegacyDefault) { + const subjects = ['btnPrevPage', 'btnNextPage', 'toolBarPagerText']; + await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj))); + } else { + const subjects = ['pagination-button-previous', 'pagination-button-next']; - await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj))); - const paginationListExists = await find.existsByCssSelector('.euiPagination__list'); - if (!paginationListExists) { - throw new Error(`expected discover data grid pagination list to exist`); + await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj))); + const paginationListExists = await find.existsByCssSelector('.euiPagination__list'); + if (!paginationListExists) { + throw new Error(`expected discover data grid pagination list to exist`); + } } } diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts index 62aa41d89f75e9..436d22d659aec6 100644 --- a/test/functional/page_objects/discover_page.ts +++ b/test/functional/page_objects/discover_page.ts @@ -21,6 +21,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider const config = getService('config'); const defaultFindTimeout = config.get('timeouts.find'); const dataGrid = getService('dataGrid'); + const kibanaServer = getService('kibanaServer'); class DiscoverPage { public async getChartTimespan() { @@ -28,6 +29,15 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider return await el.getVisibleText(); } + public async getDocTable() { + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + return docTable; + } else { + return dataGrid; + } + } + public async findFieldByName(name: string) { const fieldSearch = await testSubjects.find('fieldFilterSearchInput'); await fieldSearch.type(name); @@ -78,7 +88,12 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async getColumnHeaders() { - return await dataGrid.getHeaderFields(); + const isLegacy = await this.useLegacyTable(); + if (isLegacy) { + return await docTable.getHeaderFields('embeddedSavedSearchDocTable'); + } + const table = await this.getDocTable(); + return await table.getHeaderFields(); } public async openLoadSavedSearchPanel() { @@ -180,16 +195,28 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async getDocHeader() { - const docHeader = await dataGrid.getHeaders(); + const table = await this.getDocTable(); + const docHeader = await table.getHeaders(); return docHeader.join(); } public async getDocTableRows() { await header.waitUntilLoadingHasFinished(); - return await dataGrid.getBodyRows(); + const table = await this.getDocTable(); + return await table.getBodyRows(); + } + + public async useLegacyTable() { + return (await kibanaServer.uiSettings.get('doc_table:legacy')) !== false; } public async getDocTableIndex(index: number) { + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + const row = await find.byCssSelector(`tr.kbnDocTable__row:nth-child(${index})`); + return await row.getVisibleText(); + } + const row = await dataGrid.getRow({ rowIndex: index - 1 }); const result = await Promise.all(row.map(async (cell) => await cell.getVisibleText())); // Remove control columns @@ -201,10 +228,19 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider return await row.getVisibleText(); } - public async getDocTableField(index: number, cellIdx: number = 2) { + public async getDocTableField(index: number, cellIdx: number = -1) { + const isLegacyDefault = await this.useLegacyTable(); + const usedDefaultCellIdx = isLegacyDefault ? 0 : 2; + const usedCellIdx = cellIdx === -1 ? usedDefaultCellIdx : cellIdx; + if (isLegacyDefault) { + const fields = await find.allByCssSelector( + `tr.kbnDocTable__row:nth-child(${index}) [data-test-subj='docTableField']` + ); + return await fields[usedCellIdx].getVisibleText(); + } const row = await dataGrid.getRow({ rowIndex: index - 1 }); const result = await Promise.all(row.map(async (cell) => await cell.getVisibleText())); - return result[cellIdx]; + return result[usedCellIdx]; } public async skipToEndOfDocTable() { @@ -230,11 +266,21 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async clickDocSortDown() { - await dataGrid.clickDocSortAsc(); + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + await find.clickByCssSelector('.fa-sort-down'); + } else { + await dataGrid.clickDocSortAsc(); + } } public async clickDocSortUp() { - await dataGrid.clickDocSortDesc(); + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + await find.clickByCssSelector('.fa-sort-up'); + } else { + await dataGrid.clickDocSortDesc(); + } } public async isShowingDocViewer() { @@ -300,7 +346,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async clickFieldSort(field: string, text = 'Sort New-Old') { - await dataGrid.clickDocSortAsc(field, text); + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + return await testSubjects.click(`docTableHeaderFieldSort_${field}`); + } + return await dataGrid.clickDocSortAsc(field, text); } public async clickFieldListItemToggle(field: string) { @@ -372,7 +422,13 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async removeHeaderColumn(name: string) { - await dataGrid.clickRemoveColumn(name); + const isLegacyDefault = await this.useLegacyTable(); + if (isLegacyDefault) { + await testSubjects.moveMouseTo(`docTableHeader-${name}`); + await testSubjects.click(`docTableRemoveHeader-${name}`); + } else { + await dataGrid.clickRemoveColumn(name); + } } public async openSidebarFieldFilter() { diff --git a/test/functional/services/dashboard/expectations.ts b/test/functional/services/dashboard/expectations.ts index 329a8204cce0e1..c58fdd4d0305b1 100644 --- a/test/functional/services/dashboard/expectations.ts +++ b/test/functional/services/dashboard/expectations.ts @@ -47,6 +47,14 @@ export function DashboardExpectProvider({ getService, getPageObjects }: FtrProvi }); } + async docTableFieldCount(expectedCount: number) { + log.debug(`DashboardExpect.docTableFieldCount(${expectedCount})`); + await retry.try(async () => { + const docTableCells = await testSubjects.findAll('docTableField', findTimeout); + expect(docTableCells.length).to.be(expectedCount); + }); + } + async fieldSuggestions(expectedFields: string[]) { log.debug(`DashboardExpect.fieldSuggestions(${expectedFields})`); const fields = await filterBar.getFilterEditorFields(); @@ -200,14 +208,14 @@ export function DashboardExpectProvider({ getService, getPageObjects }: FtrProvi await this.textWithinTestSubjectsExists(values, 'markdownBody'); } - async savedSearchRowCount(expectedCount: number) { - log.debug(`DashboardExpect.savedSearchRowCount(${expectedCount})`); + async savedSearchRowCount(expectedMinCount: number) { + log.debug(`DashboardExpect.savedSearchRowCount(${expectedMinCount})`); await retry.try(async () => { const savedSearchRows = await testSubjects.findAll( 'docTableExpandToggleColumn', findTimeout ); - expect(savedSearchRows.length).to.be(expectedCount); + expect(savedSearchRows.length).to.be.above(expectedMinCount); }); } diff --git a/test/functional/services/doc_table.ts b/test/functional/services/doc_table.ts index cf417e43608945..35c3531c70c417 100644 --- a/test/functional/services/doc_table.ts +++ b/test/functional/services/doc_table.ts @@ -106,6 +106,10 @@ export function DocTableProvider({ getService, getPageObjects }: FtrProviderCont .map((field: any) => $(field).text().trim()); } + public async getHeaders(selector?: string): Promise { + return this.getHeaderFields(selector); + } + public async getTableDocViewRow( detailsRow: WebElementWrapper, fieldName: string diff --git a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts index 88848401a4c9d4..dc5afe4aa422d5 100644 --- a/x-pack/test/functional/apps/dashboard/_async_dashboard.ts +++ b/x-pack/test/functional/apps/dashboard/_async_dashboard.ts @@ -179,7 +179,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking area, bar and heatmap charts rendered'); await dashboardExpect.seriesElementCount(15); log.debug('Checking saved searches rendered'); - await dashboardExpect.savedSearchRowCount(11); + await dashboardExpect.savedSearchRowCount(10); log.debug('Checking input controls rendered'); await dashboardExpect.inputControlItemCount(3); log.debug('Checking tag cloud rendered'); diff --git a/x-pack/test/functional/apps/security/doc_level_security_roles.js b/x-pack/test/functional/apps/security/doc_level_security_roles.js index 356216232b0fa3..4fbb120e137859 100644 --- a/x-pack/test/functional/apps/security/doc_level_security_roles.js +++ b/x-pack/test/functional/apps/security/doc_level_security_roles.js @@ -75,9 +75,7 @@ export default function ({ getService, getPageObjects }) { expect(hitCount).to.be('1'); }); const rowData = await PageObjects.discover.getDocTableIndex(1); - expect(rowData).to.be( - 'nameABC Companyname.keywordABC CompanyregionEASTregion.keywordEAST_iddoc1_indexdlstest_score0_type -' - ); + expect(rowData).to.contain('EAST'); }); after('logout', async () => { await PageObjects.security.forceLogout(); diff --git a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts index b9397964fd16a8..0f73ce1a3bf58c 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/discover/async_search.ts @@ -16,7 +16,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const inspector = getService('inspector'); const PageObjects = getPageObjects(['discover', 'common', 'timePicker', 'header', 'context']); const searchSessions = getService('searchSessions'); - const dataGrid = getService('dataGrid'); const retry = getService('retry'); describe('discover async search', () => { @@ -67,14 +66,17 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('navigation to context cleans the session', async () => { await PageObjects.common.clearAllToasts(); - await dataGrid.clickRowToggle({ rowIndex: 0 }); + const table = await PageObjects.discover.getDocTable(); + const isLegacy = await PageObjects.discover.useLegacyTable(); + await table.clickRowToggle({ rowIndex: 0 }); await retry.try(async () => { - const rowActions = await dataGrid.getRowActions({ rowIndex: 0 }); + const rowActions = await table.getRowActions({ rowIndex: 0 }); if (!rowActions.length) { throw new Error('row actions empty, trying again'); } - await rowActions[1].click(); + const idxToClick = isLegacy ? 0 : 1; + await rowActions[idxToClick].click(); }); await PageObjects.context.waitUntilContextLoadingHasFinished();