-
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
Merged
Merged
[Maps] Remove unneeded and breaking layer condition that prevents cancel from add layer panel #31634
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c3c1934
Remove unneeded and breaking layer condition that prevents cancelling…
kindsun e8d390f
Merge remote-tracking branch 'upstream/master' into fix/oldLayerBool
kindsun fd34a29
Add layer tests. Review feedback
kindsun 306cc38
.....and the test file
kindsun 588d6c7
Merge remote-tracking branch 'upstream/master' into fix/oldLayerBool
kindsun b42b7b9
Review feedback. Factor out reusable maps test functions. Clean up
kindsun 4ee8413
Picky picky
kindsun ec05831
Review feedback. Remove sleeps
kindsun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from 'expect.js'; | ||
|
||
export default function ({ getPageObjects }) { | ||
const PageObjects = getPageObjects(['maps', 'common']); | ||
|
||
describe('Add layer panel', () => { | ||
before(async () => { | ||
await PageObjects.maps.openNewMap(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await PageObjects.maps.clickAddLayer(); | ||
}); | ||
|
||
afterEach(async () => { | ||
await PageObjects.maps.cancelLayerAdd(); | ||
}); | ||
|
||
it('should open on clicking "Add layer"', async () => { | ||
// Verify panel page element is open | ||
const panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(true); | ||
}); | ||
|
||
it('should close on clicking "Cancel"', async () => { | ||
// Verify panel page element is open | ||
let panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(true); | ||
// Click cancel | ||
await PageObjects.maps.cancelLayerAdd(); | ||
// Verify panel isn't open | ||
panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(false); | ||
}); | ||
|
||
it('should close & remove layer on clicking "Cancel" after selecting layer', | ||
async () => { | ||
// Verify panel page element is open | ||
let panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(true); | ||
// Select source | ||
await PageObjects.maps.selectVectorSource(); | ||
// Select layer | ||
const vectorLayer = await PageObjects.maps.selectVectorLayer(); | ||
// Confirm layer added | ||
await PageObjects.common.sleep(1000); | ||
let vectorLayerExists = await PageObjects.maps.doesLayerExist(vectorLayer); | ||
expect(vectorLayerExists).to.be(true); | ||
// Click cancel | ||
await PageObjects.maps.cancelLayerAdd(); | ||
// Verify panel isn't open | ||
panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(false); | ||
// Verify layer has been removed | ||
await PageObjects.common.sleep(500); | ||
vectorLayerExists = await PageObjects.maps.doesLayerExist(vectorLayer); | ||
expect(vectorLayerExists).to.be(false); | ||
}); | ||
|
||
it('should close and remove layer on map save', async () => { | ||
// Verify panel page element is open | ||
let panelOpen = await PageObjects.maps.isLayerAddPanelOpen(); | ||
expect(panelOpen).to.be(true); | ||
// Select source | ||
await PageObjects.maps.selectVectorSource(); | ||
// Select layer | ||
const vectorLayer = await PageObjects.maps.selectVectorLayer(); | ||
// Confirm layer added | ||
await PageObjects.common.sleep(1000); | ||
let vectorLayerExists = await PageObjects.maps.doesLayerExist(vectorLayer); | ||
expect(vectorLayerExists).to.be(true); | ||
// Click save | ||
await PageObjects.maps.saveMap('Mappishness'); | ||
// Verify panel isn't open | ||
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 commentThe 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 |
||
vectorLayerExists = await PageObjects.maps.doesLayerExist(vectorLayer); | ||
expect(vectorLayerExists).to.be(false); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 likeawait addLayerButton.waitForDeletedByClassName('euiLoadingSpinner');