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

[Discover] Fix flaky FT in field visualize #62418

Merged
merged 8 commits into from
Apr 4, 2020
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
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');
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this call be replaced with calls to PageObjects.discover.findFieldByName like in the discover tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, that's not really necessary (even in discover tests), findFieldByName only types the field name in the search bar, to make a field to be in top of sidebar.
This was done in first attempt to fix flaky tests, assuming that failing was caused by a field was too low and goes out of visible screen.
Since that time findFieldByName stayed in tests, don't see a problem with that. @dmlemeshko what are your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

If these tests are not flaky and do not require pre-search (flaky-test-runner showed 42 times passed), I think we don't need it..

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