Skip to content

Commit

Permalink
added the search profiler test , data test subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmivkulkarni committed Apr 3, 2020
1 parent ff6f3d2 commit 5586a33
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const ShardDetailsTreeNode = ({ operation, index, shard }: Props) => {
</EuiCodeBlock>
<EuiLink
type="button"
data-test-subj="viewShardDetails"
onClick={() => highlight({ indexName: index.name, operation, shard })}
>
{i18n.translate('xpack.searchProfiler.profileTree.body.viewDetailsLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const SearchProfilerTabs = ({ activeTab, activateTab, has }: Props) => {
return (
<EuiTabs>
<EuiTab
data-test-subj="queryProfileTab"
isSelected={activeTab === 'searches'}
disabled={!has.searches}
onClick={() => activateTab('searches')}
Expand All @@ -33,6 +34,7 @@ export const SearchProfilerTabs = ({ activeTab, activateTab, has }: Props) => {
})}
</EuiTab>
<EuiTab
data-test-subj="aggregationProfileTab"
isSelected={activeTab === 'aggregations'}
disabled={!has.aggregations}
onClick={() => activateTab('aggregations')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ export const ProfileQueryEditor = memo(() => {
<EuiSpacer size="s" />
</EuiFlexItem>
<EuiFlexItem grow={5}>
<EuiButton fill disabled={!licenseEnabled} onClick={() => handleProfileClick()}>
<EuiButton
data-test-subj="profileButton"
fill
disabled={!licenseEnabled}
onClick={() => handleProfileClick()}
>
<EuiText>
{i18n.translate('xpack.searchProfiler.formProfileButtonLabel', {
defaultMessage: 'Profile',
Expand Down
74 changes: 68 additions & 6 deletions x-pack/test/accessibility/apps/search_profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,84 @@
* you may not use this file except in compliance with the Elastic License.
*/

// import expect from '@kbn/expect';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';

export default function({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'security']);
const testSubjects = getService('testSubjects');
const aceEditor = getService('aceEditor');
const a11y = getService('a11y');
const log = getService('log');
// const testSubjects = getService('testSubjects');
const flyout = getService('flyout');

describe('Dev tools search profiler', () => {
// this test is skipped due to https://github.com/elastic/kibana/issues/62531
describe.skip('Accessibility Search Profiler Editor', () => {
before(async () => {
await PageObjects.common.navigateToApp('searchProfiler');
await a11y.testAppSnapshot();
expect(await testSubjects.exists('searchProfilerEditor')).to.be(true);
});

it('input the JSON in the aceeditor', async () => {
const input = {
query: {
bool: {
should: [
{
match: {
name: 'fred',
},
},
{
terms: {
name: ['sue', 'sally'],
},
},
],
},
},
aggs: {
stats: {
stats: {
field: 'price',
},
},
},
};

await aceEditor.setValue('searchProfilerEditor', JSON.stringify(input));
await a11y.testAppSnapshot();
});

it('click on the profile button', async () => {
await testSubjects.click('profileButton');
await a11y.testAppSnapshot();
});

it('click on the view details link', async () => {
const viewShardDetailslink = await testSubjects.findAll('viewShardDetails');
await viewShardDetailslink[0].click();
await a11y.testAppSnapshot();
});

it('close the fly out', async () => {
await flyout.ensureAllClosed();
await a11y.testAppSnapshot();
});

it('click on the Aggregation Profile link', async () => {
await testSubjects.click('aggregationProfileTab');
await a11y.testAppSnapshot();
});

it('click on the view details link', async () => {
const viewShardDetailslink = await testSubjects.findAll('viewShardDetails');
await viewShardDetailslink[0].click();
await a11y.testAppSnapshot();
});

it('Dev tools search profiler view', async () => {
log.debug('hello');
it('close the fly out', async () => {
await flyout.ensureAllClosed();
await a11y.testAppSnapshot();
});
});
Expand Down
5 changes: 1 addition & 4 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {

return {
...functionalConfig.getAll(),
testFiles: [
require.resolve('./apps/login_page'),
require.resolve('./apps/searchprofiler_editor'),
],
testFiles: [require.resolve('./apps/login_page'), require.resolve('./apps/search_profiler')],
pageObjects,
services,

Expand Down

0 comments on commit 5586a33

Please sign in to comment.