Skip to content

Commit

Permalink
[Discover] add functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaanj committed Dec 21, 2021
1 parent 6ea3404 commit acfc703
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion test/functional/apps/discover/_data_grid_doc_table.ts
Expand Up @@ -17,7 +17,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const monacoEditor = getService('monacoEditor');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
const dashboardAddPanel = getService('dashboardAddPanel');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker', 'dashboard']);
const defaultSettings = {
defaultIndex: 'logstash-*',
'doc_table:legacy': false,
Expand Down Expand Up @@ -79,6 +80,56 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(popoverJson).to.be(flyoutJson);
});

it('should show popover with expanded cell content by click on expand button on embeddable', async () => {
log.debug('open popover with expanded cell content to get json from the editor');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.saveSearch('expand-cell-search');

await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.header.waitUntilLoadingHasFinished();
await dashboardAddPanel.addSavedSearch('expand-cell-search');

await retry.waitForWithTimeout('timestamp matches expected doc', 5000, async () => {
const cell = await dataGrid.getCellElement(0, 2);
const text = await cell.getVisibleText();
log.debug(`row document timestamp: ${text}`);
return text === 'Sep 22, 2015 @ 23:50:13.253';
});
const docCell = await dataGrid.getCellElement(0, 3);
await docCell.click();
const expandCellContentButton = await docCell.findByClassName(
'euiDataGridRowCell__expandButtonIcon'
);
await expandCellContentButton.click();

let expandDocId = '';

await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue();
const flyoutJson = text?.trim().charAt(0) === '{' ? JSON.parse(text) : {};
expandDocId = flyoutJson._id;
return !!expandDocId && expandDocId === 'AU_x3_g4GFA8no6QjkYX';
});
log.debug(`expanded document id: ${expandDocId}`);

await dataGrid.clickRowToggle();
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');

await retry.waitForWithTimeout(
'document id in flyout matching the expanded document id',
5000,
async () => {
const text = await monacoEditor.getCodeEditorValue();
const flyoutJson = text?.trim().charAt(0) === '{' ? JSON.parse(text) : {};
log.debug(`flyout document id: ${flyoutJson._id}`);
return flyoutJson._id === expandDocId;
}
);
});

describe('expand a document row', function () {
const rowToInspect = 1;

Expand Down

0 comments on commit acfc703

Please sign in to comment.