Skip to content

Commit

Permalink
test(discover-log-explorer): add basic test to assert customizations …
Browse files Browse the repository at this point in the history
…are applied
  • Loading branch information
Marco Antonio Ghiani committed Jun 27, 2023
1 parent 29f0d7b commit e8ec06e
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 1 deletion.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ enabled:
- x-pack/test/functional/apps/data_views/config.ts
- x-pack/test/functional/apps/dev_tools/config.ts
- x-pack/test/functional/apps/discover/config.ts
- x-pack/test/functional/apps/discover_log_explorer/config.ts
- x-pack/test/functional/apps/graph/config.ts
- x-pack/test/functional/apps/grok_debugger/config.ts
- x-pack/test/functional/apps/home/config.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';

export const POPOVER_ID = 'data-stream-selector-popover';
export const POPOVER_ID = 'dataset-selector-popover';
export const INTEGRATION_PANEL_ID = 'integrations_panel';
export const UNMANAGED_STREAMS_PANEL_ID = 'unmanaged_streams_panel';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const DatasetsPopover = ({
return (
<EuiPopover
id={POPOVER_ID}
data-test-subj={POPOVER_ID}
button={
<EuiButton
css={buttonStyles}
Expand Down
17 changes: 17 additions & 0 deletions x-pack/test/functional/apps/discover_log_explorer/config.ts
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 x-pack/test/functional/apps/discover_log_explorer/customization.ts
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 x-pack/test/functional/apps/discover_log_explorer/index.ts
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'));
});
}

0 comments on commit e8ec06e

Please sign in to comment.