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

[TSVB] Table: Base refactoring (30 runs) #35162

Closed
wants to merge 12 commits into from
68 changes: 49 additions & 19 deletions .ci/jobs.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
JOB:
- kibana-intake
- x-pack-intake
- kibana-ciGroup1
- kibana-ciGroup2
- kibana-ciGroup3
- kibana-ciGroup4
- kibana-ciGroup5
- kibana-ciGroup6
- kibana-ciGroup7
- kibana-ciGroup8
- kibana-ciGroup9
- kibana-ciGroup10
- kibana-ciGroup11
- kibana-ciGroup12
- kibana-ciGroup12-1
- kibana-ciGroup12-2
- kibana-ciGroup12-3
- kibana-ciGroup12-4
- kibana-ciGroup12-5
- kibana-ciGroup12-6
- kibana-ciGroup12-7
- kibana-ciGroup12-8
- kibana-ciGroup12-9
- kibana-ciGroup12-10
- kibana-ciGroup12-11
- kibana-ciGroup12-12
- kibana-ciGroup12-13
- kibana-ciGroup12-14
- kibana-ciGroup12-15
- kibana-ciGroup12-16
- kibana-ciGroup12-17
- kibana-ciGroup12-18
- kibana-ciGroup12-19
- kibana-ciGroup12-20
- kibana-ciGroup12-21
- kibana-ciGroup12-22
- kibana-ciGroup12-23
- kibana-ciGroup12-24
- kibana-ciGroup12-25
- kibana-ciGroup12-26
- kibana-ciGroup12-27
- kibana-ciGroup12-28
- kibana-ciGroup12-29
- kibana-ciGroup12-30
# - kibana-ciGroup1
# - kibana-ciGroup2
# - kibana-ciGroup3
# - kibana-ciGroup4
# - kibana-ciGroup5
# - kibana-ciGroup6
# - kibana-ciGroup7
# - kibana-ciGroup8
# - kibana-ciGroup9
# - kibana-ciGroup10
# - kibana-ciGroup11
# - kibana-ciGroup12
# make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh
- x-pack-ciGroup1
- x-pack-ciGroup2
- x-pack-ciGroup3
- x-pack-ciGroup4
- x-pack-ciGroup5
- x-pack-ciGroup6
- x-pack-ciGroup7
# - x-pack-ciGroup1
# - x-pack-ciGroup2
# - x-pack-ciGroup3
# - x-pack-ciGroup4
# - x-pack-ciGroup5
# - x-pack-ciGroup6
# - x-pack-ciGroup7

# `~` is yaml for `null`
exclude: ~
7 changes: 5 additions & 2 deletions src/functional_test_runner/lib/mocha/setup_mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ export async function setupMocha(lifecycle, log, config, providers) {
filterSuitesByTags({
log,
mocha,
include: config.get('suiteTags.include'),
exclude: config.get('suiteTags.exclude'),
include: config.get('suiteTags.include')
.map(tag => tag.replace(/-\d+$/, '')),
exclude: config.get('suiteTags.exclude')
.map(tag => tag.replace(/-\d+$/, '')),

});

return mocha;
Expand Down
19 changes: 0 additions & 19 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,6 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});
});

describe('table', () => {
beforeEach(async () => {
await PageObjects.visualBuilder.resetPage(
'2015-09-22 06:00:00.000',
'2015-09-22 11:00:00.000'
);
await PageObjects.visualBuilder.clickTable();
});

it('should display correct values on changing group by field and column name', async () => {
await PageObjects.visualBuilder.selectGroupByField('machine.os.raw');
await PageObjects.visualBuilder.setLabelValue('OS');
await PageObjects.visualize.waitForVisualizationRenderingStabilized();
const tableData = await PageObjects.visualBuilder.getViewTable();
const expectedData = 'OS Count\nwin 8 13\nwin xp 10\nwin 7 12\nios 5\nosx 3';
expect(tableData).to.be(expectedData);
});
});

describe.skip('switch index patterns', () => {
before(async () => {
log.debug('Load kibana_sample_data_flights data');
Expand Down
57 changes: 57 additions & 0 deletions test/functional/apps/visualize/_tsvb_table.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function({ getPageObjects }: FtrProviderContext) {
const { visualBuilder, visualize } = getPageObjects(['visualBuilder', 'visualize']);

describe('visual builder', function describeIndexTests() {
describe('table', () => {
beforeEach(async () => {
await visualBuilder.resetPage('2015-09-22 06:00:00.000', '2015-09-22 11:00:00.000');
await visualBuilder.clickTable();

await visualBuilder.checkTableTabIsPresent();
await visualBuilder.selectGroupByField('machine.os.raw');
await visualBuilder.setColumnLabelValue('OS');
await visualize.waitForVisualizationRenderingStabilized();
});

it('should display correct values on changing group by field and column name', async () => {
const EXPECTED = 'OS Count\nwin 8 13\nwin xp 10\nwin 7 12\nios 5\nosx 3';

const tableData = await visualBuilder.getViewTable();
expect(tableData).to.be(EXPECTED);
});

it('should display correct values on changing metrics aggregation', async () => {
const EXPECTED = 'OS Cardinality\nwin 8 12\nwin xp 9\nwin 7 8\nios 5\nosx 3';

await visualBuilder.setLabel('Cardinality');
await visualBuilder.selectAggType('Cardinality');
await visualBuilder.setFieldForAggregation('machine.ram');
const tableData = await visualBuilder.getViewTable();
expect(tableData).to.be(EXPECTED);
});
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/visualize/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./_vertical_bar_chart_nontimeindex'));
loadTestFile(require.resolve('./_tsvb_chart'));
loadTestFile(require.resolve('./_tsvb_markdown'));
loadTestFile(require.resolve('./_tsvb_table'));
loadTestFile(require.resolve('./_vega_chart'));
});
});
Expand Down
56 changes: 53 additions & 3 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
});
}

public async selectAggType(value: string, nth = 0) {
public async selectAggType(value: string, nth: number = 0): Promise<void> {
const elements = await testSubjects.findAll('aggSelector');
await comboBox.setElement(elements[nth], value);
return await PageObjects.header.waitUntilLoadingHasFinished();
Expand All @@ -262,14 +262,22 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
await comboBox.set('groupByField', fieldName);
}

public async setLabelValue(value: string) {
public async setColumnLabelValue(value: string) {
const el = await testSubjects.find('columnLabelName');
await el.clearValue();
await el.type(value);
await PageObjects.header.waitUntilLoadingHasFinished();
}

public async getViewTable() {
/**
* get values for rendered table
*
* **Note:** this work only for table visualization
*
* @returns {Promise<string>}
* @memberof VisualBuilderPage
*/
public async getViewTable(): Promise<string> {
const tableView = await testSubjects.find('tableView');
return await tableView.getVisibleText();
}
Expand All @@ -294,6 +302,48 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
await el.pressKeys(browser.keys.RETURN);
await PageObjects.header.waitUntilLoadingHasFinished();
}

/**
* check that table visualization is visible and ready for interact
*
* @returns {Promise<void>}
* @memberof VisualBuilderPage
*/
public async checkTableTabIsPresent(): Promise<void> {
await testSubjects.existOrFail('visualizationLoader');
const isDataExists = await testSubjects.exists('tableView');
log.debug(`data is already rendered: ${isDataExists}`);
if (!isDataExists) {
await testSubjects.existOrFail('noTSVBDataMessage');
}
}
dmlemeshko marked this conversation as resolved.
Show resolved Hide resolved

/**
* set label name for aggregation
*
* @param {string} labelName
* @param {number} [nth=0]
* @memberof VisualBuilderPage
*/
public async setLabel(labelName: string, nth: number = 0): Promise<void> {
const input = (await find.allByCssSelector('[placeholder="Label"]'))[nth];
await input.type(labelName);
}

/**
* set field for type of aggregation
*
* @param {string} field name of field
* @param {number} [aggNth=0] number of aggregation. Start by zero
* @default 0
* @memberof VisualBuilderPage
*/
public async setFieldForAggregation(field: string, aggNth: number = 0): Promise<void> {
const labels = await testSubjects.findAll('aggRow');
const label = labels[aggNth];
const fieldEl = (await label.findAllByCssSelector('[data-test-subj = "comboBoxInput"]'))[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not look like a reliable way. Can we set a unique data-test-subj for a parent element?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 fields are the same for the current label

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for merge pr #35356. After that I will add data-test-subj property for labels

await comboBox.setElement(fieldEl, field);
}
}

return new VisualBuilderPage();
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/jenkins_ci_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function report {

trap report EXIT

"$(FORCE_COLOR=0 yarn bin)/grunt" functionalTests:ensureAllTestsInCiGroup;
# "$(FORCE_COLOR=0 yarn bin)/grunt" functionalTests:ensureAllTestsInCiGroup;

node scripts/build --debug --oss;

Expand Down