-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Maps] Remove unneeded and breaking layer condition that prevents cancel from add layer panel #31634
Conversation
… unless a layer's selected
Pinging @elastic/kibana-gis |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for this.state.layer
around this.props.removeTransientLayer()
can also be removed.
Lets add some functional tests to this PR for some of these flows. Lets add tests that verify
- Click
Add layer
, verify add panel opens - Click
Cancel
, verify add panel closes - Click
Add layer
, add source. Save map. Verify transient layer is removed
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functional tests are shaping up nicely. Need to remove the sleeps because they lead to timing issues
// Select layer | ||
const vectorLayer = await PageObjects.maps.selectVectorLayer(); | ||
// Confirm layer added | ||
await PageObjects.common.sleep(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sleeps lead to flaky tests because they are a work around for timing issues that can easily break.
Instead of sleep, verify Add layer
button is active and spinner no longer exists. Do something like await addLayerButton.waitForDeletedByClassName('euiLoadingSpinner');
panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(false); | ||
// Verify layer has been removed | ||
await PageObjects.common.sleep(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of sleep, wrap expect in retry. Sleeps lead to flaky tests because they mask timing issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
code review, tested changes in chrome
💚 Build Succeeded |
…cel from add layer panel (elastic#31634) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/test/functional/apps/maps/index.js
…cel from add layer panel (elastic#31634) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js # x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js # x-pack/test/functional/apps/maps/index.js
…cel from add layer panel (elastic#31634) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js # x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js # x-pack/test/functional/apps/maps/index.js
…cel from add layer panel (#31634) (#31926) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/test/functional/apps/maps/index.js
…cel from add layer panel (#31634) (#31932) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js # x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js # x-pack/test/functional/apps/maps/index.js
…ts cancel from add layer panel (#31634) (#31930) * [Maps] Remove unneeded and breaking layer condition that prevents cancel from add layer panel (#31634) * Remove unneeded and breaking layer condition that prevents cancelling unless a layer's selected * Add layer tests. Review feedback * .....and the test file * Review feedback. Factor out reusable maps test functions. Clean up * Picky picky * Review feedback. Remove sleeps # Conflicts: # x-pack/plugins/maps/public/components/widget_overlay/layer_control/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap # x-pack/plugins/maps/public/components/widget_overlay/layer_control/layer_toc/toc_entry/view.js # x-pack/plugins/maps/public/components/widget_overlay/layer_control/view.js # x-pack/test/functional/apps/maps/index.js * Remove trailing space
This bool condition appears to be no longer necessary and in fact, causes a bug. Requiring a layer to have been selected prevents cancelling before a layer has been selected. This update removes this condition.