-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.0] [Maps] Remove unneeded and breaking layer condition that preven…
…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
- Loading branch information
Showing
7 changed files
with
147 additions
and
12 deletions.
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
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.maps.waitForLayersToLoad(); | ||
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.maps.waitForLayerDeleted(vectorLayer); | ||
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.maps.waitForLayersToLoad(); | ||
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.maps.waitForLayerDeleted(vectorLayer); | ||
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