-
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.
Browse files
Browse the repository at this point in the history
* fixed missing tags api when loading saved dashboard. Added tests
- Loading branch information
1 parent
230074a
commit eb86b9a
Showing
4 changed files
with
104 additions
and
7 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
89 changes: 89 additions & 0 deletions
89
x-pack/test/functional/apps/dashboard/dashboard_tagging.ts
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 | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const listingTable = getService('listingTable'); | ||
const testSubjects = getService('testSubjects'); | ||
const esArchiver = getService('esArchiver'); | ||
const find = getService('find'); | ||
const PageObjects = getPageObjects([ | ||
'common', | ||
'tagManagement', | ||
'header', | ||
'dashboard', | ||
'visualize', | ||
'lens', | ||
]); | ||
|
||
const dashboardTag = 'extremely-cool-dashboard'; | ||
const dashboardTitle = 'Coolest Blank Dashboard'; | ||
|
||
describe('dashboard tagging', () => { | ||
const verifyTagFromListingPage = async () => { | ||
await PageObjects.dashboard.gotoDashboardLandingPage(); | ||
await listingTable.waitUntilTableIsLoaded(); | ||
|
||
// open the filter dropdown | ||
const filterButton = await find.byCssSelector('.euiFilterGroup .euiFilterButton'); | ||
await filterButton.click(); | ||
await testSubjects.click( | ||
`tag-searchbar-option-${PageObjects.tagManagement.testSubjFriendly(dashboardTag)}` | ||
); | ||
// click elsewhere to close the filter dropdown | ||
const searchFilter = await find.byCssSelector('.euiPageBody .euiFieldSearch'); | ||
await searchFilter.click(); | ||
// wait until the table refreshes | ||
await listingTable.waitUntilTableIsLoaded(); | ||
const itemNames = await listingTable.getAllItemsNames(); | ||
expect(itemNames).to.contain(dashboardTitle); | ||
}; | ||
|
||
const createTagFromDashboard = async () => { | ||
await testSubjects.click('dashboardSaveMenuItem'); | ||
await testSubjects.click('savedObjectTagSelector'); | ||
await testSubjects.click(`tagSelectorOption-action__create`); | ||
|
||
expect(await PageObjects.tagManagement.tagModal.isOpened()).to.be(true); | ||
|
||
await PageObjects.tagManagement.tagModal.fillForm( | ||
{ | ||
name: dashboardTag, | ||
color: '#fc03db', | ||
description: '', | ||
}, | ||
{ | ||
submit: true, | ||
} | ||
); | ||
expect(await PageObjects.tagManagement.tagModal.isOpened()).to.be(false); | ||
}; | ||
|
||
before(async () => { | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/lens/basic'); | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.preserveCrossAppState(); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
}); | ||
|
||
it('adds a new tag to a new Dashboard', async () => { | ||
await createTagFromDashboard(); | ||
PageObjects.dashboard.saveDashboard(dashboardTitle, {}, false); | ||
await verifyTagFromListingPage(); | ||
}); | ||
|
||
it('retains its saved object tags after quicksave', async () => { | ||
await PageObjects.dashboard.gotoDashboardEditMode(dashboardTitle); | ||
await PageObjects.dashboard.useMargins(false); // turn margins off to cause quicksave to be enabled | ||
await PageObjects.dashboard.clickQuickSave(); | ||
await verifyTagFromListingPage(); | ||
}); | ||
}); | ||
} |
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