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 b291b8b commit 80db76c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions test/functional/apps/discover/_field_visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,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 @@ -82,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 @@ -118,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 @@ -238,10 +243,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 80db76c

Please sign in to comment.