From f93489bd636cdf3d772ed81b68bc797de6ef6109 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 14 May 2021 16:05:10 -0400 Subject: [PATCH 1/6] [APM][RUM] adjust data types for uiFilters and range in APM requests (#99257) (#100151) * update has_rum_data api query types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Dominique Clarke --- x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts | 6 +++++- x-pack/plugins/apm/server/routes/rum_client.ts | 7 ++++++- x-pack/plugins/observability/server/utils/queries.ts | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts index 8de2e4e1cca42..87136fc0538a6 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts @@ -14,7 +14,11 @@ import { ProcessorEvent } from '../../../common/processor_event'; import { rangeQuery } from '../../../server/utils/queries'; import { TRANSACTION_PAGE_LOAD } from '../../../common/transaction_types'; -export async function hasRumData({ setup }: { setup: Setup & SetupTimeRange }) { +export async function hasRumData({ + setup, +}: { + setup: Setup & Partial; +}) { try { const { start, end } = setup; diff --git a/x-pack/plugins/apm/server/routes/rum_client.ts b/x-pack/plugins/apm/server/routes/rum_client.ts index c723f2c266ca9..bf58c7fcf39b2 100644 --- a/x-pack/plugins/apm/server/routes/rum_client.ts +++ b/x-pack/plugins/apm/server/routes/rum_client.ts @@ -7,6 +7,7 @@ import * as t from 'io-ts'; import { jsonRt } from '@kbn/io-ts-utils'; +import { isoToEpochRt } from '@kbn/io-ts-utils'; import { LocalUIFilterName } from '../../common/ui_filter'; import { Setup, @@ -264,7 +265,11 @@ const rumJSErrors = createApmServerRoute({ const rumHasDataRoute = createApmServerRoute({ endpoint: 'GET /api/apm/observability_overview/has_rum_data', params: t.partial({ - query: t.intersection([uiFiltersRt, rangeRt]), + query: t.partial({ + uiFilters: t.string, + start: isoToEpochRt, + end: isoToEpochRt, + }), }), options: { tags: ['access:apm'] }, handler: async (resources) => { diff --git a/x-pack/plugins/observability/server/utils/queries.ts b/x-pack/plugins/observability/server/utils/queries.ts index 584719532ddee..9e1c110e77587 100644 --- a/x-pack/plugins/observability/server/utils/queries.ts +++ b/x-pack/plugins/observability/server/utils/queries.ts @@ -8,7 +8,7 @@ import { QueryContainer } from '@elastic/elasticsearch/api/types'; import { esKuery } from '../../../../../src/plugins/data/server'; -export function rangeQuery(start: number, end: number, field = '@timestamp'): QueryContainer[] { +export function rangeQuery(start?: number, end?: number, field = '@timestamp'): QueryContainer[] { return [ { range: { From df8b58002e659d1ec704f44cd270585d0b681451 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 14 May 2021 16:30:03 -0400 Subject: [PATCH 2/6] [Uptime] Fix overview flaky tests (#99781) (#100156) * add retry logic and add describe.only to prepare for flaky test runner Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Dominique Clarke --- test/functional/page_objects/time_picker.ts | 5 +- .../test/functional/apps/uptime/overview.ts | 57 +++++++++++-------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/test/functional/page_objects/time_picker.ts b/test/functional/page_objects/time_picker.ts index e52bb41e14c15..cfe250831e06c 100644 --- a/test/functional/page_objects/time_picker.ts +++ b/test/functional/page_objects/time_picker.ts @@ -26,6 +26,7 @@ export function TimePickerProvider({ getService, getPageObjects }: FtrProviderCo const log = getService('log'); const find = getService('find'); const browser = getService('browser'); + const retry = getService('retry'); const testSubjects = getService('testSubjects'); const { header } = getPageObjects(['header']); const kibanaServer = getService('kibanaServer'); @@ -68,7 +69,9 @@ export function TimePickerProvider({ getService, getPageObjects }: FtrProviderCo } private async getTimePickerPanel() { - return await find.byCssSelector('div.euiPopover__panel-isOpen'); + return await retry.try(async () => { + return await find.byCssSelector('div.euiPopover__panel-isOpen'); + }); } private async waitPanelIsGone(panelElement: WebElementWrapper) { diff --git a/x-pack/test/functional/apps/uptime/overview.ts b/x-pack/test/functional/apps/uptime/overview.ts index eefb516eeb8f7..1e52accfde1a3 100644 --- a/x-pack/test/functional/apps/uptime/overview.ts +++ b/x-pack/test/functional/apps/uptime/overview.ts @@ -26,6 +26,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { beforeEach(async () => { await uptime.goToRoot(); await uptime.setDateRange(DEFAULT_DATE_START, DEFAULT_DATE_END); + await uptime.resetFilters(); }); @@ -59,40 +60,46 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('pagination is cleared when filter criteria changes', async () => { await uptime.changePage('next'); - await uptime.pageHasExpectedIds([ - '0010-down', - '0011-up', - '0012-up', - '0013-up', - '0014-up', - '0015-intermittent', - '0016-up', - '0017-up', - '0018-up', - '0019-up', - ]); + await retry.try(async () => { + await uptime.pageHasExpectedIds([ + '0010-down', + '0011-up', + '0012-up', + '0013-up', + '0014-up', + '0015-intermittent', + '0016-up', + '0017-up', + '0018-up', + '0019-up', + ]); + }); // there should now be pagination data in the URL await uptime.pageUrlContains('pagination'); await uptime.setStatusFilter('up'); - await uptime.pageHasExpectedIds([ - '0000-intermittent', - '0001-up', - '0002-up', - '0003-up', - '0004-up', - '0005-up', - '0006-up', - '0007-up', - '0008-up', - '0009-up', - ]); + await retry.try(async () => { + await uptime.pageHasExpectedIds([ + '0000-intermittent', + '0001-up', + '0002-up', + '0003-up', + '0004-up', + '0005-up', + '0006-up', + '0007-up', + '0008-up', + '0009-up', + ]); + }); // ensure that pagination is removed from the URL await uptime.pageUrlContains('pagination', false); }); it('clears pagination parameters when size changes', async () => { await uptime.changePage('next'); - await uptime.pageUrlContains('pagination'); + await retry.try(async () => { + await uptime.pageUrlContains('pagination'); + }); await uptime.setMonitorListPageSize(50); // the pagination parameter should be cleared after a size change await new Promise((resolve) => setTimeout(resolve, 1000)); From 9fd3b640bef7f76566b4f86e53fffe9f63d5e19e Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 14 May 2021 19:09:38 -0400 Subject: [PATCH 3/6] [Uptime] Improve accessibility labeling for `FilterPopover` component (#99714) (#100172) * Improve accessibility labeling for `FilterPopover` component. * Simplify test revisions. * Simplify unit test. * Refactor test to use text formatter helper functions. Co-authored-by: Justin Kambic --- .../filter_group/filter_popover.test.tsx | 23 +++++++--- .../overview/filter_group/filter_popover.tsx | 42 ++++++++++++------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.test.tsx b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.test.tsx index bccebb21718bf..9094b280fc8ef 100644 --- a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.test.tsx @@ -7,7 +7,12 @@ import React from 'react'; import { fireEvent, waitFor, waitForElementToBeRemoved } from '@testing-library/react'; -import { FilterPopoverProps, FilterPopover } from './filter_popover'; +import { + FilterPopoverProps, + FilterPopover, + removeFilterForItemLabel, + filterByItemLabel, +} from './filter_popover'; import { render } from '../../../lib/helper/rtl_helpers'; describe('FilterPopover component', () => { @@ -77,17 +82,25 @@ describe('FilterPopover component', () => { fireEvent.click(uptimeFilterButton); - const generateLabelText = (item: string) => `Filter by ${props.title} ${item}.`; + selectedPropsItems.forEach((item) => { + expect(getByLabelText(removeFilterForItemLabel(item, props.title))); + }); itemsToClick.forEach((item) => { - const optionButtonLabelText = generateLabelText(item); - const optionButton = getByLabelText(optionButtonLabelText); + let optionButton: HTMLElement; + if (selectedPropsItems.some((i) => i === item)) { + optionButton = getByLabelText(removeFilterForItemLabel(item, props.title)); + } else { + optionButton = getByLabelText(filterByItemLabel(item, props.title)); + } fireEvent.click(optionButton); }); fireEvent.click(uptimeFilterButton); - await waitForElementToBeRemoved(() => queryByLabelText(generateLabelText(itemsToClick[0]))); + await waitForElementToBeRemoved(() => + queryByLabelText(`by ${props.title} ${itemsToClick[0]}`, { exact: false }) + ); expect(props.onFilterFieldChange).toHaveBeenCalledTimes(1); expect(props.onFilterFieldChange).toHaveBeenCalledWith(props.fieldName, expectedSelections); diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx index 23e17802a6835..79d39e6d2dd44 100644 --- a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx +++ b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx @@ -29,6 +29,18 @@ export interface FilterPopoverProps { const isItemSelected = (selectedItems: string[], item: string): 'on' | undefined => selectedItems.find((selected) => selected === item) ? 'on' : undefined; +export const filterByItemLabel = (item: string, title: string) => + i18n.translate('xpack.uptime.filterPopover.filterItem.label', { + defaultMessage: 'Filter by {title} {item}.', + values: { item, title }, + }); + +export const removeFilterForItemLabel = (item: string, title: string) => + i18n.translate('xpack.uptime.filterPopover.removeFilterItem.label', { + defaultMessage: 'Remove filter by {title} {item}.', + values: { item, title }, + }); + export const FilterPopover = ({ fieldName, id, @@ -126,20 +138,22 @@ export const FilterPopover = ({ /> {!loading && - itemsToDisplay.map((item) => ( - toggleSelectedItems(item, tempSelectedItems, setTempSelectedItems)} - > - {item} - - ))} + itemsToDisplay.map((item) => { + const checked = isItemSelected(tempSelectedItems, item); + return ( + toggleSelectedItems(item, tempSelectedItems, setTempSelectedItems)} + > + {item} + + ); + })} {id === 'location' && items.length === 0 && } ); From 7f416a18f500794f9705085cf02f9299dcccc38d Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Sat, 15 May 2021 02:17:53 +0200 Subject: [PATCH 4/6] [status_page test] use navigateToApp (#100146) (#100177) # Conflicts: # .github/CODEOWNERS --- .../apps/status_page/status_page.ts | 7 +++---- .../functional/page_objects/status_page.ts | 20 +------------------ 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/x-pack/test/functional/apps/status_page/status_page.ts b/x-pack/test/functional/apps/status_page/status_page.ts index 55a54245cf832..ecef6225632e9 100644 --- a/x-pack/test/functional/apps/status_page/status_page.ts +++ b/x-pack/test/functional/apps/status_page/status_page.ts @@ -12,17 +12,16 @@ export default function statusPageFunctonalTests({ getPageObjects, }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const PageObjects = getPageObjects(['security', 'statusPage', 'home']); + const PageObjects = getPageObjects(['security', 'statusPage', 'common']); - // FLAKY: https://github.com/elastic/kibana/issues/50448 - describe.skip('Status Page', function () { + describe('Status Page', function () { this.tags(['skipCloud', 'includeFirefox']); before(async () => await esArchiver.load('empty_kibana')); after(async () => await esArchiver.unload('empty_kibana')); it('allows user to navigate without authentication', async () => { await PageObjects.security.forceLogout(); - await PageObjects.statusPage.navigateToPage(); + await PageObjects.common.navigateToApp('status_page', { shouldLoginIfPrompted: false }); await PageObjects.statusPage.expectStatusPage(); }); }); diff --git a/x-pack/test/functional/page_objects/status_page.ts b/x-pack/test/functional/page_objects/status_page.ts index 9edaf4dea53f8..ed90aef954770 100644 --- a/x-pack/test/functional/page_objects/status_page.ts +++ b/x-pack/test/functional/page_objects/status_page.ts @@ -5,36 +5,18 @@ * 2.0. */ -import expect from '@kbn/expect'; import { FtrProviderContext } from '../ftr_provider_context'; export function StatusPagePageProvider({ getService }: FtrProviderContext) { - const retry = getService('retry'); const log = getService('log'); - const browser = getService('browser'); const find = getService('find'); - const deployment = getService('deployment'); - class StatusPage { async initTests() { log.debug('StatusPage:initTests'); } - async navigateToPage() { - return await retry.try(async () => { - const url = deployment.getHostPort() + '/status'; - log.info(`StatusPage:navigateToPage(): ${url}`); - await browser.get(url); - }); - } - async expectStatusPage(): Promise { - return await retry.try(async () => { - log.debug(`expectStatusPage()`); - await find.byCssSelector('[data-test-subj="statusPageRoot"]', 20000); - const url = await browser.getCurrentUrl(); - expect(url).to.contain(`/status`); - }); + await find.byCssSelector('[data-test-subj="statusPageRoot"]', 20000); } } From 21803d5507a7b48b6c7698e05afc4c516b6d7554 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sun, 16 May 2021 20:05:42 -0400 Subject: [PATCH 5/6] [Uptime] [Synthetics Integration] update tls passphrase and http password field to use EuiFieldPassword (#100162) (#100193) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Dominique Clarke --- .../public/components/fleet_package/http_advanced_fields.tsx | 3 ++- .../uptime/public/components/fleet_package/tls_fields.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx index 5cc1dd12ef961..7ab6c81fbf162 100644 --- a/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx +++ b/x-pack/plugins/uptime/public/components/fleet_package/http_advanced_fields.tsx @@ -17,6 +17,7 @@ import { EuiDescribedFormGroup, EuiCheckbox, EuiSpacer, + EuiFieldPassword, } from '@elastic/eui'; import { useHTTPAdvancedFieldsContext } from './contexts'; @@ -110,7 +111,7 @@ export const HTTPAdvancedFields = memo(({ validate }) => { /> } > - handleInputChange({ diff --git a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx index e01d3d59175a4..de8879ec3a819 100644 --- a/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx +++ b/x-pack/plugins/uptime/public/components/fleet_package/tls_fields.tsx @@ -13,12 +13,12 @@ import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow, - EuiFieldText, EuiTextArea, EuiFormFieldset, EuiSelect, EuiScreenReaderOnly, EuiSpacer, + EuiFieldPassword, } from '@elastic/eui'; import { useTLSFieldsContext } from './contexts'; @@ -333,7 +333,7 @@ export const TLSFields: React.FunctionComponent<{ } labelAppend={} > - { const value = event.target.value; From 30b0a8fb578daf58db5b4ce81ada83967619754a Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 17 May 2021 15:40:58 +0200 Subject: [PATCH 6/6] [Reporting] Added appropriate table caption for table listing generated reports (#100118) (#100205) * added appropriate table caption for table listing generated reports * updated jest snapshot Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../components/__snapshots__/report_listing.test.tsx.snap | 1 + x-pack/plugins/reporting/public/components/report_listing.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap b/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap index ddba7842f1199..670d16ec11548 100644 --- a/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap +++ b/x-pack/plugins/reporting/public/components/__snapshots__/report_listing.test.tsx.snap @@ -52,6 +52,7 @@ Array [ "onSelectionChange": [Function], } } + tableCaption="Reports generated in Kibana applications" tableLayout="fixed" >
{ return (