From 5586a33c2a474c20d53dfd6a45308f2cc6adc827 Mon Sep 17 00:00:00 2001 From: Rashmi Kulkarni Date: Fri, 3 Apr 2020 15:58:16 -0700 Subject: [PATCH] added the search profiler test , data test subjects --- .../shard_details/shard_details_tree_node.tsx | 1 + .../components/searchprofiler_tabs.tsx | 2 + .../containers/profile_query_editor.tsx | 7 +- .../accessibility/apps/search_profiler.ts | 74 +++++++++++++++++-- x-pack/test/accessibility/config.ts | 5 +- 5 files changed, 78 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/shard_details/shard_details_tree_node.tsx b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/shard_details/shard_details_tree_node.tsx index 1d8f915d3d47d3..d89046090a9611 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/profile_tree/shard_details/shard_details_tree_node.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/profile_tree/shard_details/shard_details_tree_node.tsx @@ -94,6 +94,7 @@ export const ShardDetailsTreeNode = ({ operation, index, shard }: Props) => { highlight({ indexName: index.name, operation, shard })} > {i18n.translate('xpack.searchProfiler.profileTree.body.viewDetailsLabel', { diff --git a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs.tsx b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs.tsx index 19224e7099fd66..7e6dad7df5528a 100644 --- a/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs.tsx +++ b/x-pack/plugins/searchprofiler/public/application/components/searchprofiler_tabs.tsx @@ -24,6 +24,7 @@ export const SearchProfilerTabs = ({ activeTab, activateTab, has }: Props) => { return ( activateTab('searches')} @@ -33,6 +34,7 @@ export const SearchProfilerTabs = ({ activeTab, activateTab, has }: Props) => { })} activateTab('aggregations')} diff --git a/x-pack/plugins/searchprofiler/public/application/containers/profile_query_editor.tsx b/x-pack/plugins/searchprofiler/public/application/containers/profile_query_editor.tsx index 5348c55ad52139..f6377d2b4f9067 100644 --- a/x-pack/plugins/searchprofiler/public/application/containers/profile_query_editor.tsx +++ b/x-pack/plugins/searchprofiler/public/application/containers/profile_query_editor.tsx @@ -120,7 +120,12 @@ export const ProfileQueryEditor = memo(() => { - handleProfileClick()}> + handleProfileClick()} + > {i18n.translate('xpack.searchProfiler.formProfileButtonLabel', { defaultMessage: 'Profile', diff --git a/x-pack/test/accessibility/apps/search_profiler.ts b/x-pack/test/accessibility/apps/search_profiler.ts index c825f5426bf5e7..3500ac4095cb3a 100644 --- a/x-pack/test/accessibility/apps/search_profiler.ts +++ b/x-pack/test/accessibility/apps/search_profiler.ts @@ -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(); }); }); diff --git a/x-pack/test/accessibility/config.ts b/x-pack/test/accessibility/config.ts index 61b9ce128631d5..414151a3ec0eb6 100644 --- a/x-pack/test/accessibility/config.ts +++ b/x-pack/test/accessibility/config.ts @@ -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,