Unskip flaky test functional/apps/dashboard/group2/dashboard_filter_bar·ts (#167825)

Closes https://github.com/elastic/kibana/issues/167175

flaky test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3292

Test failing because actions buttons are not visible. Screen shot from
failed test shows cell did not get selected. PR adds retry around
getting action button logic to ensure cell is clicked again in the event
the action button is not found

Notice how cell is not selected in screen shot below.
<img width="500" alt="Screenshot 2023-10-03 at 10 57 23 AM"
src="51432ea8-1a75-4182-bb1c-49f87a3d1070">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-10-04 08:29:00 -06:00 committed by GitHub
parent 6393a9125b
commit 8b89c940c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 22 deletions

View file

@ -193,8 +193,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
}); });
}); });
// FLAKY: https://github.com/elastic/kibana/issues/167175 describe('saved search filtering', function () {
describe.skip('saved search filtering', function () {
before(async () => { before(async () => {
await filterBar.ensureFieldEditorModalIsClosed(); await filterBar.ensureFieldEditorModalIsClosed();
await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.gotoDashboardLandingPage();
@ -209,9 +208,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
if (isLegacyDefault) { if (isLegacyDefault) {
await testSubjects.click('docTableCellFilter'); await testSubjects.click('docTableCellFilter');
} else { } else {
const documentCell = await dataGrid.getCellElement(1, 3); await dataGrid.clickCellFilterForButton(1, 3);
await documentCell.click();
await testSubjects.click('filterForButton');
} }
const filterCount = await filterBar.getFilterCount(); const filterCount = await filterBar.getFilterCount();
expect(filterCount).to.equal(1); expect(filterCount).to.equal(1);

View file

@ -83,14 +83,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug(`row document timestamp: ${text}`); log.debug(`row document timestamp: ${text}`);
return text === 'Sep 22, 2015 @ 23:50:13.253'; return text === 'Sep 22, 2015 @ 23:50:13.253';
}); });
const docCell = await dataGrid.getCellElement(0, 3);
await docCell.click();
const expandCellContentButton = await docCell.findByTestSubject(
'euiDataGridCellExpandButton'
);
await expandCellContentButton.click();
let expandDocId = '';
await dataGrid.clickCellExpandButton(0, 3);
let expandDocId = '';
await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => { await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue(); const text = await monacoEditor.getCodeEditorValue();
const flyoutJson = JSON.parse(text); const flyoutJson = JSON.parse(text);
@ -132,15 +128,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug(`row document timestamp: ${text}`); log.debug(`row document timestamp: ${text}`);
return text === 'Sep 22, 2015 @ 23:50:13.253'; return text === 'Sep 22, 2015 @ 23:50:13.253';
}); });
const docCell = await dataGrid.getCellElement(0, 3); await dataGrid.clickCellExpandButton(0, 3);
await docCell.click();
const expandCellContentButton = await docCell.findByTestSubject(
'euiDataGridCellExpandButton'
);
await expandCellContentButton.click();
let expandDocId = ''; let expandDocId = '';
await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => { await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue(); const text = await monacoEditor.getCodeEditorValue();
return (expandDocId = JSON.parse(text)._id) === 'AU_x3_g4GFA8no6QjkYX'; return (expandDocId = JSON.parse(text)._id) === 'AU_x3_g4GFA8no6QjkYX';

View file

@ -496,9 +496,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should filter by scripted field value in Discover', async function () { it('should filter by scripted field value in Discover', async function () {
await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.header.waitUntilLoadingHasFinished();
const documentCell = await dataGrid.getCellElement(0, 3); await dataGrid.clickCellFilterForButton(0, 3);
await documentCell.click();
await testSubjects.click('filterForButton');
await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async function () { await retry.try(async function () {

View file

@ -93,6 +93,47 @@ export class DataGridService extends FtrService {
return await this.find.byCssSelector(this.getCellElementSelector(rowIndex, columnIndex)); return await this.find.byCssSelector(this.getCellElementSelector(rowIndex, columnIndex));
} }
private async getCellActionButton(
rowIndex: number = 0,
columnIndex: number = 0,
selector: string
): Promise<WebElementWrapper> {
let actionButton: WebElementWrapper | undefined;
await this.retry.try(async () => {
const cell = await this.getCellElement(rowIndex, columnIndex);
await cell.click();
actionButton = await cell.findByTestSubject(selector);
if (!actionButton) {
throw new Error(`Unable to find cell action button ${selector}`);
}
});
return actionButton!;
}
/**
* Clicks grid cell 'expand' action button
* @param rowIndex data row index starting from 0 (0 means 1st row)
* @param columnIndex column index starting from 0 (0 means 1st column)
*/
public async clickCellExpandButton(rowIndex: number = 0, columnIndex: number = 0) {
const actionButton = await this.getCellActionButton(
rowIndex,
columnIndex,
'euiDataGridCellExpandButton'
);
await actionButton.click();
}
/**
* Clicks grid cell 'filter for' action button
* @param rowIndex data row index starting from 0 (0 means 1st row)
* @param columnIndex column index starting from 0 (0 means 1st column)
*/
public async clickCellFilterForButton(rowIndex: number = 0, columnIndex: number = 0) {
const actionButton = await this.getCellActionButton(rowIndex, columnIndex, 'filterForButton');
await actionButton.click();
}
/** /**
* The same as getCellElement, but useful when multiple data grids are on the page. * The same as getCellElement, but useful when multiple data grids are on the page.
*/ */