diff --git a/src/plugins/discover/public/application/components/doc_viewer_links/__snapshots__/doc_viewer_links.test.tsx.snap b/src/plugins/discover/public/application/components/doc_viewer_links/__snapshots__/doc_viewer_links.test.tsx.snap
index 5da67e79a7c7..52dfa61e07f3 100644
--- a/src/plugins/discover/public/application/components/doc_viewer_links/__snapshots__/doc_viewer_links.test.tsx.snap
+++ b/src/plugins/discover/public/application/components/doc_viewer_links/__snapshots__/doc_viewer_links.test.tsx.snap
@@ -17,7 +17,7 @@ exports[`Render with 2 different links 1`] = `
key="0"
>
with 2 different links 1`] = `
key="1"
>
{
const { generateCb, href, ...props } = item;
const listItem: EuiListGroupItemProps = {
- 'data-test-subj': 'docTableRowAction',
+ 'data-test-subj': `docTableRowAction`,
...props,
href: generateCb ? generateCb(renderProps).url : href,
};
@@ -31,7 +31,7 @@ export function DocViewerLinks(renderProps: DocViewLinkRenderProps) {
href={item.href}
target="_blank"
style={{ fontWeight: 'normal' }}
- data-test-subj={item['data-test-subj']}
+ data-test-subj={`${item['data-test-subj']}-${index}`}
>
{item.label}
diff --git a/test/functional/apps/context/_context_navigation.js b/test/functional/apps/context/_context_navigation.js
index 70627ab11ff5..5e722a85d099 100644
--- a/test/functional/apps/context/_context_navigation.js
+++ b/test/functional/apps/context/_context_navigation.js
@@ -39,7 +39,7 @@ const TEST_FILTER_COLUMN_NAMES = [
export default function ({ getService, getPageObjects }) {
const retry = getService('retry');
const browser = getService('browser');
- const docTable = getService('docTable');
+ const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'context', 'discover', 'timePicker']);
describe('discover - context - back navigation', function contextSize() {
@@ -47,25 +47,29 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
- await PageObjects.discover.clickFieldListItem(columnName);
+ await PageObjects.discover.clickFieldListItemDetails(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});
- it('should go back after loading', async function () {
- await retry.waitFor('user navigating to context and returning to discover', async () => {
- // navigate to the context view
+ it('should open a new tab after loading surrounding documents', async function () {
+ await retry.waitFor('user navigating to context', async () => {
const initialHitCount = await PageObjects.discover.getHitCount();
- await docTable.clickRowToggle({ rowIndex: 0 });
- const rowActions = await docTable.getRowActions({ rowIndex: 0 });
- await rowActions[0].click();
- await PageObjects.context.waitUntilContextLoadingHasFinished();
- await PageObjects.context.clickSuccessorLoadMoreButton();
- await PageObjects.context.clickSuccessorLoadMoreButton();
- await PageObjects.context.clickSuccessorLoadMoreButton();
- await PageObjects.context.waitUntilContextLoadingHasFinished();
- await browser.goBack();
- await PageObjects.discover.waitForDocTableLoadingComplete();
+
+ // click inspect row
+ await testSubjects.click('docTableExpandToggleColumn-0');
+ // click view surrounding documents
+ await testSubjects.click('docTableRowAction-0');
+
+ //navigate to the new window
+ await testSubjects.exists('docTable');
+ await browser.switchTab(1);
+
+ //close the new tab and get back to the old tab
+ await browser.closeCurrentWindow();
+ await browser.switchTab(0);
+
+ await testSubjects.click('euiFlyoutCloseButton');
const hitCount = await PageObjects.discover.getHitCount();
return initialHitCount === hitCount;
});
diff --git a/test/functional/apps/context/_date_nanos.js b/test/functional/apps/context/_date_nanos.js
index e612c8d3c41d..ac45d86555d7 100644
--- a/test/functional/apps/context/_date_nanos.js
+++ b/test/functional/apps/context/_date_nanos.js
@@ -36,7 +36,7 @@ const TEST_STEP_SIZE = 3;
export default function ({ getService, getPageObjects }) {
const opensearchDashboardsServer = getService('opensearchDashboardsServer');
- const docTable = getService('docTable');
+ const dataGrid = getService('dataGrid');
const security = getService('security');
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const opensearchArchiver = getService('opensearchArchiver');
@@ -62,11 +62,11 @@ export default function ({ getService, getPageObjects }) {
it('displays predessors - anchor - successors in right order ', async function () {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, 'AU_x3-TaGFA8no6Qj999Z');
- const actualRowsText = await docTable.getRowsText();
+ const actualRowsText = await dataGrid.getDataGridTableColumn('date');
const expectedRowsText = [
- 'Sep 18, 2019 @ 06:50:13.000000000-2',
- 'Sep 18, 2019 @ 06:50:12.999999999-3',
- 'Sep 19, 2015 @ 06:50:13.0001000011',
+ 'Sep 18, 2019 @ 06:50:13.000000000',
+ 'Sep 18, 2019 @ 06:50:12.999999999',
+ 'Sep 19, 2015 @ 06:50:13.000100001',
];
expect(actualRowsText).to.eql(expectedRowsText);
});
@@ -75,17 +75,17 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, 'AU_x3-TaGFA8no6Qjisd');
await PageObjects.context.clickPredecessorLoadMoreButton();
await PageObjects.context.clickSuccessorLoadMoreButton();
- const actualRowsText = await docTable.getRowsText();
+ const actualRowsText = await dataGrid.getDataGridTableColumn('date');
const expectedRowsText = [
- 'Sep 22, 2019 @ 23:50:13.2531233455',
- 'Sep 18, 2019 @ 06:50:13.0000001044',
- 'Sep 18, 2019 @ 06:50:13.0000001032',
- 'Sep 18, 2019 @ 06:50:13.0000001021',
- 'Sep 18, 2019 @ 06:50:13.0000001010',
- 'Sep 18, 2019 @ 06:50:13.000000001-1',
- 'Sep 18, 2019 @ 06:50:13.000000000-2',
- 'Sep 18, 2019 @ 06:50:12.999999999-3',
- 'Sep 19, 2015 @ 06:50:13.0001000011',
+ 'Sep 22, 2019 @ 23:50:13.253123345',
+ 'Sep 18, 2019 @ 06:50:13.000000104',
+ 'Sep 18, 2019 @ 06:50:13.000000103',
+ 'Sep 18, 2019 @ 06:50:13.000000102',
+ 'Sep 18, 2019 @ 06:50:13.000000101',
+ 'Sep 18, 2019 @ 06:50:13.000000001',
+ 'Sep 18, 2019 @ 06:50:13.000000000',
+ 'Sep 18, 2019 @ 06:50:12.999999999',
+ 'Sep 19, 2015 @ 06:50:13.000100001',
];
expect(actualRowsText).to.eql(expectedRowsText);
});
diff --git a/test/functional/apps/context/_discover_navigation.js b/test/functional/apps/context/_discover_navigation.js
index 87bbaccd0dd8..5680b28921a7 100644
--- a/test/functional/apps/context/_discover_navigation.js
+++ b/test/functional/apps/context/_discover_navigation.js
@@ -37,10 +37,11 @@ const TEST_FILTER_COLUMN_NAMES = [
];
export default function ({ getService, getPageObjects }) {
- const retry = getService('retry');
- const docTable = getService('docTable');
+ const browser = getService('browser');
+ const dataGrid = getService('dataGrid');
const filterBar = getService('filterBar');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);
+ const testSubjects = getService('testSubjects');
describe('context link in discover', () => {
before(async () => {
@@ -52,7 +53,7 @@ export default function ({ getService, getPageObjects }) {
}
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
- await PageObjects.discover.clickFieldListItem(columnName);
+ await PageObjects.discover.clickFieldListItemDetails(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});
@@ -61,25 +62,27 @@ export default function ({ getService, getPageObjects }) {
});
it('should open the context view with the selected document as anchor', async () => {
- // check the anchor timestamp in the context view
- await retry.waitFor('selected document timestamp matches anchor timestamp ', async () => {
- // get the timestamp of the first row
- const discoverFields = await docTable.getFields();
- const firstTimestamp = discoverFields[0][0];
-
- // navigate to the context view
- await docTable.clickRowToggle({ rowIndex: 0 });
- const rowActions = await docTable.getRowActions({ rowIndex: 0 });
- await rowActions[0].click();
- const contextFields = await docTable.getFields({ isAnchorRow: true });
- const anchorTimestamp = contextFields[0][0];
- return anchorTimestamp === firstTimestamp;
- });
+ // get the timestamps
+ const dataGridTableTimeStamps = await dataGrid.getDataGridTableColumn('date');
+
+ // click inspect row
+ await testSubjects.click('docTableExpandToggleColumn-10');
+
+ // click view surrounding documents
+ await testSubjects.click('docTableRowAction-0');
+
+ //navigate to the new window and get the new timestamp
+ await testSubjects.exists('docTable');
+ await browser.switchTab(1);
+ const surroundingTableTimeStamps = await dataGrid.getDataGridTableColumn('date');
+
+ return dataGridTableTimeStamps[10] === surroundingTableTimeStamps[5];
});
it('should open the context view with the same columns', async () => {
- const columnNames = await docTable.getHeaderFields();
- expect(columnNames).to.eql(['Time', ...TEST_COLUMN_NAMES]);
+ const data = await dataGrid.getDataGridTableData();
+
+ expect(data.columns).to.eql(['', 'Time (@timestamp)', ...TEST_COLUMN_NAMES]);
});
it('should open the context view with the filters disabled', async () => {
@@ -90,6 +93,11 @@ export default function ({ getService, getPageObjects }) {
}
}
expect(disabledFilterCounter).to.be(TEST_FILTER_COLUMN_NAMES.length);
+ //close the new tab and get back to the old tab
+ await browser.closeCurrentWindow();
+ await browser.switchTab(0);
+
+ await testSubjects.click('euiFlyoutCloseButton');
});
});
}
diff --git a/test/functional/apps/context/_filters.js b/test/functional/apps/context/_filters.js
index 48661baae551..077a8376aa7b 100644
--- a/test/functional/apps/context/_filters.js
+++ b/test/functional/apps/context/_filters.js
@@ -35,10 +35,11 @@ const TEST_ANCHOR_FILTER_VALUE = 'IN';
const TEST_COLUMN_NAMES = ['extension', 'geo.src'];
export default function ({ getService, getPageObjects }) {
- const docTable = getService('docTable');
+ const dataGrid = getService('dataGrid');
const filterBar = getService('filterBar');
const retry = getService('retry');
const browser = getService('browser');
+ const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'context']);
@@ -52,18 +53,19 @@ export default function ({ getService, getPageObjects }) {
it('inclusive filter should be addable via expanded doc table rows', async function () {
await retry.waitFor(`filter ${TEST_ANCHOR_FILTER_FIELD} in filterbar`, async () => {
- await docTable.toggleRowExpanded({ isAnchorRow: true });
- const anchorDetailsRow = await docTable.getAnchorDetailsRow();
- await docTable.addInclusiveFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
- await PageObjects.context.waitUntilContextLoadingHasFinished();
+ // expand anchor row
+ await testSubjects.click('docTableExpandToggleColumn-5');
+
+ // add inclusive filter
+ await testSubjects.click(
+ `tableDocViewRow-${TEST_ANCHOR_FILTER_FIELD} > addInclusiveFilterButton`
+ );
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, true);
});
await retry.waitFor(`filter matching docs in docTable`, async () => {
- const fields = await docTable.getFields();
- return fields
- .map((row) => row[2])
- .every((fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE);
+ const fields = await dataGrid.getDataGridTableColumn('lastColumn');
+ return fields.every((fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE);
});
});
@@ -79,21 +81,23 @@ export default function ({ getService, getPageObjects }) {
});
await retry.waitFor('filters are disabled', async () => {
- const fields = await docTable.getFields();
- const hasOnlyFilteredRows = fields
- .map((row) => row[2])
- .every((fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE);
+ const fields = await dataGrid.getDataGridTableColumn('lastColumn');
+ const hasOnlyFilteredRows = fields.every(
+ (fieldContent) => fieldContent === TEST_ANCHOR_FILTER_VALUE
+ );
return hasOnlyFilteredRows === false;
});
});
it('filter for presence should be addable via expanded doc table rows', async function () {
- await docTable.toggleRowExpanded({ isAnchorRow: true });
+ // expand anchor row
+ await testSubjects.click('docTableExpandToggleColumn-5');
await retry.waitFor('an exists filter in the filterbar', async () => {
- const anchorDetailsRow = await docTable.getAnchorDetailsRow();
- await docTable.addExistsFilter(anchorDetailsRow, TEST_ANCHOR_FILTER_FIELD);
- await PageObjects.context.waitUntilContextLoadingHasFinished();
+ // add inclusive filter
+ await testSubjects.click(
+ `tableDocViewRow-${TEST_ANCHOR_FILTER_FIELD} > addExistsFilterButton`
+ );
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, 'exists', true);
});
});
diff --git a/test/functional/apps/context/_size.js b/test/functional/apps/context/_size.js
index 1727aa40136a..bd44b159bca4 100644
--- a/test/functional/apps/context/_size.js
+++ b/test/functional/apps/context/_size.js
@@ -36,7 +36,7 @@ const TEST_STEP_SIZE = 2;
export default function ({ getService, getPageObjects }) {
const opensearchDashboardsServer = getService('opensearchDashboardsServer');
const retry = getService('retry');
- const docTable = getService('docTable');
+ const dataGrid = getService('dataGrid');
const PageObjects = getPageObjects(['context']);
let expectedRowLength = 2 * TEST_DEFAULT_CONTEXT_SIZE + 1;
@@ -53,7 +53,7 @@ export default function ({ getService, getPageObjects }) {
await retry.waitFor(
`number of rows displayed initially is ${expectedRowLength}`,
async function () {
- const rows = await docTable.getRowsText();
+ const rows = await dataGrid.getDataGridTableColumn('date');
return rows.length === expectedRowLength;
}
);
@@ -74,8 +74,8 @@ export default function ({ getService, getPageObjects }) {
await retry.waitFor(
`number of rows displayed after clicking load more predecessors is ${expectedRowLength}`,
async function () {
- const rows = await docTable.getRowsText();
- return rows.length === expectedRowLength;
+ const data = await dataGrid.getDataGridTableColumn('date');
+ return data.length === expectedRowLength;
}
);
});
@@ -87,8 +87,8 @@ export default function ({ getService, getPageObjects }) {
await retry.waitFor(
`number of rows displayed after clicking load more successors is ${expectedRowLength}`,
async function () {
- const rows = await docTable.getRowsText();
- return rows.length === expectedRowLength;
+ const data = await dataGrid.getDataGridTableColumn('date');
+ return data.length === expectedRowLength;
}
);
});
diff --git a/test/functional/apps/management/_scripted_fields.js b/test/functional/apps/management/_scripted_fields.js
index 7aeb2a691a70..7d9ae2be1166 100644
--- a/test/functional/apps/management/_scripted_fields.js
+++ b/test/functional/apps/management/_scripted_fields.js
@@ -197,7 +197,7 @@ export default function ({ getService, getPageObjects }) {
});
it('should filter by scripted field value in Discover', async function () {
- await PageObjects.discover.clickFieldListItem(scriptedPainlessFieldName);
+ await PageObjects.discover.clickFieldListItemDetails(scriptedPainlessFieldName);
await log.debug('filter by the first value (14) in the expanded scripted field list');
await PageObjects.discover.clickFieldListPlusFilter(scriptedPainlessFieldName, '14');
await PageObjects.header.waitUntilLoadingHasFinished();
@@ -314,7 +314,7 @@ export default function ({ getService, getPageObjects }) {
});
it('should filter by scripted field value in Discover', async function () {
- await PageObjects.discover.clickFieldListItem(scriptedPainlessFieldName2);
+ await PageObjects.discover.clickFieldListItemDetails(scriptedPainlessFieldName2);
await log.debug('filter by "bad" in the expanded scripted field list');
await PageObjects.discover.clickFieldListPlusFilter(scriptedPainlessFieldName2, 'bad');
await PageObjects.header.waitUntilLoadingHasFinished();
@@ -388,7 +388,7 @@ export default function ({ getService, getPageObjects }) {
});
it('should filter by scripted field value in Discover', async function () {
- await PageObjects.discover.clickFieldListItem(scriptedPainlessFieldName2);
+ await PageObjects.discover.clickFieldListItemDetails(scriptedPainlessFieldName2);
await log.debug('filter by "true" in the expanded scripted field list');
await PageObjects.discover.clickFieldListPlusFilter(scriptedPainlessFieldName2, 'true');
await PageObjects.header.waitUntilLoadingHasFinished();
@@ -506,7 +506,7 @@ export default function ({ getService, getPageObjects }) {
});
it('should filter by scripted field value in Discover', async function () {
- await PageObjects.discover.clickFieldListItem(scriptedPainlessFieldName2);
+ await PageObjects.discover.clickFieldListItemDetails(scriptedPainlessFieldName2);
await log.debug('filter by "Sep 18, 2015 @ 7:52" in the expanded scripted field list');
await PageObjects.discover.clickFieldListPlusFilter(
scriptedPainlessFieldName2,
diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts
index c5901b553337..f09be976e38e 100644
--- a/test/functional/page_objects/discover_page.ts
+++ b/test/functional/page_objects/discover_page.ts
@@ -286,6 +286,10 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
return await testSubjects.click(`field-${field}`);
}
+ public async clickFieldListItemDetails(field: string) {
+ return await testSubjects.click(`field-${field}-showDetails`);
+ }
+
public async clickFieldSort(field: string) {
return await testSubjects.click(`docTableHeaderFieldSort_${field}`);
}
diff --git a/test/functional/services/data_grid.ts b/test/functional/services/data_grid.ts
index c41733a1481f..a80c377e1a7d 100644
--- a/test/functional/services/data_grid.ts
+++ b/test/functional/services/data_grid.ts
@@ -40,6 +40,8 @@ export function DataGridProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
class DataGrid {
+ // This test no longer works in the new data explorer data grid table
+ // since each data grid table cell is now rendered differently
async getDataGridTableData(): Promise {
const table = await find.byCssSelector('.euiDataGrid');
const $ = await table.parseDomContent();
@@ -96,6 +98,24 @@ export function DataGridProvider({ getService }: FtrProviderContext) {
await testSubjects.click(`dataGridHeaderCell-${columnName}`);
await find.clickByButtonText('Remove column');
}
+
+ async getDataGridTableColumn(selector: string): Promise {
+ const table = await find.byCssSelector('.euiDataGrid');
+ const $ = await table.parseDomContent();
+
+ const columnValues: string[] = [];
+ $.findTestSubjects('dataGridRowCell')
+ .toArray()
+ .forEach((cell) => {
+ const cCell = $(cell);
+ if (cCell.hasClass(`euiDataGridRowCell--${selector}`)) {
+ // The column structure is very nested to get the actual text
+ columnValues.push(cCell.children().children().children().children().text());
+ }
+ });
+
+ return columnValues;
+ }
}
return new DataGrid();