Add functional tests for visualize loader API#22595
Conversation
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
|
retest |
ppisljar
left a comment
There was a problem hiding this comment.
thanks Tim! we'll need to add more tests around this, but this should make it quite easy to do so now.
| <EuiPageContentBody> | ||
| {/* | ||
| The div you want to render into should have its dimension set, since the visualization will | ||
| take exactly the space of that element. |
There was a problem hiding this comment.
should we mention 'or use flex layout' ?
| // This has a query key, which holds the query part of an Elasticsearch query | ||
| // and a meta key allowing to set some meta values, most important for this API | ||
| // the `negate` option to negate the filter. | ||
| return loader.embedVisualizationWithId(domNode, id, { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
markov00
left a comment
There was a problem hiding this comment.
Overall code looks good.
Tested the tests using slow 3g network settings and discovered a possible flaky test when waiting for visualization to complete rendering (see comment)
Approving after discuss this issue.
| async function selectParams(id) { | ||
| await testSubjects.click('embeddingParamsSelect'); | ||
| await find.clickByCssSelector(`option[value="${id}"]`); | ||
| await testSubjects.waitForDeleted('visLoadingIndicator'); |
There was a problem hiding this comment.
This methods waits the default timeout, and if the network have high latency, it can be cause a timeout error and a "flaky test" like the following generated configuring slow 3g on dev tools:
fail: "embedding visualizations embed by id vis on timebased data without date histogram should correctly embed"
│ Timeout: An operation did not complete before its timeout expired.
Our tests assumes that for sure the visLoadingIndicator will be removed after the whenFirstRenderComplete will complete, so here it's better to try this for X times at least or increase the default timeout to avoid having network timeout errors.
💔 Build Failed |
💚 Build Succeeded |
* Initial visualize loader functional tests * Extend plugin test README * Add temporary tz work around * Switch to Australia/North timezone * Add filtering tests * Add all tests * Remove unneeded uiExports * Improve explanation * Add saved object test, add retry
* Initial visualize loader functional tests * Extend plugin test README * Add temporary tz work around * Switch to Australia/North timezone * Add filtering tests * Add all tests * Remove unneeded uiExports * Improve explanation * Add saved object test, add retry
This PR adds functional tests within the plugin functional tests for embedding visualizations via the visualize loader API.
This has two purposes:
kibana_sample_plugin. That way we have an automated tested plugin, that demonstrates several usages of the visualize loader API and thus will always be up to date with the given Kibana version (not like the above plugin, that's most of the time out of date).Also a minor change was made in this PR, that makes the loader now set the required
display: flexon the container the visualization is embedded into.For QA: This PR should not change any behavior on Kibana.
Dev Docs
Visualize Loader
display: flexon the element you pass in, so that all visualizations are rendered correctly.embedVisualizationWithSavedObjectmethod is now deprecated and it's not encouraged using it anymore. You should rather useembedVisualizationWithIdand load a visualization by its id.