Skip to content

Commit

Permalink
add data-test-subj to rule details page title and add move path defin…
Browse files Browse the repository at this point in the history
…ition
  • Loading branch information
mgiota committed May 19, 2022
1 parent d09f583 commit 8283952
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/observability/public/config/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export const paths = {
observability: {
alerts: '/app/observability/alerts',
ruleDetails: (ruleId: string) => `/app/observability/alerts/rules/${encodeURI(ruleId)}`,
},
management: {
rules: '/app/management/insightsAndAlerting/triggersActions/rules',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { useGetUserCasesPermissions } from '../../../../hooks/use_get_user_cases
import { usePluginContext } from '../../../../hooks/use_plugin_context';
import { LazyAlertsFlyout } from '../../../..';
import { parseAlert } from '../../components/parse_alert';
import { translations } from '../../../../config';
import { translations, paths } from '../../../../config';
import { addDisplayNames } from './add_display_names';
import { ADD_TO_EXISTING_CASE, ADD_TO_NEW_CASE } from './translations';
import { ObservabilityAppServices } from '../../../../application/types';
Expand Down Expand Up @@ -170,10 +170,7 @@ function ObservabilityActions({

const casePermissions = useGetUserCasesPermissions();
const ruleId = alert.fields['kibana.alert.rule.uuid'] ?? null;
const linkToRule = ruleId
? http.basePath.prepend(`/app/observability/alerts/rules/${ruleId}`)
: null;

const linkToRule = ruleId ? http.basePath.prepend(paths.observability.ruleDetails(ruleId)) : null;
const caseAttachments: CaseAttachments = useMemo(() => {
return ecsData?._id
? [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function RuleDetailsPage() {
return (
<ObservabilityPageTemplate
pageHeader={{
pageTitle: <PageTitle rule={rule} />,
pageTitle: <PageTitle data-test-subj="ruleDetailPageTitle" rule={rule} />,
bottomBorder: false,
rightSideItems: hasEditButton
? [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ export default ({ getService }: FtrProviderContext) => {
const actionsButton = await observability.alerts.common.getActionsButtonByIndex(0);
await actionsButton.click();
await observability.alerts.common.viewRuleDetailsButtonClick();
expect(await find.existsByCssSelector('[title="Rules and Connectors"]')).to.eql(true);
expect(await find.existsByCssSelector('[data-test-subj="ruleDetailPageTitle"]')).to.eql(
true
);
});
});

Expand Down

0 comments on commit 8283952

Please sign in to comment.