8000 Fix tooltips in Security defense tab in admin console by mabartos · Pull Request #53585 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Trans, useTranslation } from "react-i18next";
import { TextControl } from "@keycloak/keycloak-ui-shared";
import { HelpItem, TextControl } from "@keycloak/keycloak-ui-shared";
import { FormattedLink } from "../../components/external-link/FormattedLink";

type HelpLinkTextInputProps = {
Expand All @@ -18,11 +18,18 @@ export const HelpLinkTextInput = ({
name={fieldName}
label={t(name)}
labelIcon={
<Trans
i18nKey={`${name}Help`}
components={{
formattedlink: <FormattedLink href={url} title={t("learnMore")} />,
}}
<HelpItem
Comment thread
mabartos marked this conversation as resolved.
Resolved
fieldLabelId={fieldName}
helpText={
<Trans
i18nKey={`${name}Help`}
components={{
formattedlink: (
<FormattedLink href={url} title={t("learnMore")} />
),
}}
/>
}
/>
}
/>
Expand Down
24 changes: 23 additions & 1 deletion js/apps/admin-ui/test/realm-settings/security-defenses.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from "@playwright/test";
import { expect, test } from "@playwright/test";
import { v4 as uuid } from "uuid";
import adminClient from "../utils/AdminClient.ts";
import { login } from "../utils/login.ts";
Expand Down Expand Up @@ -31,6 +31,28 @@ test.describe.serial("Security defenses", () => {
await goToSecurityDefensesTab(page);
});

test("Header help text is displayed in a popover", async ({ page }) => {
const helpIcon = page.getByTestId(
"help-label-browserSecurityHeaders.xFrameOptions",
);
const helpText = page.getByText(
"Default value prevents pages from being included by non-origin iframes.",
);

await expect(helpIcon).toBeVisible();
await expect(helpText).toBeHidden();
await helpIcon.click();
await expect(helpText).toBeVisible();
const documentationLink = page
.getByRole("dialog")
.getByRole("link", { name: "Learn more" });
await expect(documentationLink).toBeVisible();
await expect(documentationLink).toHaveAttribute(
"href",
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options",
);
});

test("Realm header settings", async ({ page }) => {
await fillXFrameOptionsSecurityHeader(page, "DENY");
await clickSaveSecurityDefenses(page);
Expand Down
Loading
0