forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Search Embeddable] Add highlighting when searching (elastic#93178)
* [Search Embeddable] Add highlighting when searching * Adding a functional test
- Loading branch information
Maja Grubic
committed
Mar 3, 2021
1 parent
2519f56
commit d55b596
Showing
3 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const dashboardAddPanel = getService('dashboardAddPanel'); | ||
const filterBar = getService('filterBar'); | ||
const find = getService('find'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'timePicker', 'discover']); | ||
|
||
describe('dashboard saved search embeddable', () => { | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('logstash_functional'); | ||
await esArchiver.loadIfNeeded('dashboard/current/data'); | ||
await esArchiver.loadIfNeeded('dashboard/current/kibana'); | ||
await kibanaServer.uiSettings.replace({ | ||
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', | ||
}); | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await filterBar.ensureFieldEditorModalIsClosed(); | ||
await PageObjects.dashboard.gotoDashboardLandingPage(); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await PageObjects.timePicker.setAbsoluteRange( | ||
'Sep 22, 2015 @ 00:00:00.000', | ||
'Sep 23, 2015 @ 00:00:00.000' | ||
); | ||
}); | ||
|
||
it('highlighting on filtering works', async function () { | ||
await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search'); | ||
await filterBar.addFilter('agent', 'is', 'Mozilla'); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
const dataTable = await find.byCssSelector(`[data-test-subj="embeddedSavedSearchDocTable"]`); | ||
const $ = await dataTable.parseDomContent(); | ||
const marks = $('mark') | ||
.toArray() | ||
.map((mark) => $(mark).text()); | ||
expect(marks.length).to.be(50); | ||
}); | ||
|
||
it('removing a filter removes highlights', async function () { | ||
await filterBar.removeAllFilters(); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
const dataTable = await find.byCssSelector(`[data-test-subj="embeddedSavedSearchDocTable"]`); | ||
const $ = await dataTable.parseDomContent(); | ||
const marks = $('mark') | ||
.toArray() | ||
.map((mark) => $(mark).text()); | ||
expect(marks.length).to.be(0); | ||
}); | ||
}); | ||
} |