Skip to content

Commit

Permalink
Merge branch '7.13' into reporting/mac-browser-7-13
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 17, 2021
2 parents 503d68f + 30b0a8f commit eec4da2
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 74 deletions.
5 changes: 4 additions & 1 deletion test/functional/page_objects/time_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SetupTimeRange>;
}) {
try {
const { start, end } = setup;

Expand Down
7 changes: 6 additions & 1 deletion x-pack/plugins/apm/server/routes/rum_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/server/utils/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions x-pack/plugins/reporting/public/components/report_listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ class ReportListingUi extends Component<Props, State> {
return (
<Fragment>
<EuiBasicTable
tableCaption={i18n.translate('xpack.reporting.listing.table.captionDescription', {
defaultMessage: 'Reports generated in Kibana applications',
})}
itemId="id"
items={this.state.jobs}
loading={this.state.isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
EuiDescribedFormGroup,
EuiCheckbox,
EuiSpacer,
EuiFieldPassword,
} from '@elastic/eui';

import { useHTTPAdvancedFieldsContext } from './contexts';
Expand Down Expand Up @@ -110,7 +111,7 @@ export const HTTPAdvancedFields = memo<Props>(({ validate }) => {
/>
}
>
<EuiFieldText
<EuiFieldPassword
value={fields[ConfigKeys.PASSWORD]}
onChange={(event) =>
handleInputChange({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
EuiComboBox,
EuiComboBoxOptionOption,
EuiFormRow,
EuiFieldText,
EuiTextArea,
EuiFormFieldset,
EuiSelect,
EuiScreenReaderOnly,
EuiSpacer,
EuiFieldPassword,
} from '@elastic/eui';

import { useTLSFieldsContext } from './contexts';
Expand Down Expand Up @@ -333,7 +333,7 @@ export const TLSFields: React.FunctionComponent<{
}
labelAppend={<OptionalLabel />}
>
<EuiFieldText
<EuiFieldPassword
value={fields[ConfigKeys.TLS_KEY_PASSPHRASE].value}
onChange={(event) => {
const value = event.target.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -126,20 +138,22 @@ export const FilterPopover = ({
/>
</EuiPopoverTitle>
{!loading &&
itemsToDisplay.map((item) => (
<EuiFilterSelectItem
aria-label={i18n.translate('xpack.uptime.filterPopover.filterItem.label', {
defaultMessage: 'Filter by {title} {item}.',
values: { item, title },
})}
checked={isItemSelected(tempSelectedItems, item)}
data-test-subj={`filter-popover-item_${item}`}
key={item}
onClick={() => toggleSelectedItems(item, tempSelectedItems, setTempSelectedItems)}
>
{item}
</EuiFilterSelectItem>
))}
itemsToDisplay.map((item) => {
const checked = isItemSelected(tempSelectedItems, item);
return (
<EuiFilterSelectItem
aria-label={
checked ? removeFilterForItemLabel(item, title) : filterByItemLabel(item, title)
}
checked={checked}
data-test-subj={`filter-popover-item_${item}`}
key={item}
onClick={() => toggleSelectedItems(item, tempSelectedItems, setTempSelectedItems)}
>
{item}
</EuiFilterSelectItem>
);
})}
{id === 'location' && items.length === 0 && <LocationLink />}
</EuiPopover>
);
Expand Down
7 changes: 3 additions & 4 deletions x-pack/test/functional/apps/status_page/status_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
Expand Down
57 changes: 32 additions & 25 deletions x-pack/test/functional/apps/uptime/overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down Expand Up @@ -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));
Expand Down
20 changes: 1 addition & 19 deletions x-pack/test/functional/page_objects/status_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
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);
}
}

Expand Down

0 comments on commit eec4da2

Please sign in to comment.