mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Discover] Fix flaky test regarding field actions in a flyout (#140415)
* [Discover] Fix flaky test regarding field actions in a flyout * [Discover] Update a11y tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
6a2fa9f4b4
commit
6380e4cecb
7 changed files with 35 additions and 18 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -13,6 +13,7 @@
|
|||
/src/plugins/saved_search/ @elastic/kibana-data-discovery
|
||||
/x-pack/plugins/discover_enhanced/ @elastic/kibana-data-discovery
|
||||
/test/functional/apps/discover/ @elastic/kibana-data-discovery
|
||||
/test/functional/apps/context/ @elastic/kibana-data-discovery
|
||||
/test/api_integration/apis/unified_field_list/ @elastic/kibana-data-discovery
|
||||
/x-pack/plugins/graph/ @elastic/kibana-data-discovery
|
||||
/x-pack/test/functional/apps/graph @elastic/kibana-data-discovery
|
||||
|
|
|
@ -177,15 +177,13 @@ export const TableActions = ({
|
|||
},
|
||||
];
|
||||
|
||||
const testSubject = `openFieldActionsButton-${field}`;
|
||||
|
||||
if (mode === 'inline') {
|
||||
return (
|
||||
<EuiFlexGroup
|
||||
responsive={false}
|
||||
gutterSize="xs"
|
||||
className="kbnDocViewer__buttons"
|
||||
data-test-subj={testSubject}
|
||||
data-test-subj={`fieldActionsGroup-${field}`}
|
||||
>
|
||||
{panels[0].items.map((item) => (
|
||||
<EuiFlexItem key={item.icon} grow={false}>
|
||||
|
@ -210,7 +208,7 @@ export const TableActions = ({
|
|||
<EuiPopover
|
||||
button={
|
||||
<EuiButtonIcon
|
||||
data-test-subj={testSubject}
|
||||
data-test-subj={`openFieldActionsButton-${field}`}
|
||||
aria-label={openActionsLabel}
|
||||
onClick={toggleOpenPopover}
|
||||
iconType="boxesHorizontal"
|
||||
|
|
|
@ -117,13 +117,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
|
||||
it('a11y test for actions on a field', async () => {
|
||||
await PageObjects.discover.clickDocViewerTab(0);
|
||||
await testSubjects.click('openFieldActionsButton-Cancelled');
|
||||
if (await testSubjects.exists('openFieldActionsButton-Cancelled')) {
|
||||
await testSubjects.click('openFieldActionsButton-Cancelled');
|
||||
} else {
|
||||
await testSubjects.existOrFail('fieldActionsGroup-Cancelled');
|
||||
}
|
||||
await a11y.testAppSnapshot();
|
||||
});
|
||||
|
||||
it('a11y test for data-grid table with columns', async () => {
|
||||
await testSubjects.click('toggleColumnButton-Cancelled');
|
||||
await testSubjects.click('openFieldActionsButton-Carrier');
|
||||
if (await testSubjects.exists('openFieldActionsButton-Carrier')) {
|
||||
await testSubjects.click('openFieldActionsButton-Carrier');
|
||||
} else {
|
||||
await testSubjects.existOrFail('fieldActionsGroup-Carrier');
|
||||
}
|
||||
await testSubjects.click('toggleColumnButton-Carrier');
|
||||
await testSubjects.click('euiFlyoutCloseButton');
|
||||
await toasts.dismissAllToasts();
|
||||
|
|
|
@ -18,7 +18,6 @@ const TEST_COLUMN_NAMES = ['extension', 'geo.src'];
|
|||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const dataGrid = getService('dataGrid');
|
||||
const filterBar = getService('filterBar');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
const browser = getService('browser');
|
||||
|
||||
|
@ -34,12 +33,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
it('inclusive filter should be addable via expanded data grid rows', async function () {
|
||||
await retry.waitFor(`filter ${TEST_ANCHOR_FILTER_FIELD} in filterbar`, async () => {
|
||||
await dataGrid.clickRowToggle({ isAnchorRow: true, renderMoreRows: true });
|
||||
await testSubjects.click(`openFieldActionsButton-${TEST_ANCHOR_FILTER_FIELD}`);
|
||||
await testSubjects.click(`addFilterForValueButton-${TEST_ANCHOR_FILTER_FIELD}`);
|
||||
await dataGrid.clickFieldActionInFlyout(
|
||||
TEST_ANCHOR_FILTER_FIELD,
|
||||
'addFilterForValueButton'
|
||||
);
|
||||
await PageObjects.context.waitUntilContextLoadingHasFinished();
|
||||
|
||||
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, TEST_ANCHOR_FILTER_VALUE, true);
|
||||
});
|
||||
|
||||
await dataGrid.closeFlyout();
|
||||
|
||||
await retry.waitFor(`filter matching docs in data grid`, async () => {
|
||||
const fields = await dataGrid.getFields();
|
||||
return fields
|
||||
|
@ -71,8 +75,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
it('filter for presence should be addable via expanded data grid rows', async function () {
|
||||
await retry.waitFor('an exists filter in the filterbar', async () => {
|
||||
await dataGrid.clickRowToggle({ isAnchorRow: true, renderMoreRows: true });
|
||||
await testSubjects.click(`openFieldActionsButton-${TEST_ANCHOR_FILTER_FIELD}`);
|
||||
await testSubjects.click(`addExistsFilterButton-${TEST_ANCHOR_FILTER_FIELD}`);
|
||||
await dataGrid.clickFieldActionInFlyout(TEST_ANCHOR_FILTER_FIELD, 'addExistsFilterButton');
|
||||
await PageObjects.context.waitUntilContextLoadingHasFinished();
|
||||
return await filterBar.hasFilter(TEST_ANCHOR_FILTER_FIELD, 'exists', true);
|
||||
});
|
||||
|
|
|
@ -60,9 +60,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
|
||||
await dataGrid.clickRowToggle({ rowIndex: 0 });
|
||||
|
||||
await testSubjects.click('openFieldActionsButton-@timestamp');
|
||||
await testSubjects.click('addExistsFilterButton-@timestamp');
|
||||
await dataGrid.clickFieldActionInFlyout('@timestamp', 'addExistsFilterButton');
|
||||
|
||||
const hasExistsFilter = await filterBar.hasFilter('@timestamp', 'exists', true, false, false);
|
||||
expect(hasExistsFilter).to.be(true);
|
||||
|
|
|
@ -197,8 +197,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
// add columns
|
||||
const fields = ['_id', '_index', 'agent'];
|
||||
for (const field of fields) {
|
||||
await testSubjects.click(`openFieldActionsButton-${field}`);
|
||||
await testSubjects.click(`toggleColumnButton-${field}`);
|
||||
await dataGrid.clickFieldActionInFlyout(field, 'toggleColumnButton');
|
||||
}
|
||||
|
||||
const headerWithFields = await dataGrid.getHeaderFields();
|
||||
|
@ -206,8 +205,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
|
||||
// remove columns
|
||||
for (const field of fields) {
|
||||
await testSubjects.click(`openFieldActionsButton-${field}`);
|
||||
await testSubjects.click(`toggleColumnButton-${field}`);
|
||||
await dataGrid.clickFieldActionInFlyout(field, 'toggleColumnButton');
|
||||
}
|
||||
|
||||
const headerWithoutFields = await dataGrid.getHeaderFields();
|
||||
|
|
|
@ -312,6 +312,17 @@ export class DataGridService extends FtrService {
|
|||
return await tableDocViewRow.findByTestSubject(`~removeInclusiveFilterButton`);
|
||||
}
|
||||
|
||||
public async clickFieldActionInFlyout(fieldName: string, actionName: string): Promise<void> {
|
||||
const openPopoverButtonSelector = `openFieldActionsButton-${fieldName}`;
|
||||
const inlineButtonsGroupSelector = `fieldActionsGroup-${fieldName}`;
|
||||
if (await this.testSubjects.exists(openPopoverButtonSelector)) {
|
||||
await this.testSubjects.click(openPopoverButtonSelector);
|
||||
} else {
|
||||
await this.testSubjects.existOrFail(inlineButtonsGroupSelector);
|
||||
}
|
||||
await this.testSubjects.click(`${actionName}-${fieldName}`);
|
||||
}
|
||||
|
||||
public async removeInclusiveFilter(
|
||||
detailsRow: WebElementWrapper,
|
||||
fieldName: string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue