From c7adc147298c2dc6274f1ba170453e467f981180 Mon Sep 17 00:00:00 2001 From: Josema Camacho Date: Thu, 6 Aug 2026 11:28:22 +0200 Subject: [PATCH] fix(ui): correct GCP organization credential labels (#12362) --- ...cp-organization-credential-labels.fixed.md | 1 + .../organizations/gcp-org-setup-form.test.tsx | 62 +++++++++++++++++++ .../organizations/gcp-org-setup-form.tsx | 4 +- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 ui/changelog.d/gcp-organization-credential-labels.fixed.md create mode 100644 ui/components/providers/organizations/gcp-org-setup-form.test.tsx diff --git a/ui/changelog.d/gcp-organization-credential-labels.fixed.md b/ui/changelog.d/gcp-organization-credential-labels.fixed.md new file mode 100644 index 0000000000..48617dafbf --- /dev/null +++ b/ui/changelog.d/gcp-organization-credential-labels.fixed.md @@ -0,0 +1 @@ +`Client Secret` and `Refresh Token` labels in the GCP organization authentication form diff --git a/ui/components/providers/organizations/gcp-org-setup-form.test.tsx b/ui/components/providers/organizations/gcp-org-setup-form.test.tsx new file mode 100644 index 0000000000..9a3e056efb --- /dev/null +++ b/ui/components/providers/organizations/gcp-org-setup-form.test.tsx @@ -0,0 +1,62 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { describe, expect, it, vi } from "vitest"; + +import { ORG_SETUP_PHASE } from "@/types/organizations"; + +import { GcpOrgSetupForm } from "./gcp-org-setup-form"; + +vi.mock("@/actions/organizations/organizations", () => ({ + updateOrganizationName: vi.fn(), +})); + +vi.mock("./hooks/use-org-setup-submission", () => ({ + useOrgSetupSubmission: () => ({ + apiError: null, + setApiError: vi.fn(), + submitOrganizationSetup: vi.fn(), + replaceSecretWarning: null, + confirmSecretReplace: vi.fn(), + cancelSecretReplace: vi.fn(), + discoveryTimedOut: false, + discoveryFailed: false, + isSubmissionPending: false, + keepWaitingForDiscovery: vi.fn(), + retryDiscovery: vi.fn(), + }), +})); + +describe("GcpOrgSetupForm", () => { + describe("when static credentials are selected", () => { + it("should preserve the labels of masked credential fields", async () => { + // Given + const user = userEvent.setup(); + render( + , + ); + + // When + await user.click( + screen.getByRole("radio", { + name: /client id, client secret and refresh token/i, + }), + ); + + // Then + expect(screen.getByLabelText("Client Secret")).toHaveAttribute( + "type", + "password", + ); + expect(screen.getByLabelText("Refresh Token")).toHaveAttribute( + "type", + "password", + ); + }); + }); +}); diff --git a/ui/components/providers/organizations/gcp-org-setup-form.tsx b/ui/components/providers/organizations/gcp-org-setup-form.tsx index d3f9f2edc1..c4dd022b45 100644 --- a/ui/components/providers/organizations/gcp-org-setup-form.tsx +++ b/ui/components/providers/organizations/gcp-org-setup-form.tsx @@ -470,7 +470,7 @@ export function GcpOrgSetupForm({ name="clientSecret" label="Client Secret" labelPlacement="outside" - password + type="password" isRequired />