Skip to content

Automate browser based workflows with AI

feat: Browser profile testing & login-free workflow UI - frontend (#SKY-8012) (#4833)

Celal Zamanoğlu576032e11ea6
diff --git a/skyvern-frontend/src/api/types.ts b/skyvern-frontend/src/api/types.ts
index 9d21e2a45..1b5ad35f7 100644
--- a/skyvern-frontend/src/api/types.ts
+++ b/skyvern-frontend/src/api/types.ts
@@ -530,6 +530,8 @@ export type CredentialApiResponse = {
| SecretCredentialResponse;
credential_type: "password" | "credit_card" | "secret";
name: string;
+ browser_profile_id?: string | null;
+ tested_url?: string | null;
};
export function isPasswordCredential(
@@ -634,3 +636,27 @@ export type PylonEmailHash = {
};
export const BROWSER_DOWNLOAD_TIMEOUT_SECONDS = 120 as const;
+
+export type TestLoginResponse = {
+ credential_id: string;
+ workflow_run_id: string;
+ status: string;
+};
+
+export type TestCredentialStatusResponse = {
+ credential_id: string;
+ workflow_run_id: string;
+ status:
+ | "created"
+ | "queued"
+ | "running"
+ | "completed"
+ | "failed"
+ | "timed_out"
+ | "terminated"
+ | "canceled";
+ failure_reason?: string | null;
+ browser_profile_id?: string | null;
+ tested_url?: string | null;
+ browser_profile_failure_reason?: string | null;
+};
diff --git a/skyvern-frontend/src/routes/credentials/CredentialItem.tsx b/skyvern-frontend/src/routes/credentials/CredentialItem.tsx
index 0c204dc74..b7766e197 100644
--- a/skyvern-frontend/src/routes/credentials/CredentialItem.tsx
+++ b/skyvern-frontend/src/routes/credentials/CredentialItem.tsx
@@ -14,6 +14,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { DeleteCredentialButton } from "./DeleteCredentialButton";
+import { getHostname } from "@/util/getHostname";
import { CredentialsModal } from "./CredentialsModal";
import { credentialTypeToModalType } from "./useCredentialModalState";
@@ -109,6 +110,18 @@ function CredentialItem({ credential }: Props) {
{credential.name}
</p>
<p className="text-sm text-slate-400">{credential.credential_id}</p>
+ {credential.browser_profile_id && (
+ <div className="flex items-center gap-1 text-xs">
+ <span className="rounded bg-green-900/40 px-1.5 py-0.5 text-green-400">
+ login-free
+ </span>
+ {credential.tested_url && (
+ <span className="text-muted-foreground">
+ {getHostname(credential.tested_url) ?? credential.tested_url}
+ </span>
+ )}
+ </div>
+ )}
</div>
{credentialDetails}
<div className="ml-auto flex gap-1">
diff --git a/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx b/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx
index a0337abfe..6b1fc5543 100644
--- a/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx
+++ b/skyvern-frontend/src/routes/credentials/CredentialsModal.tsx
@@ -12,7 +12,7 @@ import {
import type { CredentialModalType } from "./useCredentialModalState";
import { PasswordCredentialContent } from "./PasswordCredentialContent";
import { SecretCredentialContent } from "./SecretCredentialContent";
-import { useState, useEffect } from "react";
+import { useState, useEffect, useCallback, useRef } from "react";
import { Button } from "@/components/ui/button";
import { CreditCardCredentialContent } from "./CreditCardCredentialContent";
import { useMutation, useQueryClient } from "@tanstack/react-query";
@@ -22,14 +22,25 @@ import {
isPasswordCredential,
isCreditCardCredential,
isSecretCredential,
+ TestCredentialStatusResponse,
+ TestLoginResponse,
} from "@/api/types";
import { getClient } from "@/api/AxiosClient";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { toast } from "@/components/ui/use-toast";
import { AxiosError } from "axios";
-import { InfoCircledIcon, ReloadIcon } from "@radix-ui/react-icons";
+import {
+ CheckCircledIcon,
+ CrossCircledIcon,
+ InfoCircledIcon,
+ ReloadIcon,
+} from "@radix-ui/react-icons";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { useCredentialsQuery } from "@/routes/workflows/hooks/useCredentialsQuery";
+import { Checkbox } from "@/components/ui/checkbox";
+import { HelpTooltip } from "@/components/HelpTooltip";
+import { Label } from "@/components/ui/label";
+import { getHostname } from "@/util/getHostname";
const PASSWORD_CREDENTIAL_INITIAL_VALUES = {
name: "",
@@ -55,6 +66,20 @@ const SECRET_CREDENTIAL_INITIAL_VALUES = {
secretValue: "",
};
+// Maximum polling duration: 5 minutes
+const MAX_POLL_DURATION_MS = 5 * 60 * 1000;
+
+// Progressive status messages during test — each advances once at a real interval
+const TEST_STATUS_MESSAGES = [
+ "Testing credential login...",
+ "Entering credentials...",
+ "Verifying login...",
+ "This may take a moment...",
+ "Still working...",
+];
+// Delays (ms) before advancing to the next message (last message stays forever)
+const TEST_MESSAGE_DELAYS = [15_000, 30_000, 75_000, 60_000];
+
// Function to generate a unique credential name
function generateDefaultCredentialName(existingNames: string[]): string {
const baseName = "credentials";
@@ -118,9 +143,73 @@ function CredentialsModal({
SECRET_CREDENTIAL_INITIAL_VALUES,
);
+ // Test & Save Browser Profile state
+ const [testAndSave, setTestAndSave] = useState(false);
+ const [testUrl, setTestUrl] = useState("");
+ const [testStatus, setTestStatus] = useState<
+ "idle" | "testing" | "completed" | "failed" | "profile_failed"
+ >("idle");
+ const [testFailureReason, setTestFailureReason] = useState<string | null>(
+ null,
+ );
+ // The temporary credential ID and workflow run ID created by the test-login endpoint
+ const [testCredentialId, setTestCredentialId] = useState<string | null>(null);
+ // testWorkflowRunId is stored only as a ref (not state) because it's never
+ // rendered — it's only needed by cancelTest/close to call the cancel API.
+ // Refs mirror state so cancelTest always has the latest IDs regardless of
+ // React's async render cycle (e.g. cancel during the startTest HTTP call).
+ const testCredentialIdRef = useRef<string | null>(null);
+ const testWorkflowRunIdRef = useRef<string | null>(null);
+ const pollIntervalRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const pollStartTimeRef = useRef<number | null>(null);
+ const pollErrorCountRef = useRef(0);
+ // Guards against in-flight poll responses updating state after cancel/close
+ const pollCancelledRef = useRef(false);
+
+ // Cleanup polling on unmount
+ useEffect(() => {
+ return () => {
+ if (pollIntervalRef.current) {
+ clearTimeout(pollIntervalRef.current);
+ }
+ };
+ }, []);
+
+ // Invalidate a completed test when credential fields change — the saved
+ // temp credential no longer matches the form, so the user must re-test.
+ // Also clean up the orphaned temp credential on the backend.
+ useEffect(() => {
+ if (testStatus === "completed" || testStatus === "profile_failed") {
+ const staleCredId = testCredentialIdRef.current;
+ if (staleCredId) {
+ getClient(credentialGetter)
+ .then((client) => client.delete(`/credentials/${staleCredId}`))
+ .catch(() => {
+ // Best-effort cleanup
+ });
+ }
+ setTestStatus("idle");
+ setTestCredentialId(null);
+ testCredentialIdRef.current = null;
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- only react to login-affecting field changes, not testStatus or name
+ }, [
+ passwordCredentialValues.username,
+ passwordCredentialValues.password,
+ passwordCredentialValues.totp,
+ passwordCredentialValues.totp_type,
+ passwordCredentialValues.totp_identifier,
+ testUrl,
+ ]);
+
+ const nameInitializedRef = useRef(false);
+
// Set default name when modal opens, or pre-populate fields in edit mode
useEffect(() => {
- if (!isOpen) return;
+ if (!isOpen) {
+ nameInitializedRef.current = false;
+ return;
+ }
if (isEditMode) {
reset();
@@ -153,7 +242,8 @@ function CredentialsModal({
return;
}
- if (credentials) {
+ if (credentials && !nameInitializedRef.current) {
+ nameInitializedRef.current = true;
const existingNames = credentials.map((c) => c.name);
const defaultName = generateDefaultCredentialName(existingNames);
@@ -176,26 +266,234 @@ function CredentialsModal({
setPasswordCredentialValues(PASSWORD_CREDENTIAL_INITIAL_VALUES);
setCreditCardCredentialValues(CREDIT_CARD_CREDENTIAL_INITIAL_VALUES);
setSecretCredentialValues(SECRET_CREDENTIAL_INITIAL_VALUES);
+ setTestAndSave(false);
+ setTestUrl("");
+ setTestStatus("idle");
+ setTestFailureReason(null);
+ setTestCredentialId(null);
+ testCredentialIdRef.current = null;
+ testWorkflowRunIdRef.current = null;
+ pollStartTimeRef.current = null;
+ pollErrorCountRef.current = 0;
+ pollCancelledRef.current = false;
+ if (pollIntervalRef.current) {
+ clearTimeout(pollIntervalRef.current);
+ pollIntervalRef.current = null;
+ }
}
+ const pollTestStatus = useCallback(
+ async (credentialId: string, workflowRunId: string) => {
+ // Bail out if test was canceled/closed while this request was in-flight
+ if (pollCancelledRef.current) return;
+
+ // Check if we've exceeded the maximum polling duration
+ if (
+ pollStartTimeRef.current &&
+ Date.now() - pollStartTimeRef.current > MAX_POLL_DURATION_MS
+ ) {
+ pollIntervalRef.current = null;
+ setTestStatus("failed");
+ setTestFailureReason(
+ "The test timed out after 5 minutes. The login may be taking too long or requires manual interaction.",
+ );
+ toast({
+ title: "Credential test timed out",
+ description:
+ "The test did not complete within 5 minutes. Please try again.",
+ variant: "destructive",
+ });
+ // Cancel the backend workflow run so it stops consuming resources
+ getClient(credentialGetter, "sans-api-v1")
+ .then((client) =>
+ client.post(
+ `/credentials/${credentialId}/test/${workflowRunId}/cancel`,
+ ),
+ )
+ .catch(() => {
+ // Best-effort — backend timeout will eventually clean up
+ });
+ return;
+ }
+
+ try {
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ const response = await client.get<TestCredentialStatusResponse>(
+ `/credentials/${credentialId}/test/${workflowRunId}`,
+ );
+ const data = response.data;
+ // Check again after await — cancel may have happened while request was in-flight
+ if (pollCancelledRef.current) return;
+ pollErrorCountRef.current = 0; // Reset on successful poll
+
+ if (data.status === "completed") {
+ pollIntervalRef.current = null;
+ queryClient.invalidateQueries({ queryKey: ["credentials"] });
+
+ // Check if login succeeded but browser profile failed to save
+ if (data.browser_profile_failure_reason && !data.browser_profile_id) {
+ setTestStatus("profile_failed");
+ setTestFailureReason(data.browser_profile_failure_reason);
+ toast({
+ title: "Browser profile was not saved",
+ description: data.browser_profile_failure_reason,
+ variant: "destructive",
+ });
+ return;
+ }
+
+ setTestStatus("completed");
+ const profileHost = data.tested_url
+ ? getHostname(data.tested_url)
+ : null;
+ toast({
+ title: "Credential test passed",
+ description: data.browser_profile_id
+ ? profileHost
+ ? `Login successful! Login-free credentials enabled for ${profileHost}`
+ : "Login successful! Login-free credentials enabled."
+ : "Login successful!",
+ variant: "success",
+ });
+ return;
+ } else if (
+ data.status === "failed" ||
+ data.status === "terminated" ||
+ data.status === "timed_out" ||
+ data.status === "canceled"
+ ) {
+ pollIntervalRef.current = null;
+ setTestStatus("failed");
+ setTestFailureReason(data.failure_reason ?? "Unknown error");
+ const failedHost =
+ (data.tested_url ? getHostname(data.tested_url) : null) ??
+ (testUrl ? getHostname(testUrl) : null) ??
+ testUrl;
+ toast({
+ title: failedHost
+ ? `Unable to establish login-free credentials for ${failedHost}`
+ : "Unable to establish login-free credentials",
+ description:
+ data.failure_reason ?? "The login test did not succeed",
+ variant: "destructive",
+ });
+ return;
+ }
+ // Still running — schedule next poll
+ pollIntervalRef.current = setTimeout(() => {
+ pollTestStatus(credentialId, workflowRunId);
+ }, 3000);
+ } catch {
+ pollErrorCountRef.current++;
+ if (pollErrorCountRef.current >= 10) {
+ pollIntervalRef.current = null;
+ setTestStatus("failed");
+ setTestFailureReason(
+ "Network error — please check your connection and try again.",
+ );
+ toast({
+ title: "Connection lost",
+ description:
+ "Unable to reach the server after multiple attempts. Please check your connection.",
+ variant: "destructive",
+ });
+ return;
+ }
+ // Network error — retry after delay
+ pollIntervalRef.current = setTimeout(() => {
+ pollTestStatus(credentialId, workflowRunId);
+ }, 3000);
+ }
+ },
+ [credentialGetter, queryClient, testUrl],
+ );
+
+ const startTest = useCallback(async () => {
+ try {
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ const response = await client.post<TestLoginResponse>(
+ `/credentials/test-login`,
+ {
+ url: testUrl.trim(),
+ username: passwordCredentialValues.username.trim(),
+ password: passwordCredentialValues.password.trim(),
+ totp: passwordCredentialValues.totp.trim() || null,
+ totp_type: passwordCredentialValues.totp_type,
+ totp_identifier:
+ passwordCredentialValues.totp_identifier.trim() || null,
+ },
+ );
+ const data = response.data;
+ testCredentialIdRef.current = data.credential_id;
+ testWorkflowRunIdRef.current = data.workflow_run_id;
+
+ // If the user canceled while the POST was in-flight, clean up immediately
+ if (pollCancelledRef.current) {
+ getClient(credentialGetter, "sans-api-v1")
+ .then((c) =>
+ c.post(
+ `/credentials/${data.credential_id}/test/${data.workflow_run_id}/cancel`,
+ ),
+ )
+ .catch(() => {});
+ testCredentialIdRef.current = null;
+ testWorkflowRunIdRef.current = null;
+ return;
+ }
+
+ setTestCredentialId(data.credential_id);
+ setTestStatus("testing");
+ pollStartTimeRef.current = Date.now();
+
+ // Start first poll after 3 seconds
+ pollIntervalRef.current = setTimeout(() => {
+ pollTestStatus(data.credential_id, data.workflow_run_id);
+ }, 3000);
+ } catch (error) {
+ setTestStatus("failed");
+ const detail = (
+ (error as AxiosError)?.response?.data as { detail?: string }
+ )?.detail;
+ setTestFailureReason(detail ?? "Failed to start credential test");
+ toast({
+ title: "Failed to start credential test",
+ description: detail ?? "An unexpected error occurred",
+ variant: "destructive",
+ });
+ }
+ }, [credentialGetter, testUrl, passwordCredentialValues, pollTestStatus]);
+
const createCredentialMutation = useMutation({
mutationFn: async (request: CreateCredentialRequest) => {
const client = await getClient(credentialGetter);
const response = await client.post("/credentials", request);
return response.data;
},
- onSuccess: (data) => {
- reset();
- setIsOpen(false);
+ onSuccess: async (data) => {
+ // If the user entered a URL, save it on the credential as metadata
+ const url = testUrl.trim();
+ if (url) {
+ try {
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ await client.patch(`/credentials/${data.credential_id}`, {
+ name: data.name,
+ tested_url: url,
+ });
+ } catch {
+ // Best-effort — credential was created, URL is just metadata
+ }
+ }
queryClient.invalidateQueries({
queryKey: ["credentials"],
});
+ onCredentialCreated?.(data.credential_id);
+ reset();
+ setIsOpen(false);
toast({
title: "Credential created",
description: "Your credential has been created successfully",
variant: "success",
});
- onCredentialCreated?.(data.credential_id);
},
onError: (error: AxiosError) => {
const detail = (error.response?.data as { detail?: string })?.detail;
@@ -238,6 +536,50 @@ function CredentialsModal({
},
});
+ const renameCredentialMutation = useMutation({
+ mutationFn: async ({
+ id,
+ name,
+ tested_url,
+ }: {
+ id: string;
+ name: string;
+ tested_url?: string;
+ }) => {
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ const body: Record<string, string> = { name };
+ if (tested_url) {
+ body.tested_url = tested_url;
+ }
+ const response = await client.patch<CredentialApiResponse>(
+ `/credentials/${id}`,
+ body,
+ );
+ return response.data;
+ },
+ onSuccess: (data) => {
+ queryClient.invalidateQueries({
+ queryKey: ["credentials"],
+ });
+ onCredentialCreated?.(data.credential_id);
+ reset();
+ setIsOpen(false);
+ toast({
+ title: "Credential saved",
+ description: "Your credential has been saved successfully",
+ variant: "success",
+ });
+ },
+ onError: (error: AxiosError) => {
+ const detail = (error.response?.data as { detail?: string })?.detail;
+ toast({
+ title: "Error",
+ description: detail ? detail : error.message,
+ variant: "destructive",
+ });
+ },
+ });
+
const activeMutation = isEditMode
? updateCredentialMutation
: createCredentialMutation;
@@ -272,6 +614,18 @@ function CredentialsModal({
});
return;
}
+
+ // If test passed, rename the temp credential instead of creating a new one
+ if (testAndSave && testStatus === "completed" && testCredentialId) {
+ const url = testUrl.trim();
+ renameCredentialMutation.mutate({
+ id: testCredentialId,
+ name,
+ tested_url: url || undefined,
+ });
+ return;
+ }
+
activeMutation.mutate({
name,
credential_type: "password",
@@ -363,12 +717,106 @@ function CredentialsModal({
}
};
+ const isTestInProgress = testStatus === "testing";
+ const isTestComplete =
+ testStatus === "completed" ||
+ testStatus === "failed" ||
+ testStatus === "profile_failed";
+
+ const [testMessageIndex, setTestMessageIndex] = useState(0);
+ useEffect(() => {
+ if (!isTestInProgress) {
+ setTestMessageIndex(0);
+ return;
+ }
+ // If we're at the last message, stay there
+ if (testMessageIndex >= TEST_STATUS_MESSAGES.length - 1) {
+ return;
+ }
+ const timeout = setTimeout(() => {
+ setTestMessageIndex((i) => i + 1);
+ }, TEST_MESSAGE_DELAYS[testMessageIndex] ?? 60_000);
+ return () => clearTimeout(timeout);
+ }, [isTestInProgress, testMessageIndex]);
+
const credentialContent = (() => {
if (type === CredentialModalTypes.PASSWORD) {
return (
<PasswordCredentialContent
values={passwordCredentialValues}
onChange={setPasswordCredentialValues}
+ url={testUrl}
+ onUrlChange={!isEditMode ? setTestUrl : undefined}
+ urlRequired={testAndSave}
+ urlDisabled={isTestInProgress}
+ afterUrl={
+ !isEditMode ? (
+ <div className="space-y-3">
+ <div className="flex items-center gap-3">
+ <Checkbox
+ id="test-and-save"
+ checked={testAndSave}
+ onCheckedChange={(checked) =>
+ setTestAndSave(checked === true)
+ }
+ disabled={isTestInProgress}
+ />
+ <Label
+ htmlFor="test-and-save"
+ className="cursor-pointer text-sm font-medium"
+ >
+ Dedicated browser profile?
+ </Label>
+ <HelpTooltip content="Skyvern will log in using your credentials, verify success, and save the browser session. Future workflow runs will reuse this session, speeding up login blocks." />
+ </div>
+
+ {isTestInProgress && (
+ <div className="flex items-center gap-2 pl-7 text-sm text-muted-foreground">
+ <ReloadIcon className="size-4 animate-spin" />
+ <span>{TEST_STATUS_MESSAGES[testMessageIndex]}</span>
+ </div>
+ )}
+ {testStatus === "completed" && (
+ <div className="flex items-center gap-2 pl-7 text-sm text-green-400">
+ <CheckCircledIcon className="size-4" />
+ <span>
+ {`Login test passed — login-free credentials available for workflows using ${getHostname(testUrl) ?? testUrl}`}
+ </span>
+ </div>
+ )}
+ {testStatus === "profile_failed" && (
+ <div className="space-y-1 pl-7">
+ <div className="flex items-center gap-2 text-sm text-destructive">
+ <CrossCircledIcon className="size-4" />
+ <span>Browser profile was not saved</span>
+ </div>
+ {testFailureReason && (
+ <p className="text-xs text-destructive/70">
+ {testFailureReason}
+ </p>
+ )}
+ </div>
+ )}
+ {testStatus === "failed" && (
+ <div className="space-y-1 pl-7">
+ <div className="flex items-center gap-2 text-sm text-destructive">
+ <CrossCircledIcon className="size-4" />
+ <span>
+ {testUrl
+ ? `Unable to establish login-free credentials for ${getHostname(testUrl) ?? testUrl}`
+ : "Unable to establish login-free credentials"}
+ </span>
+ </div>
+ {testFailureReason && (
+ <p className="text-xs text-destructive/70">
+ {testFailureReason}
+ </p>
+ )}
+ </div>
+ )}
+ </div>
+ ) : undefined
+ }
/>
);
}
@@ -388,11 +836,119 @@ function CredentialsModal({
);
})();
+ const handleTest = () => {
+ if (testUrl.trim() === "") {
+ toast({
+ title: "Error",
+ description: "Login URL is required to test credentials",
+ variant: "destructive",
+ });
+ return;
+ }
+ if (
+ !testUrl.trim().startsWith("http://") &&
+ !testUrl.trim().startsWith("https://")
+ ) {
+ toast({
+ title: "Error",
+ description: "Login URL must start with http:// or https://",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ const username = passwordCredentialValues.username.trim();
+ const password = passwordCredentialValues.password.trim();
+ if (username === "" || password === "") {
+ toast({
+ title: "Error",
+ description: "Username and password are required to test",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ // Set testing state immediately to avoid button flash
+ pollCancelledRef.current = false;
+ setTestStatus("testing");
+ setTestFailureReason(null);
+ setTestCredentialId(null);
+ startTest();
+ };
+
+ const cancelTest = useCallback(async () => {
+ // Stop polling and prevent in-flight responses from updating state
+ pollCancelledRef.current = true;
+ if (pollIntervalRef.current) {
+ clearTimeout(pollIntervalRef.current);
+ pollIntervalRef.current = null;
+ }
+ setTestStatus("idle");
+ setTestFailureReason(null);
+ pollStartTimeRef.current = null;
+
+ // Use refs for IDs — state may be stale if cancel fires during startTest HTTP call
+ const credId = testCredentialIdRef.current;
+ const wrId = testWorkflowRunIdRef.current;
+ if (credId && wrId) {
+ try {
+ const client = await getClient(credentialGetter, "sans-api-v1");
+ await client.post(`/credentials/${credId}/test/${wrId}/cancel`);
+ } catch {
+ // Best-effort — backend background task will clean up regardless
+ }
+ }
+
+ testCredentialIdRef.current = null;
+ testWorkflowRunIdRef.current = null;
+ setTestCredentialId(null);
+ toast({
+ title: "Test canceled",
+ description: "The credential test has been canceled.",
+ });
+ }, [credentialGetter]);
+
+ // Whether the Test button should be shown
+ const showTestButton = testAndSave && type === CredentialModalTypes.PASSWORD;
+
+ // Whether the Test button should be enabled
+ const canTest =
+ showTestButton &&
+ testUrl.trim() !== "" &&
+ passwordCredentialValues.username.trim() !== "" &&
+ passwordCredentialValues.password.trim() !== "" &&
+ !isTestInProgress;
+
return (
<Dialog
open={isOpen}
onOpenChange={(open) => {
if (!open) {
+ // Prevent in-flight poll responses from updating state after close
+ pollCancelledRef.current = true;
+ // Cancel any in-progress test before closing — use refs for latest IDs
+ const credId = testCredentialIdRef.current;
+ const wrId = testWorkflowRunIdRef.current;
+ if (isTestInProgress && credId && wrId) {
+ getClient(credentialGetter, "sans-api-v1")
+ .then((client) =>
+ client.post(`/credentials/${credId}/test/${wrId}/cancel`),
+ )
+ .catch(() => {
+ // Best-effort cleanup
+ });
+ } else if (credId && !isTestInProgress) {
+ // Test completed but user closed without saving — delete orphaned temp credential
+ getClient(credentialGetter)
+ .then((client) => client.delete(`/credentials/${credId}`))
+ .catch(() => {});
+ }
+ testCredentialIdRef.current = null;
+ testWorkflowRunIdRef.current = null;
+ if (pollIntervalRef.current) {
+ clearTimeout(pollIntervalRef.current);
+ pollIntervalRef.current = null;
+ }
reset();
}
setIsOpen(open);
@@ -414,13 +970,39 @@ function CredentialsModal({
</Alert>
)}
{credentialContent}
+
<DialogFooter>
- <Button onClick={handleSave} disabled={activeMutation.isPending}>
- {activeMutation.isPending ? (
- <ReloadIcon className="mr-2 size-4 animate-spin" />
- ) : null}
- {isEditMode ? "Update" : "Save"}
- </Button>
+ <div className="flex w-full items-center justify-end gap-2">
+ {showTestButton &&
+ (isTestInProgress ? (
+ <Button variant="destructive" onClick={cancelTest}>
+ Cancel Test
+ </Button>
+ ) : (
+ <Button
+ variant="secondary"
+ onClick={handleTest}
+ disabled={!canTest}
+ >
+ {isTestComplete ? "Retest" : "Test"}
+ </Button>
+ ))}
+ <Button
+ onClick={handleSave}
+ disabled={
+ activeMutation.isPending ||
+ renameCredentialMutation.isPending ||
+ isTestInProgress ||
+ (testAndSave && testStatus !== "completed")
+ }
+ >
+ {activeMutation.isPending ||
+ renameCredentialMutation.isPending ? (
+ <ReloadIcon className="mr-2 size-4 animate-spin" />
+ ) : null}
+ {isEditMode ? "Update" : "Save"}
+ </Button>
+ </div>
</DialogFooter>
</DialogContent>
</Dialog>
diff --git a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
index 2f785cbb0..e929af067 100644
--- a/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
+++ b/skyvern-frontend/src/routes/credentials/PasswordCredentialContent.tsx
@@ -35,9 +35,26 @@ type Props = {
totp_type: "authenticator" | "email" | "text" | "none";
totp_identifier: string;
}) => void;
+ /** Login page URL value — when onUrlChange is provided, a URL field is rendered after Name */
+ url?: string;
+ onUrlChange?: (url: string) => void;
+ /** Show a required asterisk on the URL label */
+ urlRequired?: boolean;
+ /** Disable the URL input (e.g. during test) */
+ urlDisabled?: boolean;
+ /** Slot rendered between URL and the separator before Username (e.g. browser profile checkbox) */
+ afterUrl?: React.ReactNode;
};
-function PasswordCredentialContent({ values, onChange }: Props) {
+function PasswordCredentialContent({
+ values,
+ onChange,
+ url,
+ onUrlChange,
+ urlRequired,
+ urlDisabled,
+ afterUrl,
+}: Props) {
const { name, username, password, totp, totp_type, totp_identifier } = values;
const [totpMethod, setTotpMethod] = useState<
"authenticator" | "email" | "text"
@@ -114,18 +131,36 @@ function PasswordCredentialContent({ values, onChange }: Props) {
return (
<div className="space-y-5">
- <div className="flex">
- <div className="w-72 shrink-0 space-y-1">
+ <div className="flex items-center gap-12">
+ <div className="w-40 shrink-0">
<Label>Name</Label>
- <div className="text-sm text-slate-400">
- The name of the credential
- </div>
</div>
<Input
value={name}
onChange={(e) => updateValues({ name: e.target.value })}
/>
</div>
+
+ {onUrlChange !== undefined && (
+ <>
+ <Separator />
+ <div className="flex items-center gap-12">
+ <div className="w-40 shrink-0">
+ <Label>
+ Login Page URL
+ {urlRequired && <span className="text-destructive"> *</span>}
+ </Label>
+ </div>
+ <Input
+ value={url ?? ""}
+ onChange={(e) => onUrlChange(e.target.value)}
+ placeholder="https://example.com/login"
+ disabled={urlDisabled}
+ />
+ </div>
+ </>
+ )}
+ {afterUrl}
<Separator />
<div className="flex items-center gap-12">
<div className="w-40 shrink-0">
diff --git a/skyvern-frontend/src/routes/workflows/components/CredentialSelector.tsx b/skyvern-frontend/src/routes/workflows/components/CredentialSelector.tsx
index 8c9acd394..1fadd1c98 100644
--- a/skyvern-frontend/src/routes/workflows/components/CredentialSelector.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/CredentialSelector.tsx
@@ -10,6 +10,7 @@ import {
import { Skeleton } from "@/components/ui/skeleton";
import { useCredentialsQuery } from "../hooks/useCredentialsQuery";
import { PlusIcon } from "@radix-ui/react-icons";
+import { getHostname } from "@/util/getHostname";
import { CredentialsModal } from "@/routes/credentials/CredentialsModal";
import {
CredentialModalTypes,
@@ -58,9 +59,23 @@ function CredentialSelector({ value, onChange }: Props) {
value={credential.credential_id}
>
<div className="space-y-2">
- <p className="text-sm font-medium">
- <SelectItemText>{credential.name}</SelectItemText>
- </p>
+ <div className="flex items-center gap-2">
+ <p className="text-sm font-medium">
+ <SelectItemText>{credential.name}</SelectItemText>
+ </p>
+ {credential.browser_profile_id && (
+ <>
+ <span className="rounded bg-green-900/40 px-1.5 py-0.5 text-[10px] text-green-400">
+ login-free
+ </span>
+ {credential.tested_url && (
+ <span className="text-[10px] text-muted-foreground">
+ {getHostname(credential.tested_url)}
+ </span>
+ )}
+ </>
+ )}
+ </div>
<p className="text-xs text-slate-400">
{credential.credential_type === "password"
? "Password"
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.tsx
index 9141f3080..ba59e9a0b 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginBlockCredentialSelector.tsx
@@ -12,6 +12,7 @@ import { useContext, useMemo } from "react";
import { useWorkflowParametersStore } from "@/store/WorkflowParametersStore";
import { CredentialsModal } from "@/routes/credentials/CredentialsModal";
import { ExclamationTriangleIcon, PlusIcon } from "@radix-ui/react-icons";
+import { getHostname } from "@/util/getHostname";
import {
CredentialModalTypes,
useCredentialModalState,
@@ -30,6 +31,10 @@ type Props = {
nodeId: string;
value?: string;
onChange?: (value: string) => void;
+ /** Called when a credential with a tested_url is selected to auto-fill the login block URL */
+ onUrlAutoFill?: (url: string) => void;
+ /** Current URL value of the login block — skip auto-fill if already set */
+ currentUrl?: string;
};
// Function to generate a unique credential parameter key
@@ -50,7 +55,13 @@ function generateDefaultCredentialParameterKey(existingKeys: string[]): string {
return `${baseName}_${counter}`;
}
-function LoginBlockCredentialSelector({ nodeId, value, onChange }: Props) {
+function LoginBlockCredentialSelector({
+ nodeId,
+ value,
+ onChange,
+ onUrlAutoFill,
+ currentUrl,
+}: Props) {
const { setIsOpen, setType } = useCredentialModalState();
const nodes = useNodes<AppNode>();
const {
@@ -117,6 +128,8 @@ function LoginBlockCredentialSelector({ nodeId, value, onChange }: Props) {
label: credential.name,
value: credential.credential_id,
type: "credential" as const,
+ hasBrowserProfile: !!credential.browser_profile_id,
+ browserProfileUrl: credential.tested_url ?? null,
}));
// Only show non-Skyvern credential parameters (Bitwarden, 1Password, Azure Vault)
@@ -226,6 +239,16 @@ function LoginBlockCredentialSelector({ nodeId, value, onChange }: Props) {
// with the new value, so selectedCredentialId computes correctly
setWorkflowParameters(newParameters);
onChange?.(parameterKeyToUse);
+
+ // Auto-fill the login block URL from the credential's tested_url
+ // when the URL field is empty.
+ if (
+ selectedCredential &&
+ !currentUrl?.trim() &&
+ selectedCredential.browserProfileUrl
+ ) {
+ onUrlAutoFill?.(selectedCredential.browserProfileUrl);
+ }
}}
>
<SelectTrigger
@@ -247,7 +270,21 @@ function LoginBlockCredentialSelector({ nodeId, value, onChange }: Props) {
<SelectContent>
{options.map((option) => (
<SelectItem key={option.value} value={option.value}>
- {option.label}
+ <div className="flex items-center gap-2">
+ <span>{option.label}</span>
+ {"hasBrowserProfile" in option && option.hasBrowserProfile && (
+ <>
+ <span className="rounded bg-green-900/40 px-1.5 py-0.5 text-[10px] text-green-400">
+ login-free
+ </span>
+ {option.browserProfileUrl && (
+ <span className="text-[10px] text-muted-foreground">
+ {getHostname(option.browserProfileUrl)}
+ </span>
+ )}
+ </>
+ )}
+ </div>
</SelectItem>
))}
<SelectItem value="new">
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
index 5b4292770..8f8ed3800 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/LoginNode/LoginNode.tsx
@@ -156,6 +156,12 @@ function LoginNode({ id, data, type }: NodeProps<LoginNode>) {
}
update({ parameterKeys: [value] });
}}
+ currentUrl={data.url}
+ onUrlAutoFill={(url) => {
+ if (editable) {
+ update({ url });
+ }
+ }}
/>
</div>
</div>
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
index 8bc3529c7..e778f500f 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimelineBlockItem.tsx
@@ -223,6 +223,7 @@ function WorkflowRunTimelineBlockItem({
}, []);
const showStatusIndicator = block.status !== null;
+
const showSuccessIndicator =
showStatusIndicator && block.status === Status.Completed;
const showFailureIndicator =
diff --git a/skyvern-frontend/src/util/getHostname.ts b/skyvern-frontend/src/util/getHostname.ts
new file mode 100644
index 000000000..fe678fda8
--- /dev/null
+++ b/skyvern-frontend/src/util/getHostname.ts
@@ -0,0 +1,11 @@
+/**
+ * Extract the hostname from a URL string.
+ * Returns the hostname on success, or null if the URL is invalid.
+ */
+export function getHostname(url: string): string | null {
+ try {
+ return new URL(url).hostname;
+ } catch {
+ return null;
+ }
+}