[Discover] Fix getAdditionalCellActions FTR tests (#216540)

## Summary

This PR fixes the `getAdditionalCellActions` FTR tests that started
failing due to an issue dismissing alerts.

Resolves #213300.
Resolves #213422.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Davis McPhee 2025-04-02 11:45:08 -03:00 committed by GitHub
parent 5bfa0564ae
commit d08e5521f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 76 deletions

View file

@ -9,6 +9,7 @@
import kbnRison from '@kbn/rison';
import expect from '@kbn/expect';
import { Alert } from 'selenium-webdriver';
import type { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -22,9 +23,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const browser = getService('browser');
const retry = getService('retry');
// Failing: See https://github.com/elastic/kibana/issues/213300
describe.skip('extension getAdditionalCellActions', () => {
const checkAlert = async (text: string) => {
let alert: Alert | undefined;
try {
await retry.waitFor('alert to be present', async () => {
alert = (await browser.getAlert()) ?? undefined;
return Boolean(alert);
});
expect(await alert?.getText()).to.be(text);
} finally {
await alert?.dismiss();
}
};
describe('extension getAdditionalCellActions', () => {
describe('ES|QL mode', () => {
it('should render additional cell actions for logs data source', async () => {
const state = kbnRison.encode({
@ -38,20 +52,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
});
it('should not render incompatible cell action for message column', async () => {
@ -103,20 +107,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
// check Surrounding docs page
await dataGrid.clickRowToggle();
const [, surroundingActionEl] = await dataGrid.getRowActions();
@ -128,20 +122,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
});
it('should not render incompatible cell action for message column', async () => {

View file

@ -7,6 +7,7 @@
import kbnRison from '@kbn/rison';
import expect from '@kbn/expect';
import { Alert } from 'selenium-webdriver';
import type { FtrProviderContext } from '../../../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
@ -21,6 +22,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const browser = getService('browser');
const retry = getService('retry');
const checkAlert = async (text: string) => {
let alert: Alert | undefined;
try {
await retry.waitFor('alert to be present', async () => {
alert = (await browser.getAlert()) ?? undefined;
return Boolean(alert);
});
expect(await alert?.getText()).to.be(text);
} finally {
await alert?.dismiss();
}
};
describe('extension getAdditionalCellActions', () => {
before(async () => {
@ -40,20 +55,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
});
it('should not render incompatible cell action for message column', async () => {
@ -95,8 +100,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
// FLAKY: https://github.com/elastic/kibana/issues/213422
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,
@ -106,20 +110,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
// check Surrounding docs page
await dataGrid.clickRowToggle();
const [, surroundingActionEl] = await dataGrid.getRowActions();
@ -131,20 +125,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
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 checkAlert('Example data source action executed');
await dataGrid.clickCellExpandButton(0, { columnName: '@timestamp' });
await dataGrid.clickCellExpandPopoverAction('another-example-data-source-action');
alert = await browser.getAlert();
try {
expect(await alert?.getText()).to.be('Another example data source action executed');
} finally {
await alert?.dismiss();
}
await checkAlert('Another example data source action executed');
});
it('should not render incompatible cell action for message column', async () => {