Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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