-
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.
test(discover-log-explorer): add basic test to assert customizations …
…are applied
- Loading branch information
Marco Antonio Ghiani
committed
Jun 27, 2023
1 parent
29f0d7b
commit e8ec06e
Showing
6 changed files
with
95 additions
and
1 deletion.
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
17 changes: 17 additions & 0 deletions
17
x-pack/test/functional/apps/discover_log_explorer/config.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,17 @@ | ||
/* | ||
* 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 { FtrConfigProviderContext } from '@kbn/test'; | ||
|
||
export default async function ({ readConfigFile }: FtrConfigProviderContext) { | ||
const functionalConfig = await readConfigFile(require.resolve('../../config.base.js')); | ||
|
||
return { | ||
...functionalConfig.getAll(), | ||
testFiles: [require.resolve('.')], | ||
}; | ||
} |
61 changes: 61 additions & 0 deletions
61
x-pack/test/functional/apps/discover_log_explorer/customization.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,61 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'header', 'discover', 'timePicker', 'dashboard']); | ||
const testSubjects = getService('testSubjects'); | ||
const defaultSettings = { | ||
defaultIndex: 'logstash-*', | ||
'doc_table:legacy': false, | ||
}; | ||
|
||
describe('Customizations', () => { | ||
before('initialize tests', async () => { | ||
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); | ||
await kibanaServer.uiSettings.update(defaultSettings); | ||
}); | ||
|
||
after('clean up archives', async () => { | ||
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); | ||
await kibanaServer.uiSettings.unset('doc_table:legacy'); | ||
}); | ||
|
||
describe('when Discover is load with the log-explorer profile', () => { | ||
it('DatasetSelector should replace the DataViewPicker', async () => { | ||
// Assert does not render on discover app | ||
await PageObjects.common.navigateToApp('discover'); | ||
await testSubjects.missingOrFail('dataset-selector-popover'); | ||
|
||
// Assert it renders on log-explorer profile | ||
await PageObjects.common.navigateToActualUrl('discover', 'p/log-explorer'); | ||
await testSubjects.existOrFail('dataset-selector-popover'); | ||
}); | ||
|
||
it('the TopNav bar should hide New, Open and Save options', async () => { | ||
// Assert does not render on discover app | ||
await PageObjects.common.navigateToApp('discover'); | ||
await testSubjects.existOrFail('discoverNewButton'); | ||
await testSubjects.existOrFail('discoverOpenButton'); | ||
await testSubjects.existOrFail('shareTopNavButton'); | ||
await testSubjects.existOrFail('discoverAlertsButton'); | ||
await testSubjects.existOrFail('openInspectorButton'); | ||
await testSubjects.existOrFail('discoverSaveButton'); | ||
|
||
// Assert it renders on log-explorer profile | ||
await PageObjects.common.navigateToActualUrl('discover', 'p/log-explorer'); | ||
await testSubjects.missingOrFail('discoverNewButton'); | ||
await testSubjects.missingOrFail('discoverOpenButton'); | ||
await testSubjects.existOrFail('shareTopNavButton'); | ||
await testSubjects.existOrFail('discoverAlertsButton'); | ||
await testSubjects.existOrFail('openInspectorButton'); | ||
await testSubjects.missingOrFail('discoverSaveButton'); | ||
}); | ||
}); | ||
}); | ||
} |
14 changes: 14 additions & 0 deletions
14
x-pack/test/functional/apps/discover_log_explorer/index.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,14 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile }: FtrProviderContext) { | ||
describe('Discover Log-Explorer profile', function () { | ||
loadTestFile(require.resolve('./customization')); | ||
}); | ||
} |