diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx
index e4dbc64184528..1f48f95ee45e0 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx
@@ -314,11 +314,11 @@ describe('IndexPatternDimensionEditorPanel', () => {
const items: EuiListGroupItemProps[] = wrapper.find(EuiListGroup).prop('listItems') || [];
expect(items.find(({ label }) => label === 'Minimum')!['data-test-subj']).not.toContain(
- 'Incompatible'
+ 'incompatible'
);
expect(items.find(({ label }) => label === 'Date histogram')!['data-test-subj']).toContain(
- 'Incompatible'
+ 'incompatible'
);
});
@@ -601,7 +601,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
act(() => {
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
});
@@ -612,7 +612,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount();
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
expect(wrapper.find('[data-test-subj="indexPattern-invalid-operation"]')).not.toHaveLength(
@@ -626,7 +626,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount();
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
wrapper
@@ -640,7 +640,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount();
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
const options = wrapper
@@ -722,7 +722,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
);
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-count"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-count incompatible"]')
.simulate('click');
const newColumnState = setState.mock.calls[0][0].layers.first.columns.col2;
@@ -758,7 +758,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
);
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
const options = wrapper
@@ -781,7 +781,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
act(() => {
wrapper
- .find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
+ .find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');
});
diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx
index 2fb7382f992e7..a5108b30cea1d 100644
--- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx
+++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/popover_editor.tsx
@@ -156,9 +156,9 @@ export function PopoverEditor(props: PopoverEditorProps) {
isActive,
size: 's',
className: 'lnsIndexPatternDimensionEditor__operation',
- 'data-test-subj': `lns-indexPatternDimension${
- compatibleWithCurrentField ? '' : 'Incompatible'
- }-${operationType}`,
+ 'data-test-subj': `lns-indexPatternDimension-${operationType}${
+ compatibleWithCurrentField ? '' : ' incompatible'
+ }`,
onClick() {
if (!selectedColumn || !compatibleWithCurrentField) {
const possibleFields = fieldByOperation[operationType] || [];
diff --git a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js b/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js
index ece326eabf869..c8a8f9653c11b 100644
--- a/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js
+++ b/x-pack/test/functional/apps/dashboard_mode/dashboard_empty_screen.js
@@ -36,22 +36,19 @@ export default function ({ getPageObjects, getService }) {
await PageObjects.visualize.clickLensWidget();
await PageObjects.lens.goToTimeRange();
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_xDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
field: '@timestamp',
});
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_yDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'avg',
field: 'bytes',
});
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_splitDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_splitDimensionPanel > lns-empty-dimension',
operation: 'terms',
field: 'ip',
});
diff --git a/x-pack/test/functional/apps/lens/smokescreen.ts b/x-pack/test/functional/apps/lens/smokescreen.ts
index 503b275442046..8bb5faf2469d7 100644
--- a/x-pack/test/functional/apps/lens/smokescreen.ts
+++ b/x-pack/test/functional/apps/lens/smokescreen.ts
@@ -64,8 +64,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await browser.getActions().move({ x: 5, y: 5, origin: el._webElement }).click().perform();
}
- // FLAKY: https://github.com/elastic/kibana/issues/71304
- describe.skip('lens smokescreen tests', () => {
+ describe('lens smokescreen tests', () => {
it('should allow editing saved visualizations', async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Artistpreviouslyknownaslens');
@@ -112,9 +111,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.clickVisualizeListItemTitle('Artistpreviouslyknownaslens');
await PageObjects.lens.goToTimeRange();
await assertExpectedMetric();
- await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_lnsDatatable');
+ await PageObjects.lens.switchToVisualization('lnsDatatable');
await assertExpectedTable();
- await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_lnsMetric');
+ await PageObjects.lens.switchToVisualization('lnsMetric');
await assertExpectedMetric();
});
@@ -124,33 +123,29 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.lens.goToTimeRange();
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_xDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
field: '@timestamp',
});
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_yDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'avg',
field: 'bytes',
});
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_splitDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_splitDimensionPanel > lns-empty-dimension',
operation: 'terms',
field: '@message.raw',
});
- await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_lnsDatatable');
+ await PageObjects.lens.switchToVisualization('lnsDatatable');
await PageObjects.lens.removeDimension('lnsDatatable_column');
- await PageObjects.lens.switchToVisualization('lnsChartSwitchPopover_bar_stacked');
+ await PageObjects.lens.switchToVisualization('bar_stacked');
await PageObjects.lens.configureDimension({
- dimension:
- '[data-test-subj="lnsXY_splitDimensionPanel"] [data-test-subj="lns-empty-dimension"]',
+ dimension: 'lnsXY_splitDimensionPanel > lns-empty-dimension',
operation: 'terms',
field: 'ip',
});
diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts
index ce621d4471d0f..4252c400ff1cd 100644
--- a/x-pack/test/functional/page_objects/lens_page.ts
+++ b/x-pack/test/functional/page_objects/lens_page.ts
@@ -74,16 +74,6 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
return this.assertExpectedText(selector, (value) => value === expectedText);
},
- /**
- * Uses the Lens visualization switcher to switch visualizations.
- *
- * @param dataTestSubj - the data-test-subj of the visualization to switch to
- */
- async switchToVisualization(dataTestSubj: string) {
- await testSubjects.click('lnsChartSwitchPopover');
- await testSubjects.click(dataTestSubj);
- },
-
/**
* Clicks a visualize list item's title (in the visualize app).
*
@@ -101,12 +91,12 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
* @param opts.field - the desired field for the dimension
*/
async configureDimension(opts: { dimension: string; operation: string; field: string }) {
- await find.clickByCssSelector(opts.dimension);
+ await retry.try(async () => {
+ await testSubjects.click(opts.dimension);
+ await testSubjects.exists(`lns-indexPatternDimension-${opts.operation}`);
+ });
- await find.clickByCssSelector(
- `[data-test-subj="lns-indexPatternDimensionIncompatible-${opts.operation}"],
- [data-test-subj="lns-indexPatternDimension-${opts.operation}"]`
- );
+ await testSubjects.click(`lns-indexPatternDimension-${opts.operation}`);
const target = await testSubjects.find('indexPattern-dimension-field');
await comboBox.openOptionsList(target);
@@ -117,9 +107,7 @@ 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"]`
- );
+ await testSubjects.click(`${dimensionTestSubj} > indexPattern-dimensionPopover-remove`);
},
/**
@@ -158,5 +146,26 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
getTitle() {
return testSubjects.getVisibleText('lns_ChartTitle');
},
+
+ /**
+ * Uses the Lens visualization switcher to switch visualizations.
+ *
+ * @param subVisualizationId - the ID of the sub-visualization to switch to, such as
+ * lnsDatatable or bar_stacked
+ */
+ async switchToVisualization(subVisualizationId: string) {
+ await this.openChartSwitchPopover();
+ await testSubjects.click(`lnsChartSwitchPopover_${subVisualizationId}`);
+ },
+
+ async openChartSwitchPopover() {
+ if (await testSubjects.exists('visTypeTitle')) {
+ return;
+ }
+ await retry.try(async () => {
+ await testSubjects.click('lnsChartSwitchPopover');
+ await testSubjects.existOrFail('visTypeTitle');
+ });
+ },
});
}