Skip to content

Commit

Permalink
[Lens] Unskip Lens smokescreen test (#71986)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wylie Conlon authored Jul 16, 2020
1 parent 8d9d323 commit b165538
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
});

Expand Down Expand Up @@ -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');
});

Expand All @@ -612,7 +612,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount(<IndexPatternDimensionEditorComponent {...defaultProps} />);

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(
Expand All @@ -626,7 +626,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount(<IndexPatternDimensionEditorComponent {...defaultProps} />);

wrapper
.find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
.find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');

wrapper
Expand All @@ -640,7 +640,7 @@ describe('IndexPatternDimensionEditorPanel', () => {
wrapper = mount(<IndexPatternDimensionEditorComponent {...defaultProps} />);

wrapper
.find('button[data-test-subj="lns-indexPatternDimensionIncompatible-terms"]')
.find('button[data-test-subj="lns-indexPatternDimension-terms incompatible"]')
.simulate('click');

const options = wrapper
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Expand Down
23 changes: 9 additions & 14 deletions x-pack/test/functional/apps/lens/smokescreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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();
});

Expand All @@ -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',
});
Expand Down
45 changes: 27 additions & 18 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
*
Expand All @@ -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);
Expand All @@ -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`);
},

/**
Expand Down Expand Up @@ -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');
});
},
});
}

0 comments on commit b165538

Please sign in to comment.