Skip to content

Commit

Permalink
add functional test for cutting originating app flow
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Aug 5, 2020
1 parent e4b66ce commit 68c623d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
19 changes: 12 additions & 7 deletions x-pack/test/functional/apps/maps/embeddable/save_and_return.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function ({ getPageObjects, getService }) {
const dashboardAddPanel = getService('dashboardAddPanel');
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardVisualizations = getService('dashboardVisualizations');
const testSubjects = getService('testSubjects');

describe('save and return work flow', () => {
describe('new map', () => {
Expand Down Expand Up @@ -45,12 +46,7 @@ export default function ({ getPageObjects, getService }) {
});

describe('save and return', () => {
it('editing map from dashboard should open maps application', async () => {
const doesLayerExist = await PageObjects.maps.doesLayerExist('geo_shapes*');
expect(doesLayerExist).to.equal(true);
});

it('clicking "save and return" should return to dashboard', async () => {
it('should return to dashboard', async () => {
await PageObjects.maps.clickSaveAndReturnButton();
await PageObjects.dashboard.waitForRenderComplete();
const panelCount = await PageObjects.dashboard.getPanelCount();
Expand All @@ -59,13 +55,22 @@ export default function ({ getPageObjects, getService }) {
});

describe('save as', () => {
it('clicking "save as" should return to dashboard and add new panel', async () => {
it('should return to dashboard and add new panel', async () => {
await PageObjects.maps.saveMap('Clone of map embeddable example');
await PageObjects.dashboard.waitForRenderComplete();
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.equal(3);
});
});

describe('save as and uncheck return to origin switch', () => {
it('should cut the originator and stay in maps application', async () => {
await PageObjects.maps.saveMap('Clone 2 of map embeddable example', true);
await PageObjects.maps.waitForLayersToLoad();
await testSubjects.missingOrFail('mapSaveAndReturnButton');
await testSubjects.existOrFail('mapSaveButton');
});
});
});
});
}
9 changes: 8 additions & 1 deletion x-pack/test/functional/page_objects/gis_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ export function GisPageProvider({ getService, getPageObjects }) {
await renderable.waitForRender();
}

async saveMap(name) {
async saveMap(name, uncheckReturnToOriginModeSwitch = false) {
await testSubjects.click('mapSaveButton');
await testSubjects.setValue('savedObjectTitle', name);
if (uncheckReturnToOriginModeSwitch) {
const redirectToOriginCheckboxExists = await testSubjects.exists('returnToOriginModeSwitch');
if (!redirectToOriginCheckboxExists) {
throw new Error('Unable to uncheck "returnToOriginModeSwitch", it does not exist.');
}
await testSubjects.setEuiSwitch('returnToOriginModeSwitch', 'uncheck');
}
await testSubjects.clickWhenNotDisabled('confirmSaveSavedObjectButton');
}

Expand Down

0 comments on commit 68c623d

Please sign in to comment.