[Discover] Adjust NoData screen (#160747)

- Closes https://github.com/elastic/kibana/issues/150317

## Summary

This PR:
- hides "Use without saving" button from NoData screen on Discover page
to align with Dashboard and Lens behaviour
- allows to open a saved search via URL even if there are no data views
present (before NoData screen was shown instead).
This commit is contained in:
Julia Rechkunova 2023-06-30 10:10:49 +02:00 committed by GitHub
parent 6c1ecf9369
commit 91fbd8e9e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 8 deletions

View file

@ -34,7 +34,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await security.testUser.restoreDefaults();
});
it('should create adhoc data view when there are no data view', async () => {
it('should create a data view when there are no data views', async () => {
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.common.navigateToApp('management');
await PageObjects.header.waitUntilLoadingHasFinished();
@ -57,9 +57,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const timestampField = await testSubjects.find('timestampField');
return !(await timestampField.elementHasClass('euiComboBox-isDisabled'));
});
await testSubjects.click('exploreIndexPatternButton');
await testSubjects.click('saveIndexPatternButton');
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await PageObjects.discover.isAdHocDataViewSelected()).to.be(false);
await PageObjects.discover.createAdHocDataView('log', true);
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await PageObjects.discover.isAdHocDataViewSelected()).to.be(true);
expect(await PageObjects.discover.getIndexPatterns()).to.eql(['log*\nTemporary', 'logs*']);
});
});
}

View file

@ -477,7 +477,9 @@ export class DiscoverPageObject extends FtrService {
public async isAdHocDataViewSelected() {
const dataView = await this.getCurrentlySelectedDataView();
await this.testSubjects.click('discover-dataView-switch-link');
return this.testSubjects.exists(`dataViewItemTempBadge-${dataView}`);
const hasBadge = await this.testSubjects.exists(`dataViewItemTempBadge-${dataView}`);
await this.testSubjects.click('discover-dataView-switch-link');
return hasBadge;
}
public async selectIndexPattern(indexPattern: string) {