[Maps] unskip 'embed in dashboard' functional test (#141289)

* [Maps] unskip 'embed in dashboard' functional test

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nick.peihl@elastic.co>
This commit is contained in:
Nathan Reese 2022-09-23 10:12:28 -06:00 committed by GitHub
parent e936a92b58
commit d23aa3195a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 39 deletions

View file

@ -113,29 +113,20 @@ export class FilterBarService extends FtrService {
return Promise.all(filters.map((filter) => filter.getVisibleText()));
}
/**
* Adds a filter to the filter bar.
*
* @param {string} field The name of the field the filter should be applied for.
* @param {string} operator A valid operator for that fields, e.g. "is one of", "is", "exists", etc.
* @param {string[]|string} values The remaining parameters are the values passed into the individual
* value input fields, i.e. the third parameter into the first input field, the fourth into the second, etc.
* Each value itself can be an array, in case you want to enter multiple values into one field (e.g. for "is one of"):
* @example
* // Add a plain single value
* filterBar.addFilter('country', 'is', 'NL');
* // Add an exists filter
* filterBar.addFilter('country', 'exists');
* // Add a range filter for a numeric field
* filterBar.addFilter('bytes', 'is between', '500', '1000');
* // Add a filter containing multiple values
* filterBar.addFilter('extension', 'is one of', ['jpg', 'png']);
*/
public async addFilter(field: string, operator: string, ...values: any): Promise<void> {
public async addFilterAndSelectDataView(
dataViewTitle: string | null,
field: string,
operator: string,
...values: any
): Promise<void> {
await this.retry.tryForTime(this.defaultTryTimeout * 2, async () => {
await this.testSubjects.click('addFilter');
await this.testSubjects.existOrFail('addFilterPopover');
if (dataViewTitle) {
await this.comboBox.set('filterIndexPatternsSelect', dataViewTitle);
}
await this.comboBox.set('filterFieldSuggestionList', field);
await this.comboBox.set('filterOperatorList', operator);
const params = await this.testSubjects.find('filterParams');
@ -166,6 +157,28 @@ export class FilterBarService extends FtrService {
await this.header.awaitGlobalLoadingIndicatorHidden();
}
/**
* Adds a filter to the filter bar.
*
* @param {string} field The name of the field the filter should be applied for.
* @param {string} operator A valid operator for that fields, e.g. "is one of", "is", "exists", etc.
* @param {string[]|string} values The remaining parameters are the values passed into the individual
* value input fields, i.e. the third parameter into the first input field, the fourth into the second, etc.
* Each value itself can be an array, in case you want to enter multiple values into one field (e.g. for "is one of"):
* @example
* // Add a plain single value
* filterBar.addFilter('country', 'is', 'NL');
* // Add an exists filter
* filterBar.addFilter('country', 'exists');
* // Add a range filter for a numeric field
* filterBar.addFilter('bytes', 'is between', '500', '1000');
* // Add a filter containing multiple values
* filterBar.addFilter('extension', 'is one of', ['jpg', 'png']);
*/
public async addFilter(field: string, operator: string, ...values: any): Promise<void> {
await this.addFilterAndSelectDataView(null, field, operator, ...values);
}
/**
* Activates filter editing
* @param key field name
@ -212,14 +225,4 @@ export class FilterBarService extends FtrService {
await this.ensureFieldEditorModalIsClosed();
return indexPatterns.trim().split('\n').join(',');
}
/**
* Adds new index pattern filter
* @param indexPatternTitle
*/
public async selectIndexPattern(indexPatternTitle: string): Promise<void> {
await this.testSubjects.click('addFilter');
await this.comboBox.set('filterIndexPatternsSelect', indexPatternTitle);
await this.testSubjects.click('addFilter');
}
}

View file

@ -19,8 +19,7 @@ export default function ({ getPageObjects, getService }) {
const security = getService('security');
const testSubjects = getService('testSubjects');
// Failing: See https://github.com/elastic/kibana/issues/140241
describe.skip('embed in dashboard', () => {
describe('embed in dashboard', () => {
before(async () => {
await security.testUser.setRoles(
[
@ -100,16 +99,15 @@ export default function ({ getPageObjects, getService }) {
});
it('should apply new container state (time, query, filters) to embeddable', async () => {
await filterBar.selectIndexPattern('logstash-*');
await filterBar.addFilter('machine.os', 'is', 'win 8');
await filterBar.addFilterAndSelectDataView('logstash-*', 'machine.os', 'is', 'win 8');
await PageObjects.maps.waitForLayersToLoad();
// retry is fix for flaky test https://github.com/elastic/kibana/issues/113993
// timing issue where click for addFilter opens filter pill created above instead of clicking addFilter
await retry.try(async () => {
await filterBar.selectIndexPattern('meta_for_geo_shapes*');
await filterBar.addFilter('shape_name', 'is', 'alpha'); // runtime fields do not have autocomplete
});
await filterBar.addFilterAndSelectDataView(
'meta_for_geo_shapes*',
'shape_name',
'is',
'alpha'
);
await PageObjects.maps.waitForLayersToLoad();
const { rawResponse: gridResponse } = await PageObjects.maps.getResponseFromDashboardPanel(