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

fixing flaky vsualize data_table_nontimeindex test #22288

Merged
merged 3 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 0 additions & 3 deletions test/functional/apps/visualize/_data_table_nontimeindex.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function ({ getService, getPageObjects }) {
log.debug('clickNewSearch');
await PageObjects.visualize.clickNewSearch(PageObjects.visualize.index.LOGSTASH_NON_TIME_BASED);
log.debug('Bucket = Split Rows');
await PageObjects.common.sleep(500);
await PageObjects.visualize.clickBucket('Split Rows');
log.debug('Aggregation = Histogram');
await PageObjects.visualize.selectAggregation('Histogram');
Expand Down Expand Up @@ -119,7 +118,6 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickNewSearch(PageObjects.visualize.index.LOGSTASH_NON_TIME_BASED);
await PageObjects.common.sleep(500);
await PageObjects.visualize.clickBucket('Split Rows');
await PageObjects.visualize.selectAggregation('Date Histogram');
await PageObjects.visualize.selectField('@timestamp');
Expand All @@ -139,7 +137,6 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickDataTable();
await PageObjects.visualize.clickNewSearch(PageObjects.visualize.index.LOGSTASH_NON_TIME_BASED);
await PageObjects.common.sleep(500);
await PageObjects.visualize.clickBucket('Split Rows');
await PageObjects.visualize.selectAggregation('Date Histogram');
await PageObjects.visualize.selectField('@timestamp');
Expand Down
30 changes: 18 additions & 12 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,25 @@ export function VisualizePageProvider({ getService, getPageObjects }) {

// clickBucket(bucketType) 'X-Axis', 'Split Area', 'Split Chart'
async clickBucket(bucketName) {
const chartTypes = await retry.try(
async () => await find.allByCssSelector('li.list-group-item.list-group-menu-item'));
log.debug('found bucket types ' + chartTypes.length);

async function getChartType(chart) {
const chartString = await chart.getVisibleText();
if (chartString === bucketName) {
await chart.click();
await PageObjects.common.sleep(500);
await retry.try(async () => {
const chartTypes = await retry.try(
async () => await find.allByCssSelector('li.list-group-item.list-group-menu-item'));
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to find a better selector than this one, it's also used on the metric list. I know that we then heve a check on the name, but it's not the right way to get this.

Copy link
Member Author

Choose a reason for hiding this comment

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

i agree, but would probably keep this PR to the minimal change.

log.debug('found bucket types ' + chartTypes.length);

async function getChartType(chart) {
const chartString = await chart.getVisibleText();
if (chartString === bucketName) {
await chart.click();
await PageObjects.common.sleep(500);
Copy link
Member

Choose a reason for hiding this comment

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

We cannot rely on a timer to be sure that the click is executed.

Copy link
Member Author

Choose a reason for hiding this comment

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

what would be your suggestion ? anyway, i would keep that out of this PR ... in general i think we want to remove every sleep in our tests with something more reliable.

return true;
}
}
}
const getChartTypesPromises = chartTypes.map(getChartType);
await Promise.all(getChartTypesPromises);
const getChartTypesPromises = chartTypes.map(getChartType);
const clickResult = await Promise.all(getChartTypesPromises);
if (!clickResult.some(result => result === true)) {
throw new Error(`bucket ${bucketName} not found`);
}
});
}

async selectAggregation(myString, groupName = 'buckets', childAggregationType = null) {
Expand Down