[Lens] Fix bug when removing dimensions from non-XY chart (#60704) (#60794)

This commit is contained in:
Wylie Conlon 2020-03-20 16:50:00 -04:00 committed by GitHub
parent b9e408e5a4
commit c0f901798c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View file

@ -150,6 +150,7 @@ export const datatableVisualization: Visualization<
accessors: sortedColumns,
supportsMoreColumns: true,
filterOperations: () => true,
dataTestSubj: 'lnsDatatable_column',
},
],
};

View file

@ -129,7 +129,7 @@ function LayerPanels(
},
},
visualization: {
activeId: activeVisualization.id,
...prevState.visualization,
state: newVisualizationState,
},
stagedPreview: undefined,

View file

@ -9,7 +9,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
// eslint-disable-next-line import/no-default-export
export default function({ getService, getPageObjects, ...rest }: FtrProviderContext) {
export default function({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects([
'header',
'common',
@ -89,6 +89,17 @@ export default function({ getService, getPageObjects, ...rest }: FtrProviderCont
field: 'bytes',
});
await PageObjects.lens.configureDimension({
dimension:
'[data-test-subj="lnsXY_splitDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
operation: 'terms',
field: '@message.raw',
});
await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_lnsDatatable');
await PageObjects.lens.removeDimension('lnsDatatable_column');
await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_bar_stacked');
await PageObjects.lens.configureDimension({
dimension:
'[data-test-subj="lnsXY_splitDimensionPanel"] [data-test-subj="lns-empty-dimension"]',

View file

@ -103,8 +103,8 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
/**
* Changes the specified dimension to the specified operation and (optinally) field.
*
* @param opts.from - the text of the dimension being changed
* @param opts.to - the desired operation for the dimension
* @param opts.dimension - the selector of the dimension being changed
* @param opts.operation - the desired operation ID for the dimension
* @param opts.field - the desired field for the dimension
*/
async configureDimension(opts: { dimension: string; operation?: string; field?: string }) {
@ -123,6 +123,15 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
}
},
/**
* Removes the dimension matching a specific test subject
*/
async removeDimension(dimensionTestSubj: string) {
await find.clickByCssSelector(
`[data-test-subj="${dimensionTestSubj}"] [data-test-subj="indexPattern-dimensionPopover-remove"]`
);
},
/**
* Save the current Lens visualization.
*/