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

Wait for visualizations to render in tests #21258

Merged
merged 5 commits into from
Jul 27, 2018

Conversation

timroes
Copy link
Contributor

@timroes timroes commented Jul 26, 2018

This PR introduces a new data-loading attribute while rendering visualizations and wait for that attribute in tests for actually not just waiting for the data loading to finish (what PageObjects.header.waitUntilLoadingHasFinished does), but also for the visualization to have signaled that it's done loading.

cc @stacey-gammon @ppisljar @liza-mae @LeeDr

@timroes timroes added test WIP Work in progress Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v7.0.0 v6.5.0 labels Jul 26, 2018
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar
Copy link
Member

code LGTM

jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes timroes removed the WIP Work in progress label Jul 26, 2018
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

}
vis = visualizations[0];
}
await retry.tryForTime(10000, async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 10000 is the default so you could just do:

await retry.try(async () => {..

return await sharedItem.getAttribute('data-render-complete');
const sharedItems = await this.getPanelSharedItemData();
await Promise.all(sharedItems.map(async sharedItem => {
return await visualization.waitForRender(sharedItem.element, sharedItem.title, { ignoreNonVisualization: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might be a lot slower than the previous implementation. The element being passed in here, I don't think is the element with the TEST_SUBJECT_VISUALIZE on it, so for every panel on the dashboard, it's going to call testSubjects.findAllDescendant(TEST_SUBJECT_VISUALIZE, parentElement);. All the findAll* functions are really slow and should be avoided where possible.

I could be wrong though...

Could you maybe create a waitForAllToRender function that instead of looking for a single visualization, just always does:

const visualizations = await testSubjects.findAllDescendant(TEST_SUBJECT_VISUALIZE, bodyElement);

then loops through them all and waits for 'data-loading' attribute to go away?

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 it IS that element (why I needed to change the function to also accept the element itself and not just look in its descendant) :-) Would you still want it to changed in that case?

@timroes
Copy link
Contributor Author

timroes commented Jul 26, 2018

Jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes
Copy link
Contributor Author

timroes commented Jul 26, 2018

Jenkins, test this

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar
Copy link
Member

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes
Copy link
Contributor Author

timroes commented Jul 27, 2018

Jenkins, test this - hit #19743 flaky test

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes timroes merged commit bd03506 into elastic:master Jul 27, 2018
@timroes timroes deleted the vis-rendering-wait branch July 27, 2018 11:10
Copy link
Contributor

@stacey-gammon stacey-gammon left a comment

Choose a reason for hiding this comment

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

for the record, spoke to Tim offline and gave lgtm prior to merge. I have some suggestions to go on top of it but will experiment with those separately so as not to hold this up.

timroes added a commit to timroes/kibana that referenced this pull request Jul 27, 2018
* Wait for visualizations to render

* Use Visualize.waitForRender on dashboard

* Enable previously flaky dashboard tests again

* Add data-loading for initial render

* Remove unnecessary timeout
timroes added a commit that referenced this pull request Jul 27, 2018
* Wait for visualizations to render

* Use Visualize.waitForRender on dashboard

* Enable previously flaky dashboard tests again

* Add data-loading for initial render

* Remove unnecessary timeout
@stacey-gammon
Copy link
Contributor

stacey-gammon commented Jul 30, 2018

Looks like this did not fix the flakiness for the dashboard filtering test - #21375 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) test v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants