Skip to content

Commit

Permalink
Unskip flaky test functional/apps/dashboard/group2/dashboard_filter_b…
Browse files Browse the repository at this point in the history
…ar·ts (#167825)

Closes #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="https://github.com/elastic/kibana/assets/373691/51432ea8-1a75-4182-bb1c-49f87a3d1070">

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
nreese and kibanamachine authored Oct 4, 2023
1 parent 6393a91 commit 8b89c94
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 22 deletions.
7 changes: 2 additions & 5 deletions test/functional/apps/dashboard/group2/dashboard_filter_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/167175
describe.skip('saved search filtering', function () {
describe('saved search filtering', function () {
before(async () => {
await filterBar.ensureFieldEditorModalIsClosed();
await PageObjects.dashboard.gotoDashboardLandingPage();
Expand All @@ -209,9 +208,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
if (isLegacyDefault) {
await testSubjects.click('docTableCellFilter');
} else {
const documentCell = await dataGrid.getCellElement(1, 3);
await documentCell.click();
await testSubjects.click('filterForButton');
await dataGrid.clickCellFilterForButton(1, 3);
}
const filterCount = await filterBar.getFilterCount();
expect(filterCount).to.equal(1);
Expand Down
18 changes: 4 additions & 14 deletions test/functional/apps/discover/group2/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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.findByTestSubject(
'euiDataGridCellExpandButton'
);
await expandCellContentButton.click();
let expandDocId = '';

await dataGrid.clickCellExpandButton(0, 3);

let expandDocId = '';
await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue();
const flyoutJson = JSON.parse(text);
Expand Down Expand Up @@ -132,15 +128,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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.findByTestSubject(
'euiDataGridCellExpandButton'
);
await expandCellContentButton.click();
await dataGrid.clickCellExpandButton(0, 3);

let expandDocId = '';

await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue();
return (expandDocId = JSON.parse(text)._id) === 'AU_x3_g4GFA8no6QjkYX';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should filter by scripted field value in Discover', async function () {
await PageObjects.header.waitUntilLoadingHasFinished();
const documentCell = await dataGrid.getCellElement(0, 3);
await documentCell.click();
await testSubjects.click('filterForButton');
await dataGrid.clickCellFilterForButton(0, 3);
await PageObjects.header.waitUntilLoadingHasFinished();

await retry.try(async function () {
Expand Down
41 changes: 41 additions & 0 deletions test/functional/services/data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,47 @@ export class DataGridService extends FtrService {
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.
*/
Expand Down

0 comments on commit 8b89c94

Please sign in to comment.