Skip to content

Commit

Permalink
[Discover] Fix flaky FT in field visualize (elastic#62418)
Browse files Browse the repository at this point in the history
* Unskip

* Set only suite

* Add field search

* Use alternative flaky fix

* Remove extra actions

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
sulemanof and elasticmachine committed Apr 4, 2020
1 parent 7884336 commit 66f509d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
9 changes: 4 additions & 5 deletions test/functional/apps/discover/_field_visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*',
};

// FLAKY: https://github.com/elastic/kibana/issues/61714
describe.skip('discover field visualize button', () => {
describe('discover field visualize button', () => {
before(async function() {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
Expand All @@ -50,7 +49,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should visualize a field in area chart', async () => {
await PageObjects.discover.clickFieldListItem('phpmemory');
await PageObjects.discover.findFieldByName('phpmemory');
log.debug('visualize a phpmemory field');
await PageObjects.discover.clickFieldListItemVisualize('phpmemory');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -83,7 +82,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {

it('should preserve app filters in visualize', async () => {
await filterBar.addFilter('bytes', 'is between', '3500', '4000');
await PageObjects.discover.clickFieldListItem('geo.src');
await PageObjects.discover.findFieldByName('geo.src');
log.debug('visualize a geo.src field with filter applied');
await PageObjects.discover.clickFieldListItemVisualize('geo.src');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -119,7 +118,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
it('should preserve query in visualize', async () => {
await queryBar.setQuery('machine.os : ios');
await queryBar.submitQuery();
await PageObjects.discover.clickFieldListItem('geo.dest');
await PageObjects.discover.findFieldByName('geo.dest');
log.debug('visualize a geo.dest field with query applied');
await PageObjects.discover.clickFieldListItemVisualize('geo.dest');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
19 changes: 15 additions & 4 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
return await el.getVisibleText();
}

public async findFieldByName(name: string) {
const fieldSearch = await testSubjects.find('fieldFilterSearchInput');
await fieldSearch.type(name);
}

public async saveSearch(searchName: string) {
log.debug('saveSearch');
await this.clickSaveSearchButton();
Expand Down Expand Up @@ -239,10 +244,16 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
await testSubjects.click(`fieldToggle-${field}`);
}

public async clickFieldListItemVisualize(field: string) {
return await retry.try(async () => {
await testSubjects.click(`fieldVisualize-${field}`);
});
public async clickFieldListItemVisualize(fieldName: string) {
const field = await testSubjects.find(`field-${fieldName}-showDetails`);
const isActive = await field.elementHasClass('dscSidebarItem--active');

if (!isActive) {
// expand the field to show the "Visualize" button
await field.click();
}

await testSubjects.click(`fieldVisualize-${fieldName}`);
}

public async expectFieldListItemVisualize(field: string) {
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/functional/apps/maps/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default function({ getService, getPageObjects }) {

it('should link geo_shape fields to Maps application', async () => {
await PageObjects.discover.selectIndexPattern('geo_shapes*');
await PageObjects.discover.clickFieldListItem('geometry');
await PageObjects.discover.clickFieldListItemVisualize('geometry');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
Expand All @@ -37,7 +36,6 @@ export default function({ getService, getPageObjects }) {
await queryBar.submitQuery();
await PageObjects.header.waitUntilLoadingHasFinished();

await PageObjects.discover.clickFieldListItem('geo.coordinates');
await PageObjects.discover.clickFieldListItemVisualize('geo.coordinates');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
Expand Down

0 comments on commit 66f509d

Please sign in to comment.