Skip to content

Commit

Permalink
[Discover] Unskip additional cell actions test (#201009)
Browse files Browse the repository at this point in the history
- Closes #193367

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
  • Loading branch information
jughosta authored Nov 21, 2024
1 parent 51a84eb commit 6f0bda8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ import expect from '@kbn/expect';
import type { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'header', 'unifiedFieldList']);
const PageObjects = getPageObjects([
'common',
'discover',
'header',
'unifiedFieldList',
'context',
]);
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const browser = getService('browser');
Expand All @@ -29,15 +35,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
let alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -57,7 +63,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 2);
await dataGrid.clickCellExpandButton(0, { columnName: 'message' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
true
);
Expand All @@ -76,7 +82,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
false
);
Expand All @@ -94,15 +100,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataViews.switchTo('my-example-logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
let alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -118,15 +124,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await browser.refresh();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await PageObjects.context.waitUntilContextLoadingHasFinished();
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -143,7 +150,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataViews.switchTo('my-example-logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 2);
await dataGrid.clickCellExpandButton(0, { columnName: 'message' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
true
);
Expand All @@ -159,7 +166,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataViews.switchTo('my-example-metrics');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
false
);
Expand Down
32 changes: 23 additions & 9 deletions test/functional/services/data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,14 @@ export class DataGridService extends FtrService {

private async getCellActionButton(
rowIndex: number = 0,
columnIndex: number = 0,
{ columnIndex = 0, columnName }: { columnIndex?: number; columnName?: string },
selector: string
): Promise<WebElementWrapper> {
let actionButton: WebElementWrapper | undefined;
await this.retry.try(async () => {
const cell = await this.getCellElement(rowIndex, columnIndex);
const cell = columnName
? await this.getCellElementByColumnName(rowIndex, columnName)
: await this.getCellElement(rowIndex, columnIndex);
await cell.moveMouseTo();
await cell.click();
actionButton = await cell.findByTestSubject(selector);
Expand All @@ -194,11 +196,15 @@ export class DataGridService extends FtrService {
* 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)
* @param columnName column/field name
*/
public async clickCellExpandButton(rowIndex: number = 0, columnIndex: number = 0) {
public async clickCellExpandButton(
rowIndex: number = 0,
{ columnIndex = 0, columnName }: { columnIndex?: number; columnName?: string }
) {
const actionButton = await this.getCellActionButton(
rowIndex,
columnIndex,
{ columnIndex, columnName },
'euiDataGridCellExpandButton'
);
await actionButton.moveMouseTo();
Expand All @@ -218,7 +224,7 @@ export class DataGridService extends FtrService {
columnIndex: number = 0
) {
const controlsCount = await this.getControlColumnsCount();
await this.clickCellExpandButton(rowIndex, controlsCount + columnIndex);
await this.clickCellExpandButton(rowIndex, { columnIndex: controlsCount + columnIndex });
}

/**
Expand All @@ -244,7 +250,11 @@ export class DataGridService extends FtrService {
* @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');
const actionButton = await this.getCellActionButton(
rowIndex,
{ columnIndex },
'filterForButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
}
Expand All @@ -261,15 +271,19 @@ export class DataGridService extends FtrService {
const controlsCount = await this.getControlColumnsCount();
const actionButton = await this.getCellActionButton(
rowIndex,
controlsCount + columnIndex,
{ columnIndex: controlsCount + columnIndex },
'filterForButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
}

public async clickCellFilterOutButton(rowIndex: number = 0, columnIndex: number = 0) {
const actionButton = await this.getCellActionButton(rowIndex, columnIndex, 'filterOutButton');
const actionButton = await this.getCellActionButton(
rowIndex,
{ columnIndex },
'filterOutButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
}
Expand All @@ -281,7 +295,7 @@ export class DataGridService extends FtrService {
const controlsCount = await this.getControlColumnsCount();
const actionButton = await this.getCellActionButton(
rowIndex,
controlsCount + columnIndex,
{ columnIndex: controlsCount + columnIndex },
'filterOutButton'
);
await actionButton.moveMouseTo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'discover',
'header',
'unifiedFieldList',
'context',
'svlCommonPage',
]);
const dataViews = getService('dataViews');
Expand All @@ -37,15 +38,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
let alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -65,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 2);
await dataGrid.clickCellExpandButton(0, { columnName: 'message' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
true
);
Expand All @@ -84,7 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
false
);
Expand All @@ -94,24 +95,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/193367
describe.skip('data view mode', () => {
describe('data view mode', () => {
it('should render additional cell actions for logs data source', async () => {
await PageObjects.common.navigateToActualUrl('discover', undefined, {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
let alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -127,15 +127,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await browser.refresh();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await PageObjects.context.waitUntilContextLoadingHasFinished();
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Example data source action executed');
} finally {
await alert?.dismiss();
}
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
Expand All @@ -152,7 +153,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataViews.switchTo('my-example-logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 2);
await dataGrid.clickCellExpandButton(0, { columnName: 'message' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
true
);
Expand All @@ -168,7 +169,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataViews.switchTo('my-example-metrics');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await dataGrid.clickCellExpandButtonExcludingControlColumns(0, 0);
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
expect(await dataGrid.cellExpandPopoverActionExists('example-data-source-action')).to.be(
false
);
Expand Down

0 comments on commit 6f0bda8

Please sign in to comment.