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

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

Merged
merged 1 commit into from
Sep 23, 2022
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
61 changes: 32 additions & 29 deletions test/functional/services/filter_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
}
18 changes: 8 additions & 10 deletions x-pack/test/functional/apps/maps/group2/embeddable/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down Expand Up @@ -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(
Expand Down