-
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
[Saved Search] [Embeddable] Fix issue where Dashboard panel targeting deleted saved search can't be removed #169896
Merged
davismcphee
merged 2 commits into
elastic:main
from
davismcphee:fix-deleted-saved-search-embeddable
Oct 26, 2023
Merged
Changes from all commits
Commits
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
109 changes: 109 additions & 0 deletions
109
x-pack/test/functional/apps/discover/saved_search_embeddable.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,109 @@ | ||
/* | ||
* 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 browser = getService('browser'); | ||
const dataGrid = getService('dataGrid'); | ||
const dashboardAddPanel = getService('dashboardAddPanel'); | ||
const dashboardPanelActions = getService('dashboardPanelActions'); | ||
const filterBar = getService('filterBar'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const testSubjects = getService('testSubjects'); | ||
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'timePicker', 'discover']); | ||
|
||
describe('discover saved search embeddable', () => { | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); | ||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/dashboard/current/data'); | ||
await kibanaServer.savedObjects.cleanStandardList(); | ||
await kibanaServer.importExport.load( | ||
'test/functional/fixtures/kbn_archiver/dashboard/current/kibana' | ||
); | ||
await kibanaServer.uiSettings.replace({ | ||
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', | ||
}); | ||
await PageObjects.common.setTime({ | ||
from: 'Sep 22, 2015 @ 00:00:00.000', | ||
to: 'Sep 23, 2015 @ 00:00:00.000', | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
await kibanaServer.savedObjects.cleanStandardList(); | ||
await PageObjects.common.unsetTime(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await PageObjects.dashboard.navigateToApp(); | ||
await filterBar.ensureFieldEditorModalIsClosed(); | ||
await PageObjects.dashboard.gotoDashboardLandingPage(); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
}); | ||
|
||
const addSearchEmbeddableToDashboard = async (title = 'Rendering-Test:-saved-search') => { | ||
await dashboardAddPanel.addSavedSearch(title); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
const rows = await dataGrid.getDocTableRows(); | ||
expect(rows.length).to.be.above(0); | ||
}; | ||
|
||
const refreshDashboardPage = async (requireRenderComplete = false) => { | ||
await browser.refresh(); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
if (requireRenderComplete) { | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
} | ||
}; | ||
|
||
it('should allow removing the dashboard panel after the underlying saved search has been deleted', async () => { | ||
const searchTitle = 'TempSearch'; | ||
const searchId = '90943e30-9a47-11e8-b64d-95841ca0b247'; | ||
await kibanaServer.savedObjects.create({ | ||
type: 'search', | ||
id: searchId, | ||
overwrite: false, | ||
attributes: { | ||
title: searchTitle, | ||
description: '', | ||
columns: ['agent', 'bytes', 'clientip'], | ||
sort: [['@timestamp', 'desc']], | ||
kibanaSavedObjectMeta: { | ||
searchSourceJSON: | ||
'{"highlightAll":true,"version":true,"query":{"language":"lucene","query":""},"filter":[],"indexRefName":"kibanaSavedObjectMeta.searchSourceJSON.index"}', | ||
}, | ||
}, | ||
references: [ | ||
{ | ||
id: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', | ||
name: 'kibanaSavedObjectMeta.searchSourceJSON.index', | ||
type: 'index-pattern', | ||
}, | ||
], | ||
}); | ||
await addSearchEmbeddableToDashboard(searchTitle); | ||
await PageObjects.dashboard.saveDashboard('Dashboard with deleted saved search', { | ||
waitDialogIsClosed: true, | ||
exitFromEditMode: false, | ||
}); | ||
await kibanaServer.savedObjects.delete({ | ||
type: 'search', | ||
id: searchId, | ||
}); | ||
await refreshDashboardPage(); | ||
await testSubjects.existOrFail('embeddableError'); | ||
const panels = await PageObjects.dashboard.getDashboardPanels(); | ||
await dashboardPanelActions.removePanel(panels[0]); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await testSubjects.missingOrFail('embeddableError'); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.
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.
I added this test to
x-pack/test
because the original bug was triggered by the CSV report action which isn't enabled during the regular functional tests.