mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix search issue on listing page + tests (#12618)
* Fix search issue on listing page + tests * fix test case inconsistency * use backtics to create the search string
This commit is contained in:
parent
6c09a674cf
commit
31b33659ca
4 changed files with 61 additions and 2 deletions
|
@ -175,7 +175,11 @@
|
|||
|
||||
<td class="kuiTableRowCell">
|
||||
<div class="kuiTableRowCell__liner">
|
||||
<a class="kuiLink" ng-href="{{ listingController.getUrlForItem(item) }}">
|
||||
<a
|
||||
class="kuiLink"
|
||||
data-test-subj="dashboardListingTitleLink"
|
||||
ng-href="{{ listingController.getUrlForItem(item) }}"
|
||||
>
|
||||
{{ item.title }}
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -93,7 +93,7 @@ export class SavedObjectLoader {
|
|||
return this.savedObjectsClient.find(
|
||||
{
|
||||
type: this.lowercaseType,
|
||||
search,
|
||||
search: `${search}*`,
|
||||
perPage: size,
|
||||
page: 1,
|
||||
searchFields: ['title^3', 'description']
|
||||
|
|
|
@ -65,5 +65,44 @@ export default function ({ getPageObjects }) {
|
|||
expect(countOfDashboards).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('search', function () {
|
||||
before(async () => {
|
||||
await PageObjects.dashboard.clearSearchValue();
|
||||
await PageObjects.dashboard.clickCreateDashboardPrompt();
|
||||
await PageObjects.dashboard.saveDashboard('Two Words');
|
||||
await PageObjects.header.clickToastOK();
|
||||
});
|
||||
|
||||
it('matches on the first word', async function () {
|
||||
await PageObjects.dashboard.searchForDashboardWithName('Two');
|
||||
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
|
||||
expect(countOfDashboards).to.equal(1);
|
||||
});
|
||||
|
||||
it('matches the second word', async function () {
|
||||
await PageObjects.dashboard.searchForDashboardWithName('Words');
|
||||
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
|
||||
expect(countOfDashboards).to.equal(1);
|
||||
});
|
||||
|
||||
it('matches the second word prefix', async function () {
|
||||
await PageObjects.dashboard.searchForDashboardWithName('Wor');
|
||||
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
|
||||
expect(countOfDashboards).to.equal(1);
|
||||
});
|
||||
|
||||
it('does not match mid word', async function () {
|
||||
await PageObjects.dashboard.searchForDashboardWithName('ords');
|
||||
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
|
||||
expect(countOfDashboards).to.equal(0);
|
||||
});
|
||||
|
||||
it('is case insensitive', async function () {
|
||||
await PageObjects.dashboard.searchForDashboardWithName('two words');
|
||||
const countOfDashboards = await PageObjects.dashboard.getCountOfDashboardsInListingTable();
|
||||
expect(countOfDashboards).to.equal(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -270,6 +270,17 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
.click();
|
||||
}
|
||||
|
||||
async clearSearchValue() {
|
||||
log.debug(`clearSearchValue`);
|
||||
|
||||
await this.gotoDashboardLandingPage();
|
||||
|
||||
await retry.try(async () => {
|
||||
const searchFilter = await testSubjects.find('searchFilter');
|
||||
await searchFilter.clearValue();
|
||||
});
|
||||
}
|
||||
|
||||
async searchForDashboardWithName(dashName) {
|
||||
log.debug(`searchForDashboardWithName: ${dashName}`);
|
||||
|
||||
|
@ -286,6 +297,11 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
}
|
||||
|
||||
async getCountOfDashboardsInListingTable() {
|
||||
const dashboardTitles = await testSubjects.findAll('dashboardListingTitleLink');
|
||||
return dashboardTitles.length;
|
||||
}
|
||||
|
||||
async getDashboardCountWithName(dashName) {
|
||||
log.debug(`getDashboardCountWithName: ${dashName}`);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue