Skip to content

Commit

Permalink
[Lens] Fix bug when removing dimensions from non-XY chart (#60704) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Wylie Conlon authored Mar 20, 2020
1 parent b9e408e commit c0f9017
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const datatableVisualization: Visualization<
accessors: sortedColumns,
supportsMoreColumns: true,
filterOperations: () => true,
dataTestSubj: 'lnsDatatable_column',
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function LayerPanels(
},
},
visualization: {
activeId: activeVisualization.id,
...prevState.visualization,
state: newVisualizationState,
},
stagedPreview: undefined,
Expand Down
13 changes: 12 additions & 1 deletion x-pack/test/functional/apps/lens/smokescreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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"]',
Expand Down
13 changes: 11 additions & 2 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -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.
*/
Expand Down

0 comments on commit c0f9017

Please sign in to comment.