Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/endpoint-isolate-e2e-coverage' i…
Browse files Browse the repository at this point in the history
…nto endpoint-isolate-e2e-coverage
  • Loading branch information
szwarckonrad committed Apr 21, 2023
2 parents 391ed8c + 27101e2 commit db17840
Show file tree
Hide file tree
Showing 134 changed files with 3,830 additions and 938 deletions.
13 changes: 13 additions & 0 deletions test/functional/services/inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@ export class InspectorService extends FtrService {
});
}

public async getTableDataWithId(tableTestSubj: string): Promise<string[][]> {
const chooserDataTestId = 'inspectorTableChooser';
if (!(await this.testSubjects.exists(chooserDataTestId))) {
return [];
}

return await this.retry.try(async () => {
await this.testSubjects.click(chooserDataTestId);
await this.testSubjects.click(tableTestSubj);
return this.getTableData();
});
}

/**
* Returns the selected option value from combobox
*/
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/apm/common/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import {
} from './es_fields/apm';
import { environmentQuery } from './utils/environment_query';

export const kueryBarPlaceholder = i18n.translate(
'xpack.apm.dependencies.kueryBarPlaceholder',
export const unifiedSearchBarPlaceholder = i18n.translate(
'xpack.apm.dependencies.unifiedSearchBarPlaceholder',
{
defaultMessage: `Search dependency metrics (e.g. span.destination.service.resource:elasticsearch)`,
}
);

export const getKueryBarBoolFilter = ({
export const getSearchBarBoolFilter = ({
dependencyName,
environment,
}: {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/common/rules/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const errorCountParamsSchema = schema.object({
threshold: schema.number(),
serviceName: schema.maybe(schema.string()),
environment: schema.string(),
errorGroupingKey: schema.maybe(schema.string()),
});

export const transactionDurationParamsSchema = schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ describe('Storage Explorer', () => {
});
});

it('when clicking the refresh button', () => {
cy.wait(mainAliasNames);
cy.contains('Refresh').click();
cy.wait(mainAliasNames);
});

it('when selecting a different time range and clicking the update button', () => {
cy.wait(mainAliasNames);

Expand All @@ -155,9 +149,6 @@ describe('Storage Explorer', () => {
);
cy.contains('Update').click();
cy.wait(mainAliasNames);

cy.contains('Refresh').click();
cy.wait(mainAliasNames);
});

it('with the correct lifecycle phase when changing the lifecycle phase', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe('APM deep links', () => {
cy.contains('APM / Service groups');
cy.contains('APM / Traces');
cy.contains('APM / Service Map');
cy.contains('APM / Dependencies');
cy.contains('APM / Settings');

// navigates to home page
// Force click because welcome screen changes
Expand All @@ -43,5 +45,15 @@ describe('APM deep links', () => {
// navigates to service maps
cy.contains('APM / Service Map').click({ force: true });
cy.url().should('include', '/apm/service-map');

cy.getByTestSubj('nav-search-input').type('APM');
// navigates to dependencies page
cy.contains('APM / Dependencies').click({ force: true });
cy.url().should('include', '/apm/dependencies/inventory');

cy.getByTestSubj('nav-search-input').type('APM');
// navigates to settings page
cy.contains('APM / Settings').click({ force: true });
cy.url().should('include', '/apm/settings/general-settings');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ describe('Errors page', () => {
cy.contains('div', 'Error 1');
});

it('clicking on type adds a filter in the kuerybar', () => {
it('clicking on type adds a filter in the searchbar', () => {
cy.visitKibana(javaServiceErrorsPageHref);
cy.getByTestSubj('headerFilterKuerybar')
cy.getByTestSubj('apmUnifiedSearchBar')
.invoke('val')
.should('be.empty');
// `force: true` because Cypress says the element is 0x0
cy.contains('exception 0').click({
force: true,
});
cy.getByTestSubj('headerFilterKuerybar')
cy.getByTestSubj('apmUnifiedSearchBar')
.its('length')
.should('be.gt', 0);
cy.get('table')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Service inventory - header filters', () => {
cy.contains('Services');
cy.contains('opbeans-node');
cy.contains('service 1');
cy.getByTestSubj('headerFilterKuerybar')
cy.getByTestSubj('apmUnifiedSearchBar')
.type(`service.name: "${specialServiceName}"`)
.type('{enter}');
cy.contains('service 1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ describe('Service inventory', () => {
});
});

it('when clicking the refresh button', () => {
cy.wait(mainAliasNames);
cy.contains('Refresh').click();
cy.wait(mainAliasNames);
});

it('when selecting a different time range and clicking the update button', () => {
cy.wait(mainAliasNames);

Expand All @@ -118,9 +112,6 @@ describe('Service inventory', () => {
);
cy.contains('Update').click();
cy.wait(mainAliasNames);

cy.contains('Refresh').click();
cy.wait(mainAliasNames);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ describe('Errors table', () => {

it('clicking on type adds a filter in the kuerybar and navigates to errors page', () => {
cy.visitKibana(serviceOverviewHref);
cy.getByTestSubj('headerFilterKuerybar').invoke('val').should('be.empty');
cy.getByTestSubj('apmUnifiedSearchBar').invoke('val').should('be.empty');
// `force: true` because Cypress says the element is 0x0
cy.contains('Exception').click({
force: true,
});
cy.getByTestSubj('headerFilterKuerybar').its('length').should('be.gt', 0);
cy.getByTestSubj('apmUnifiedSearchBar').its('length').should('be.gt', 0);
cy.get('table').find('td:contains("Exception")').should('have.length', 1);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('Service overview - header filters', () => {
});
});

describe('Filtering by kuerybar', () => {
describe('Filtering by searchbar', () => {
beforeEach(() => {
cy.loginAsViewerUser();
});
Expand All @@ -129,13 +129,23 @@ describe('Service overview - header filters', () => {
})
);
cy.contains('opbeans-java');
cy.getByTestSubj('headerFilterKuerybar').type('transaction.n');
cy.getByTestSubj('apmUnifiedSearchBar').type('transaction.n');
cy.contains('transaction.name');
cy.getByTestSubj('suggestionContainer').find('li').first().click();
cy.getByTestSubj('headerFilterKuerybar').type(':');
cy.getByTestSubj('suggestionContainer').find('li').first().click();
cy.getByTestSubj('headerFilterKuerybar').type('{enter}');
cy.url().should('include', '&kuery=transaction.name');
cy.getByTestSubj(
'autocompleteSuggestion-field-transaction.name-'
).click();
cy.getByTestSubj('apmUnifiedSearchBar').type(':');
cy.getByTestSubj('autoCompleteSuggestionText').should('have.length', 1);
cy.getByTestSubj(
Cypress.$.escapeSelector(
'autocompleteSuggestion-value-"GET-/api/product"-'
)
).click();
cy.getByTestSubj('apmUnifiedSearchBar').type('{enter}');
cy.url().should(
'include',
'&kuery=transaction.name%20:%22GET%20%2Fapi%2Fproduct%22%20'
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('Service overview: Time Comparison', () => {
'2021-10-20T00:00:00.000Z'
);

cy.getByTestSubj('superDatePickerApplyTimeButton').click();
cy.getByTestSubj('querySubmitButton').click();

cy.getByTestSubj('comparisonSelect').should('have.value', '864000000ms');
cy.getByTestSubj('comparisonSelect').should(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Span links', () => {
cy.contains('2 Span links');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerInternalOnlyIds.spanAId}`
).realHover();
).trigger('mouseover');
cy.contains('2 Span links found');
cy.contains('2 incoming');
cy.contains('0 outgoing');
Expand All @@ -66,7 +66,7 @@ describe('Span links', () => {
cy.contains('2 Span links');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerExternalOnlyIds.spanBId}`
).realHover();
).trigger('mouseover');
cy.contains('2 Span links found');
cy.contains('1 incoming');
cy.contains('1 outgoing');
Expand All @@ -80,7 +80,7 @@ describe('Span links', () => {
cy.contains('2 Span links');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerConsumerIds.transactionCId}`
).realHover();
).trigger('mouseover');
cy.contains('2 Span links found');
cy.contains('1 incoming');
cy.contains('1 outgoing');
Expand All @@ -94,7 +94,7 @@ describe('Span links', () => {
cy.contains('1 Span link');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerConsumerIds.spanCId}`
).realHover();
).trigger('mouseover');
cy.contains('1 Span link found');
cy.contains('1 incoming');
cy.contains('0 outgoing');
Expand All @@ -108,7 +108,7 @@ describe('Span links', () => {
cy.contains('2 Span links');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerMultipleIds.transactionDId}`
).realHover();
).trigger('mouseover');
cy.contains('2 Span links found');
cy.contains('0 incoming');
cy.contains('2 outgoing');
Expand All @@ -122,7 +122,7 @@ describe('Span links', () => {
cy.contains('2 Span links');
cy.getByTestSubj(
`spanLinksBadge_${ids.producerMultipleIds.spanEId}`
).realHover();
).trigger('mouseover');
cy.contains('2 Span links found');
cy.contains('0 incoming');
cy.contains('2 outgoing');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { createCallApmApi } from '../../../../services/rest/create_call_apm_api'
import { ChartPreview } from '../../ui_components/chart_preview';
import {
EnvironmentField,
ErrorGroupingKeyField,
IsAboveField,
ServiceField,
} from '../../utils/fields';
Expand All @@ -33,6 +34,7 @@ export interface RuleParams {
threshold?: number;
serviceName?: string;
environment?: string;
errorGroupingKey?: string;
}

interface Props {
Expand Down Expand Up @@ -74,6 +76,7 @@ export function ErrorCountRuleType(props: Props) {
query: {
environment: params.environment,
serviceName: params.serviceName,
errorGroupingKey: params.errorGroupingKey,
interval,
start,
end,
Expand All @@ -88,6 +91,7 @@ export function ErrorCountRuleType(props: Props) {
params.windowUnit,
params.environment,
params.serviceName,
params.errorGroupingKey,
]
);

Expand All @@ -98,6 +102,7 @@ export function ErrorCountRuleType(props: Props) {
if (value !== params.serviceName) {
setRuleParams('serviceName', value);
setRuleParams('environment', ENVIRONMENT_ALL.value);
setRuleParams('errorGroupingKey', undefined);
}
}}
/>,
Expand All @@ -106,6 +111,12 @@ export function ErrorCountRuleType(props: Props) {
onChange={(value) => setRuleParams('environment', value)}
serviceName={params.serviceName}
/>,
<ErrorGroupingKeyField
currentValue={params.errorGroupingKey}
onChange={(value) => setRuleParams('errorGroupingKey', value)}
serviceName={params.serviceName}
/>,

<IsAboveField
value={params.threshold}
unit={i18n.translate('xpack.apm.errorCountRuleType.errors', {
Expand Down
40 changes: 40 additions & 0 deletions x-pack/plugins/apm/public/components/alerting/utils/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EuiFieldNumber } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import {
ERROR_GROUP_ID,
SERVICE_ENVIRONMENT,
SERVICE_NAME,
TRANSACTION_TYPE,
Expand Down Expand Up @@ -178,6 +179,45 @@ export function TransactionTypeField({
);
}

export function ErrorGroupingKeyField({
currentValue,
onChange,
serviceName,
}: {
currentValue?: string;
onChange: (value?: string) => void;
serviceName?: string;
}) {
const label = i18n.translate('xpack.apm.alerting.fields.error.group.id', {
defaultMessage: 'Error grouping key',
});
return (
<PopoverExpression value={currentValue || allOptionText} title={label}>
<SuggestionsSelect
customOptions={[{ label: allOptionText, value: undefined }]}
customOptionText={i18n.translate(
'xpack.apm.errorKeySelectCustomOptionText',
{
defaultMessage: 'Add \\{searchValue\\} as a new error grouping key',
}
)}
defaultValue={currentValue}
fieldName={ERROR_GROUP_ID}
onChange={onChange}
placeholder={i18n.translate(
'xpack.apm.errorGroupingKeySelectPlaceholder',
{
defaultMessage: 'Select error grouping key',
}
)}
start={moment().subtract(24, 'h').toISOString()}
end={moment().toISOString()}
serviceName={serviceName}
/>
</PopoverExpression>
);
}

export function IsAboveField({
value,
unit,
Expand Down
Loading

0 comments on commit db17840

Please sign in to comment.