Skip to content

Commit

Permalink
[Discover] Unskip and improve document explorer field expand test (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal authored Dec 22, 2021
1 parent b149123 commit 69302a1
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions test/functional/apps/discover/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,48 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

const finalRows = await PageObjects.discover.getDocTableRows();
expect(finalRows.length).to.be.below(initialRows.length);
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

// flaky https://github.com/elastic/kibana/issues/94889
it.skip('should show popover with expanded cell content by click on expand button', async () => {
it('should show popover with expanded cell content by click on expand button', async () => {
log.debug('open popover with expanded cell content to get json from the editor');
const documentCell = await dataGrid.getCellElement(1, 3);
await documentCell.click();
const expandCellContentButton = await documentCell.findByClassName(
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();

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();
const popoverJson = await monacoEditor.getCodeEditorValue();
let expandDocId = '';

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

log.debug('open expanded document flyout to get json');
await dataGrid.clickRowToggle();
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');
const flyoutJson = await monacoEditor.getCodeEditorValue();

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

describe('expand a document row', function () {
Expand Down

0 comments on commit 69302a1

Please sign in to comment.