Skip to content

Automate browser based workflows with AI

Make unset authenticator keys directly editable (#8580)

Cindy Li92ad577090db
diff --git a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.test.tsx b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.test.tsx
index 1ecb87719..487d311c3 100644
--- a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.test.tsx
+++ b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.test.tsx
@@ -456,6 +456,73 @@ describe("PasswordCredentialContent — edit-mode hydration (SKY-9864 regression
expect(onEnableEditValues).toHaveBeenCalledOnce();
});
+ it("lets users enter an unset authenticator key without clicking the edit button", async () => {
+ const onChangeSpy = vi.fn();
+ const onEnableEditValues = vi.fn();
+
+ render(
+ <MemoryRouter>
+ <PasswordCredentialContent
+ values={{
+ name: "Example Login",
+ username: "[email protected]",
+ password: "",
+ totp: "",
+ totp_type: "none",
+ totp_identifier: "",
+ }}
+ onChange={onChangeSpy}
+ editMode
+ editingGroups={{ name: false, values: false }}
+ onEnableEditValues={onEnableEditValues}
+ />
+ </MemoryRouter>,
+ );
+
+ fireEvent.click(screen.getByText("Two-Factor Authentication"));
+
+ const authenticatorKeyInput = screen.getByPlaceholderText(
+ "e.g. JBSWY3DPEHPK3PXP",
+ );
+ expect(screen.getByRole("button", { name: "Scan QR" })).toBeTruthy();
+
+ fireEvent.change(authenticatorKeyInput, {
+ target: { value: "JBSWY3DPEHPK3PXP" },
+ });
+
+ expect(onEnableEditValues).toHaveBeenCalledOnce();
+ expect(onChangeSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ totp: "JBSWY3DPEHPK3PXP",
+ totp_type: "authenticator",
+ }),
+ );
+ });
+
+ it("keeps a configured authenticator key masked while credential values are locked", () => {
+ render(
+ <MemoryRouter>
+ <PasswordCredentialContent
+ values={{
+ name: "Example Login",
+ username: "[email protected]",
+ password: "",
+ totp: "",
+ totp_type: "authenticator",
+ totp_identifier: "",
+ }}
+ onChange={vi.fn()}
+ editMode
+ editingGroups={{ name: false, values: false }}
+ onEnableEditValues={vi.fn()}
+ />
+ </MemoryRouter>,
+ );
+
+ expect(screen.getAllByDisplayValue("••••••••")).toHaveLength(2);
+ expect(screen.queryByPlaceholderText("e.g. JBSWY3DPEHPK3PXP")).toBeNull();
+ });
+
it("marks Authenticator App as the selected 2FA method when a new credential opens the 2FA section", async () => {
const onChangeSpy = vi.fn();
diff --git a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
index fa353a80a..90f04d390 100644
--- a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
+++ b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
@@ -1000,7 +1000,7 @@ function PasswordCredentialContent({
<span className="text-destructive"> *</span>
</Label>
</div>
- {valuesReadOnly ? (
+ {valuesReadOnly && totp_type === "authenticator" ? (
<div className="relative w-full">
<Input
value="••••••••"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.test.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.test.tsx
index a22f17b10..30907d35d 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.test.tsx
@@ -218,9 +218,9 @@ describe("StartNode inputs summary", () => {
expect(screen.getByText(/None yet/)).toBeDefined();
});
- test("Inputs sit under the Start heading and above Workflow Settings", () => {
+ test("Inputs sit under the Start heading and above Agent Settings", () => {
// Start is the first thing on the canvas; Inputs read as something Start
- // declares, next to Workflow Settings (SKY-15467).
+ // declares, next to Agent Settings (SKY-15467).
useWorkflowParametersStore.setState({
parameters: [
{
@@ -238,7 +238,7 @@ describe("StartNode inputs summary", () => {
const start = screen.getByText("Start");
const inputs = screen.getByText("Inputs");
expect(precedes(start, inputs)).toBe(true);
- expect(precedes(inputs, screen.getByText("Workflow Settings"))).toBe(true);
+ expect(precedes(inputs, screen.getByText("Agent Settings"))).toBe(true);
});
test("a view-only workflow can read its inputs but not add one", () => {
@@ -298,10 +298,11 @@ describe("StartNode inputs summary", () => {
});
describe("StartNode workflow settings affordance", () => {
- test("renders the Workflow Settings entry collapsed by default", () => {
+ test("renders the Agent Settings entry collapsed by default", () => {
renderStartNode();
- expect(screen.getByText("Workflow Settings")).toBeDefined();
+ expect(screen.getByText("Agent Settings")).toBeDefined();
+ expect(screen.queryByText("Workflow Settings")).toBeNull();
expect(screen.queryByTestId("workflow-settings-editor")).toBeNull();
});
@@ -318,7 +319,7 @@ describe("StartNode workflow settings affordance", () => {
test("the accordion trigger still toggles the settings manually", () => {
renderStartNode();
- const trigger = screen.getByText("Workflow Settings");
+ const trigger = screen.getByText("Agent Settings");
fireEvent.click(trigger);
expect(screen.getByTestId("workflow-settings-editor")).toBeDefined();
@@ -329,7 +330,7 @@ describe("StartNode workflow settings affordance", () => {
test("the open event keeps already-open settings mounted", () => {
renderStartNode();
- fireEvent.click(screen.getByText("Workflow Settings"));
+ fireEvent.click(screen.getByText("Agent Settings"));
expect(screen.getByTestId("workflow-settings-editor")).toBeDefined();
act(() => {
@@ -344,7 +345,7 @@ describe("StartNode workflow settings affordance", () => {
// click that toggled the trigger, before React commits the close; the
// listener must read the still-committed "open" value and stay quiet.
renderStartNode();
- const trigger = screen.getByText("Workflow Settings");
+ const trigger = screen.getByText("Agent Settings");
fireEvent.click(trigger);
expect(screen.getByTestId("workflow-settings-editor")).toBeDefined();
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
index aad06c43e..1bf4e66ee 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
@@ -203,7 +203,7 @@ function StartNode({ id, data, parentId }: NodeProps<StartNode>) {
className="h-4 w-4 text-muted-foreground"
aria-hidden
/>
- Workflow Settings
+ Agent Settings
</span>
</AccordionTrigger>
<AccordionContent className="pl-6 pr-1 pt-1">