Skip to content

Commit

Permalink
Fixed breadcrumb typo in visualize create. Added dashboard selector o…
Browse files Browse the repository at this point in the history
…ptions to lens page. Added add to library option to savedObjectTagging test
  • Loading branch information
ThomThomson committed Jan 15, 2021
1 parent 676f971 commit b33de6e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export const useSavedVisInstance = (
? stateTransferService.getAppNameFromId(originatingApp)
: undefined;
const redirectToOrigin = originatingApp ? () => navigateToApp(originatingApp) : undefined;
const byValueCreateMode = dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables;
const byValueCreateMode =
Boolean(originatingApp) && dashboard.dashboardFeatureFlagConfig.allowByValueEmbeddables;

if (savedVis.id) {
chrome.setBreadcrumbs(
Expand Down
24 changes: 23 additions & 1 deletion x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,13 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
/**
* Save the current Lens visualization.
*/
async save(title: string, saveAsNew?: boolean, redirectToOrigin?: boolean) {
async save(
title: string,
saveAsNew?: boolean,
redirectToOrigin?: boolean,
addToDashboard?: boolean,
dashboardId?: boolean
) {
await PageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.click('lnsApp_saveButton');
await testSubjects.setValue('savedObjectTitle', title);
Expand All @@ -287,6 +293,22 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
await testSubjects.setEuiSwitch('returnToOriginModeSwitch', state);
}

const dashboardSelectorExists = await testSubjects.exists('add-to-dashboard-options');
if (dashboardSelectorExists) {
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
let optionSelector = 'add-to-library-option';
if (addToDashboard) {
optionSelector = dashboardId ? 'existing-dashboard-option' : 'new-dashboard-option';
}
log.debug('dashboard selector exists, choosing option:', optionSelector);
const label = await dashboardSelector.findByCssSelector(`label[for="${optionSelector}"]`);
await label.click();

if (dashboardId) {
// TODO - selecting an existing dashboard
}
}

await testSubjects.click('confirmSaveSavedObjectButton');
await retry.waitForWithTimeout('Save modal to disappear', 1000, () =>
testSubjects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

await PageObjects.visualize.ensureSavePanelOpen();
await testSubjects.setValue('savedObjectTitle', 'My new markdown viz');

const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(
`label[for="add-to-library-option"]`
);
await label.click();

await selectSavedObjectTags('tag-1');

await testSubjects.click('confirmSaveSavedObjectButton');
Expand All @@ -120,6 +127,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.visualize.ensureSavePanelOpen();
await testSubjects.setValue('savedObjectTitle', 'vis-with-new-tag');

const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(
`label[for="add-to-library-option"]`
);
await label.click();

await testSubjects.click('savedObjectTagSelector');
await testSubjects.click(`tagSelectorOption-action__create`);

Expand Down

0 comments on commit b33de6e

Please sign in to comment.