diff --git a/internal/cmd/agents.go b/internal/cmd/agents.go index 18819c4..8dfce9a 100644 --- a/internal/cmd/agents.go +++ b/internal/cmd/agents.go @@ -80,7 +80,7 @@ func clearCurrentAgentIfMatches(expectedID string) error { func RequireAgentID() error { resolvedID := GetCurrentAgentID() if resolvedID == "" { - return errors.New("agent ID required: use --id flag, set NOTTE_AGENT_ID env var, or start an agent first") + return errors.New("agent ID required: use --agent-id flag, set NOTTE_AGENT_ID env var, or start an agent first") } agentID = resolvedID return nil @@ -142,16 +142,16 @@ func init() { _ = agentsStartCmd.MarkFlagRequired("task") // Status command flags - agentsStatusCmd.Flags().StringVar(&agentID, "id", "", "Agent ID (uses current agent if not specified)") + agentsStatusCmd.Flags().StringVar(&agentID, "agent-id", "", "Agent ID (uses current agent if not specified)") // Stop command flags - agentsStopCmd.Flags().StringVar(&agentID, "id", "", "Agent ID (uses current agent if not specified)") + agentsStopCmd.Flags().StringVar(&agentID, "agent-id", "", "Agent ID (uses current agent if not specified)") // Workflow-code command flags - agentsWorkflowCodeCmd.Flags().StringVar(&agentID, "id", "", "Agent ID (uses current agent if not specified)") + agentsWorkflowCodeCmd.Flags().StringVar(&agentID, "agent-id", "", "Agent ID (uses current agent if not specified)") // Replay command flags - agentsReplayCmd.Flags().StringVar(&agentID, "id", "", "Agent ID (uses current agent if not specified)") + agentsReplayCmd.Flags().StringVar(&agentID, "agent-id", "", "Agent ID (uses current agent if not specified)") } func runAgentsList(cmd *cobra.Command, args []string) error { diff --git a/internal/cmd/files.go b/internal/cmd/files.go index a9db763..932fe1e 100644 --- a/internal/cmd/files.go +++ b/internal/cmd/files.go @@ -58,10 +58,10 @@ func init() { // List command flags filesListCmd.Flags().BoolVar(&filesListUploadsFlag, "uploads", true, "List uploaded files") filesListCmd.Flags().BoolVar(&filesListDownloadsFlag, "downloads", false, "List downloaded files from a session") - filesListCmd.Flags().StringVar(&sessionID, "id", "", "Session ID (uses current session if not specified)") + filesListCmd.Flags().StringVar(&sessionID, "session-id", "", "Session ID (uses current session if not specified)") // Download command flags - filesDownloadCmd.Flags().StringVar(&sessionID, "id", "", "Session ID (uses current session if not specified)") + filesDownloadCmd.Flags().StringVar(&sessionID, "session-id", "", "Session ID (uses current session if not specified)") filesDownloadCmd.Flags().StringVarP(&filesDownloadOutput, "output", "o", "", "Output file path (defaults to current directory)") } diff --git a/internal/cmd/flags_test.go b/internal/cmd/flags_test.go new file mode 100644 index 0000000..63822ba --- /dev/null +++ b/internal/cmd/flags_test.go @@ -0,0 +1,108 @@ +package cmd + +import ( + "testing" + + "github.com/spf13/pflag" +) + +// TestNoGenericIDFlags ensures no command uses a generic "--id" flag. +// All ID flags should be resource-specific (e.g., --session-id, --function-id). +func TestNoGenericIDFlags(t *testing.T) { + var violations []string + + // Recursive function to check all commands + checkCommand := func(path string, flags *pflag.FlagSet, flagType string) { + flags.VisitAll(func(f *pflag.Flag) { + if f.Name == "id" { + violations = append(violations, path+" has "+flagType+" --id flag (should be resource-specific)") + } + }) + } + + // Check pageCmd and subcommands + checkCommand("notte page", pageCmd.PersistentFlags(), "persistent") + checkCommand("notte page", pageCmd.Flags(), "local") + for _, sub := range pageCmd.Commands() { + cmdPath := "notte page " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check filesCmd and subcommands + checkCommand("notte files", filesCmd.PersistentFlags(), "persistent") + checkCommand("notte files", filesCmd.Flags(), "local") + for _, sub := range filesCmd.Commands() { + cmdPath := "notte files " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check functionsCmd and subcommands + checkCommand("notte functions", functionsCmd.PersistentFlags(), "persistent") + checkCommand("notte functions", functionsCmd.Flags(), "local") + for _, sub := range functionsCmd.Commands() { + cmdPath := "notte functions " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check vaultsCmd and subcommands + checkCommand("notte vaults", vaultsCmd.PersistentFlags(), "persistent") + checkCommand("notte vaults", vaultsCmd.Flags(), "local") + for _, sub := range vaultsCmd.Commands() { + cmdPath := "notte vaults " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + // Check nested subcommands (e.g., vaults credentials) + for _, nested := range sub.Commands() { + nestedPath := cmdPath + " " + nested.Name() + checkCommand(nestedPath, nested.Flags(), "local") + checkCommand(nestedPath, nested.PersistentFlags(), "persistent") + } + } + + // Check profilesCmd and subcommands + checkCommand("notte profiles", profilesCmd.PersistentFlags(), "persistent") + checkCommand("notte profiles", profilesCmd.Flags(), "local") + for _, sub := range profilesCmd.Commands() { + cmdPath := "notte profiles " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check personasCmd and subcommands + checkCommand("notte personas", personasCmd.PersistentFlags(), "persistent") + checkCommand("notte personas", personasCmd.Flags(), "local") + for _, sub := range personasCmd.Commands() { + cmdPath := "notte personas " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check agentsCmd and subcommands + checkCommand("notte agents", agentsCmd.PersistentFlags(), "persistent") + checkCommand("notte agents", agentsCmd.Flags(), "local") + for _, sub := range agentsCmd.Commands() { + cmdPath := "notte agents " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + // Check sessionsCmd and subcommands + checkCommand("notte sessions", sessionsCmd.PersistentFlags(), "persistent") + checkCommand("notte sessions", sessionsCmd.Flags(), "local") + for _, sub := range sessionsCmd.Commands() { + cmdPath := "notte sessions " + sub.Name() + checkCommand(cmdPath, sub.Flags(), "local") + checkCommand(cmdPath, sub.PersistentFlags(), "persistent") + } + + if len(violations) > 0 { + t.Errorf("Found %d command(s) with generic --id flag:\n", len(violations)) + for _, v := range violations { + t.Errorf(" - %s", v) + } + t.Error("All ID flags should be resource-specific (e.g., --session-id, --function-id, --vault-id)") + } +} diff --git a/internal/cmd/functions.go b/internal/cmd/functions.go index fada071..9dcb3ed 100644 --- a/internal/cmd/functions.go +++ b/internal/cmd/functions.go @@ -37,7 +37,7 @@ var ( // GetCurrentFunctionID returns the function ID from flag, env var, or file (in priority order) func GetCurrentFunctionID() string { - // 1. Check --id flag (already in functionID variable if set) + // 1. Check --function-id flag (already in functionID variable if set) if functionID != "" { return functionID } @@ -89,7 +89,7 @@ func clearCurrentFunction() error { func RequireFunctionID() error { functionID = GetCurrentFunctionID() if functionID == "" { - return errors.New("function ID required: use --id flag, set NOTTE_FUNCTION_ID env var, or create a function first") + return errors.New("function ID required: use --function-id flag, set NOTTE_FUNCTION_ID env var, or create a function first") } return nil } @@ -173,13 +173,13 @@ var functionsRunMetadataUpdateCmd = &cobra.Command{ Short: "Update function run metadata", Args: cobra.NoArgs, Example: ` # Direct JSON - notte functions run-metadata-update --id --run-id --data '{"key": "value"}' + notte functions run-metadata-update --function-id --run-id --data '{"key": "value"}' # From file - notte functions run-metadata-update --id --run-id --data @metadata.json + notte functions run-metadata-update --function-id --run-id --data @metadata.json # From stdin - echo '{"key": "value"}' | notte functions run-metadata-update --id --run-id `, + echo '{"key": "value"}' | notte functions run-metadata-update --function-id --run-id `, RunE: runFunctionRunMetadataUpdate, Hidden: true, } @@ -222,50 +222,50 @@ func init() { functionsCreateCmd.Flags().BoolVar(&functionsCreateShared, "shared", false, "Make function public") // Show command flags - functionsShowCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsShowCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") // Update command flags - functionsUpdateCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsUpdateCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsUpdateCmd.Flags().StringVar(&functionUpdateFile, "file", "", "Path to updated function file (required)") _ = functionsUpdateCmd.MarkFlagRequired("file") // Delete command flags - functionsDeleteCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsDeleteCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") // Run command flags - functionsRunCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsRunCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsRunCmd.Flags().StringArrayVar(&functionRunVariables, "var", []string{}, "Variable as key=value pair (can be used multiple times)") functionsRunCmd.Flags().StringVar(&functionRunVariablesJSON, "vars", "", "Variables as JSON object string") // Runs command flags - functionsRunsCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsRunsCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") // Fork command flags - functionsForkCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsForkCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") // Run-stop command flags - functionsRunStopCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsRunStopCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsRunStopCmd.Flags().StringVar(&functionRunID, "run-id", "", "Run ID (required)") _ = functionsRunStopCmd.MarkFlagRequired("run-id") // Run-metadata command flags - functionsRunMetadataCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsRunMetadataCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsRunMetadataCmd.Flags().StringVar(&functionRunID, "run-id", "", "Run ID (required)") _ = functionsRunMetadataCmd.MarkFlagRequired("run-id") // Run-metadata-update command flags - functionsRunMetadataUpdateCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsRunMetadataUpdateCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsRunMetadataUpdateCmd.Flags().StringVar(&functionRunID, "run-id", "", "Run ID (required)") _ = functionsRunMetadataUpdateCmd.MarkFlagRequired("run-id") functionsRunMetadataUpdateCmd.Flags().StringVar(&functionMetadataJSON, "data", "", "JSON metadata, @file, or '-' for stdin") // Schedule command flags - functionsScheduleCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsScheduleCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") functionsScheduleCmd.Flags().StringVar(&functionCronExpression, "cron", "", "Cron expression (required)") _ = functionsScheduleCmd.MarkFlagRequired("cron") // Unschedule command flags - functionsUnscheduleCmd.Flags().StringVar(&functionID, "id", "", "Function ID (uses current function if not specified)") + functionsUnscheduleCmd.Flags().StringVar(&functionID, "function-id", "", "Function ID (uses current function if not specified)") } func runFunctionsList(cmd *cobra.Command, args []string) error { diff --git a/internal/cmd/page.go b/internal/cmd/page.go index 26b385b..afa998b 100644 --- a/internal/cmd/page.go +++ b/internal/cmd/page.go @@ -768,8 +768,8 @@ func init() { pageCmd.AddCommand(pageScreenshotCmd) pageCmd.AddCommand(pageEvalJsCmd) - // Add --id flag to parent command (inherited by all subcommands) - pageCmd.PersistentFlags().StringVar(&sessionID, "id", "", "Session ID (uses current session if not specified)") + // Add --session-id flag to parent command (inherited by all subcommands) + pageCmd.PersistentFlags().StringVar(&sessionID, "session-id", "", "Session ID (uses current session if not specified)") // click flags pageClickCmd.Flags().IntVar(&pageClickTimeout, "timeout", 0, "Timeout in milliseconds") diff --git a/internal/cmd/personas.go b/internal/cmd/personas.go index 526f98f..1dbb417 100644 --- a/internal/cmd/personas.go +++ b/internal/cmd/personas.go @@ -69,20 +69,20 @@ func init() { RegisterPersonaCreateFlags(personasCreateCmd) // Show command flags - personasShowCmd.Flags().StringVar(&personaID, "id", "", "Persona ID (required)") - _ = personasShowCmd.MarkFlagRequired("id") + personasShowCmd.Flags().StringVar(&personaID, "persona-id", "", "Persona ID (required)") + _ = personasShowCmd.MarkFlagRequired("persona-id") // Delete command flags - personasDeleteCmd.Flags().StringVar(&personaID, "id", "", "Persona ID (required)") - _ = personasDeleteCmd.MarkFlagRequired("id") + personasDeleteCmd.Flags().StringVar(&personaID, "persona-id", "", "Persona ID (required)") + _ = personasDeleteCmd.MarkFlagRequired("persona-id") // Emails command flags - personasEmailsCmd.Flags().StringVar(&personaID, "id", "", "Persona ID (required)") - _ = personasEmailsCmd.MarkFlagRequired("id") + personasEmailsCmd.Flags().StringVar(&personaID, "persona-id", "", "Persona ID (required)") + _ = personasEmailsCmd.MarkFlagRequired("persona-id") // SMS command flags - personasSmsCmd.Flags().StringVar(&personaID, "id", "", "Persona ID (required)") - _ = personasSmsCmd.MarkFlagRequired("id") + personasSmsCmd.Flags().StringVar(&personaID, "persona-id", "", "Persona ID (required)") + _ = personasSmsCmd.MarkFlagRequired("persona-id") } func runPersonasList(cmd *cobra.Command, args []string) error { diff --git a/internal/cmd/profiles.go b/internal/cmd/profiles.go index 9a184c3..eabe9e0 100644 --- a/internal/cmd/profiles.go +++ b/internal/cmd/profiles.go @@ -53,12 +53,12 @@ func init() { RegisterProfileCreateFlags(profilesCreateCmd) // Show command flags - profilesShowCmd.Flags().StringVar(&profileID, "id", "", "Profile ID (required)") - _ = profilesShowCmd.MarkFlagRequired("id") + profilesShowCmd.Flags().StringVar(&profileID, "profile-id", "", "Profile ID (required)") + _ = profilesShowCmd.MarkFlagRequired("profile-id") // Delete command flags - profilesDeleteCmd.Flags().StringVar(&profileID, "id", "", "Profile ID (required)") - _ = profilesDeleteCmd.MarkFlagRequired("id") + profilesDeleteCmd.Flags().StringVar(&profileID, "profile-id", "", "Profile ID (required)") + _ = profilesDeleteCmd.MarkFlagRequired("profile-id") } func runProfilesList(cmd *cobra.Command, args []string) error { diff --git a/internal/cmd/vaults.go b/internal/cmd/vaults.go index a1a9a81..2457923 100644 --- a/internal/cmd/vaults.go +++ b/internal/cmd/vaults.go @@ -100,19 +100,19 @@ func init() { // Create command flags (auto-generated) RegisterVaultCreateFlags(vaultsCreateCmd) - // Credentials subcommand group - use PersistentFlags for --id - vaultsCredentialsCmd.PersistentFlags().StringVar(&vaultID, "id", "", "Vault ID (required)") - _ = vaultsCredentialsCmd.MarkPersistentFlagRequired("id") + // Credentials subcommand group - use PersistentFlags for --vault-id + vaultsCredentialsCmd.PersistentFlags().StringVar(&vaultID, "vault-id", "", "Vault ID (required)") + _ = vaultsCredentialsCmd.MarkPersistentFlagRequired("vault-id") // Update command flags - vaultsUpdateCmd.Flags().StringVar(&vaultID, "id", "", "Vault ID (required)") - _ = vaultsUpdateCmd.MarkFlagRequired("id") + vaultsUpdateCmd.Flags().StringVar(&vaultID, "vault-id", "", "Vault ID (required)") + _ = vaultsUpdateCmd.MarkFlagRequired("vault-id") vaultsUpdateCmd.Flags().StringVar(&vaultUpdateName, "name", "", "New name for the vault (required)") _ = vaultsUpdateCmd.MarkFlagRequired("name") // Delete command flags - vaultsDeleteCmd.Flags().StringVar(&vaultID, "id", "", "Vault ID (required)") - _ = vaultsDeleteCmd.MarkFlagRequired("id") + vaultsDeleteCmd.Flags().StringVar(&vaultID, "vault-id", "", "Vault ID (required)") + _ = vaultsDeleteCmd.MarkFlagRequired("vault-id") // Credentials add command flags (auto-generated) RegisterVaultCredentialsAddFlags(vaultsCredentialsAddCmd) diff --git a/tests/integration/agents_test.go b/tests/integration/agents_test.go index 6b6ef1e..5845ad3 100644 --- a/tests/integration/agents_test.go +++ b/tests/integration/agents_test.go @@ -56,21 +56,21 @@ func TestAgentsStartWithSession(t *testing.T) { // cleanupSession will stop the session which implicitly stops the agent // Get agent status - result = runCLI(t, "agents", "status", "--id", agentID) + result = runCLI(t, "agents", "status", "--agent-id", agentID) requireSuccess(t, result) t.Log("Agent on session test completed") } func TestAgentsStatusNonexistent(t *testing.T) { // Try to get status of a non-existent agent - result := runCLI(t, "agents", "status", "--id", "nonexistent-agent-id-12345") + result := runCLI(t, "agents", "status", "--agent-id", "nonexistent-agent-id-12345") requireFailure(t, result) t.Log("Correctly failed to get status of non-existent agent") } func TestAgentsStopNonexistent(t *testing.T) { // Try to stop a non-existent agent - result := runCLI(t, "agents", "stop", "--id", "nonexistent-agent-id-12345") + result := runCLI(t, "agents", "stop", "--agent-id", "nonexistent-agent-id-12345") requireFailure(t, result) t.Log("Correctly failed to stop non-existent agent") } diff --git a/tests/integration/errors_test.go b/tests/integration/errors_test.go index 0f055d9..dbf2714 100644 --- a/tests/integration/errors_test.go +++ b/tests/integration/errors_test.go @@ -49,7 +49,7 @@ func TestErrorParsing_NonexistentSession(t *testing.T) { // TestErrorParsing_NonexistentVault tests that vault not found errors show proper messages func TestErrorParsing_NonexistentVault(t *testing.T) { // Try to get credentials from a non-existent vault - result := runCLI(t, "vaults", "credentials", "list", "--id", "nonexistent-vault-id-abc123") + result := runCLI(t, "vaults", "credentials", "list", "--vault-id", "nonexistent-vault-id-abc123") requireFailure(t, result) // Verify we get a proper error (not "failed to read response body") @@ -63,7 +63,7 @@ func TestErrorParsing_NonexistentVault(t *testing.T) { // TestErrorParsing_NonexistentPersona tests that persona not found errors show proper messages func TestErrorParsing_NonexistentPersona(t *testing.T) { // Try to get a non-existent persona - result := runCLI(t, "personas", "show", "--id", "nonexistent-persona-id-def456") + result := runCLI(t, "personas", "show", "--persona-id", "nonexistent-persona-id-def456") requireFailure(t, result) // Verify we get a proper error (not "failed to read response body") @@ -77,7 +77,7 @@ func TestErrorParsing_NonexistentPersona(t *testing.T) { // TestErrorParsing_NonexistentProfile tests that profile not found errors show proper messages func TestErrorParsing_NonexistentProfile(t *testing.T) { // Try to get a non-existent profile - result := runCLI(t, "profiles", "show", "--id", "nonexistent-profile-id-ghi789") + result := runCLI(t, "profiles", "show", "--profile-id", "nonexistent-profile-id-ghi789") requireFailure(t, result) // Verify we get a proper error (not "failed to read response body") @@ -91,7 +91,7 @@ func TestErrorParsing_NonexistentProfile(t *testing.T) { // TestErrorParsing_NonexistentAgent tests that agent not found errors show proper messages func TestErrorParsing_NonexistentAgent(t *testing.T) { // Try to get status of a non-existent agent - result := runCLI(t, "agents", "status", "--id", "nonexistent-agent-id-jkl012") + result := runCLI(t, "agents", "status", "--agent-id", "nonexistent-agent-id-jkl012") requireFailure(t, result) // Verify we get a proper error (not "failed to read response body") diff --git a/tests/integration/functions_test.go b/tests/integration/functions_test.go index 716fc7f..258d82e 100644 --- a/tests/integration/functions_test.go +++ b/tests/integration/functions_test.go @@ -132,7 +132,7 @@ func TestFunctionsLifecycle(t *testing.T) { defer cleanupFunction(t, functionID) // Step 2: Show function details - result = runCLI(t, "functions", "show", "--id", functionID) + result = runCLI(t, "functions", "show", "--function-id", functionID) requireSuccess(t, result) if !containsString(result.Stdout, functionID) { t.Error("Function show did not contain function ID") @@ -148,12 +148,12 @@ func TestFunctionsLifecycle(t *testing.T) { t.Log("Function appears in list") // Step 4: Update function with new code - result = runCLI(t, "functions", "update", "--id", functionID, "--file", tmpFile) + result = runCLI(t, "functions", "update", "--function-id", functionID, "--file", tmpFile) requireSuccess(t, result) t.Log("Successfully updated function") // Step 5: List function runs (should be empty initially) - result = runCLI(t, "functions", "runs", "--id", functionID) + result = runCLI(t, "functions", "runs", "--function-id", functionID) requireSuccess(t, result) t.Log("Function lifecycle test completed successfully") } @@ -161,7 +161,7 @@ func TestFunctionsLifecycle(t *testing.T) { func TestFunctionIDResolution(t *testing.T) { // This test verifies the function ID resolution feature: // 1. Create a function and verify current_function file is created - // 2. Run subsequent commands without --id and verify they use the saved function + // 2. Run subsequent commands without --function-id and verify they use the saved function // 3. Delete the function and verify current_function file is cleared tmpFile := createTempFunctionFile(t) @@ -205,28 +205,28 @@ func TestFunctionIDResolution(t *testing.T) { } t.Log("Verified current_function file was created with correct function ID") - // Step 3: Test show command without --id should use the saved function + // Step 3: Test show command without --function-id should use the saved function result = runCLI(t, "functions", "show") requireSuccess(t, result) if !containsString(result.Stdout, functionID) { - t.Error("Function show without --id did not return the current function") + t.Error("Function show without --function-id did not return the current function") } t.Log("Successfully used current function for 'show' command") - // Step 4: Test runs command without --id should use the saved function + // Step 4: Test runs command without --function-id should use the saved function result = runCLI(t, "functions", "runs") requireSuccess(t, result) t.Log("Successfully used current function for 'runs' command") - // Step 4a: Test run command without --id should use the saved function + // Step 4a: Test run command without --function-id should use the saved function result = runCLI(t, "functions", "run") requireSuccess(t, result) if !containsString(result.Stdout, functionID) { - t.Error("Function run without --id did not use the current function") + t.Error("Function run without --function-id did not use the current function") } t.Log("Successfully used current function for 'run' command") - // Step 5: Test delete command without --id should use the saved function and clear it + // Step 5: Test delete command without --function-id should use the saved function and clear it result = runCLI(t, "functions", "delete") requireSuccess(t, result) deleted = true // Mark as deleted so deferred cleanup is skipped @@ -243,7 +243,7 @@ func TestFunctionIDResolution(t *testing.T) { } func TestFunctionIDResolutionPriority(t *testing.T) { - // Test priority: --id flag > NOTTE_FUNCTION_ID env var > current_function file + // Test priority: --function-id flag > NOTTE_FUNCTION_ID env var > current_function file tmpFile := createTempFunctionFile(t) // Create first function (this sets current_function) @@ -283,13 +283,13 @@ func TestFunctionIDResolutionPriority(t *testing.T) { } t.Log("Verified env var takes priority over current_function file") - // Test 2: --id flag should take priority over env var - result = runCLIWithEnv(t, map[string]string{"NOTTE_FUNCTION_ID": functionID1}, "functions", "show", "--id", functionID2) + // Test 2: --function-id flag should take priority over env var + result = runCLIWithEnv(t, map[string]string{"NOTTE_FUNCTION_ID": functionID1}, "functions", "show", "--function-id", functionID2) requireSuccess(t, result) if !containsString(result.Stdout, functionID2) { - t.Errorf("Expected function2 (%s) when using --id flag, but got different function", functionID2) + t.Errorf("Expected function2 (%s) when using --function-id flag, but got different function", functionID2) } - t.Log("Verified --id flag takes priority over env var") + t.Log("Verified --function-id flag takes priority over env var") } func TestFunctionsUpdate(t *testing.T) { @@ -312,7 +312,7 @@ func TestFunctionsUpdate(t *testing.T) { t.Logf("Created function: %s (version: %s)", functionID, originalVersion) // Update function - result = runCLI(t, "functions", "update", "--id", functionID, "--file", tmpFile) + result = runCLI(t, "functions", "update", "--function-id", functionID, "--file", tmpFile) requireSuccess(t, result) var updateResp struct { @@ -333,14 +333,14 @@ func TestFunctionsUpdate(t *testing.T) { func TestFunctionsShowNonexistent(t *testing.T) { // Try to show a non-existent function - result := runCLI(t, "functions", "show", "--id", "00000000-0000-0000-0000-000000000000") + result := runCLI(t, "functions", "show", "--function-id", "00000000-0000-0000-0000-000000000000") requireFailure(t, result) t.Log("Correctly failed to show non-existent function") } func TestFunctionsDeleteNonexistent(t *testing.T) { // Try to delete a non-existent function - result := runCLI(t, "functions", "delete", "--id", "00000000-0000-0000-0000-000000000000") + result := runCLI(t, "functions", "delete", "--function-id", "00000000-0000-0000-0000-000000000000") requireFailure(t, result) t.Log("Correctly failed to delete non-existent function") } @@ -361,12 +361,12 @@ func TestFunctionsDeleteAlreadyDeleted(t *testing.T) { functionID := createResp.FunctionID // Delete first time - should succeed - result = runCLI(t, "functions", "delete", "--id", functionID) + result = runCLI(t, "functions", "delete", "--function-id", functionID) requireSuccess(t, result) t.Log("First delete succeeded") // Delete second time - should fail - result = runCLI(t, "functions", "delete", "--id", functionID) + result = runCLI(t, "functions", "delete", "--function-id", functionID) requireFailure(t, result) t.Log("Correctly failed on second delete (already deleted)") } @@ -407,7 +407,7 @@ func TestFunctionsFork(t *testing.T) { t.Logf("Created source function: %s", sourceFunctionID) // Fork the function - result = runCLI(t, "functions", "fork", "--id", sourceFunctionID) + result = runCLI(t, "functions", "fork", "--function-id", sourceFunctionID) requireSuccess(t, result) var forkResp struct { @@ -448,12 +448,12 @@ func TestFunctionsScheduleAndUnschedule(t *testing.T) { t.Logf("Created function: %s", functionID) // Schedule the function - result = runCLI(t, "functions", "schedule", "--id", functionID, "--cron", "0 * * * ? *") + result = runCLI(t, "functions", "schedule", "--function-id", functionID, "--cron", "0 * * * ? *") requireSuccess(t, result) t.Log("Successfully scheduled function") // Unschedule the function - result = runCLI(t, "functions", "unschedule", "--id", functionID) + result = runCLI(t, "functions", "unschedule", "--function-id", functionID) requireSuccess(t, result) t.Log("Successfully unscheduled function") } @@ -466,7 +466,7 @@ func TestFunctionsNoIDProvided(t *testing.T) { os.Remove(currentFunctionFile) } - // Clear NOTTE_FUNCTION_ID env var and try to show without --id + // Clear NOTTE_FUNCTION_ID env var and try to show without --function-id result := runCLIWithEnv(t, map[string]string{"NOTTE_FUNCTION_ID": ""}, "functions", "show") requireFailure(t, result) @@ -495,7 +495,7 @@ func TestFunctionRun(t *testing.T) { t.Logf("Created function: %s", functionID) // Run the function - result = runCLI(t, "functions", "run", "--id", functionID) + result = runCLI(t, "functions", "run", "--function-id", functionID) requireSuccess(t, result) // Parse the run response to verify it contains expected fields @@ -526,7 +526,7 @@ func TestFunctionRunWithVariables(t *testing.T) { t.Logf("Created function: %s", functionID) // Test 1: Run with --var flag - result = runCLI(t, "functions", "run", "--id", functionID, "--var", "test=mytest_variable") + result = runCLI(t, "functions", "run", "--function-id", functionID, "--var", "test=mytest_variable") requireSuccess(t, result) var runResp map[string]interface{} @@ -536,7 +536,7 @@ func TestFunctionRunWithVariables(t *testing.T) { t.Logf("Function run response with --var: %+v", runResp) // Test 2: Run with --vars JSON - result = runCLI(t, "functions", "run", "--id", functionID, "--vars", `{"test":"json_variable"}`) + result = runCLI(t, "functions", "run", "--function-id", functionID, "--vars", `{"test":"json_variable"}`) requireSuccess(t, result) if err := json.Unmarshal([]byte(result.Stdout), &runResp); err != nil { @@ -545,7 +545,7 @@ func TestFunctionRunWithVariables(t *testing.T) { t.Logf("Function run response with --vars: %+v", runResp) // Test 3: Run with multiple --var flags - result = runCLI(t, "functions", "run", "--id", functionID, "--var", "test=first", "--var", "another=second") + result = runCLI(t, "functions", "run", "--function-id", functionID, "--var", "test=first", "--var", "another=second") requireSuccess(t, result) if err := json.Unmarshal([]byte(result.Stdout), &runResp); err != nil { @@ -562,7 +562,7 @@ func cleanupFunction(t *testing.T, functionID string) { if functionID == "" { return } - result := runCLI(t, "functions", "delete", "--id", functionID) + result := runCLI(t, "functions", "delete", "--function-id", functionID) if result.ExitCode != 0 { t.Logf("Warning: failed to cleanup function %s: %s", functionID, result.Stderr) } diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index 0911cfc..d29c31a 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -127,7 +127,7 @@ func cleanupAgent(t *testing.T, agentID string) { if agentID == "" { return } - result := runCLI(t, "agents", "stop", "--id", agentID) + result := runCLI(t, "agents", "stop", "--agent-id", agentID) if result.ExitCode != 0 { t.Logf("Warning: failed to cleanup agent %s: %s", agentID, result.Stderr) } @@ -139,7 +139,7 @@ func cleanupVault(t *testing.T, vaultID string) { if vaultID == "" { return } - result := runCLI(t, "vaults", "delete", "--id", vaultID) + result := runCLI(t, "vaults", "delete", "--vault-id", vaultID) if result.ExitCode != 0 { t.Logf("Warning: failed to cleanup vault %s: %s", vaultID, result.Stderr) } @@ -151,7 +151,7 @@ func cleanupPersona(t *testing.T, personaID string) { if personaID == "" { return } - result := runCLI(t, "personas", "delete", "--id", personaID) + result := runCLI(t, "personas", "delete", "--persona-id", personaID) if result.ExitCode != 0 { t.Logf("Warning: failed to cleanup persona %s: %s", personaID, result.Stderr) } @@ -163,7 +163,7 @@ func cleanupProfile(t *testing.T, profileID string) { if profileID == "" { return } - result := runCLI(t, "profiles", "delete", "--id", profileID) + result := runCLI(t, "profiles", "delete", "--profile-id", profileID) if result.ExitCode != 0 { t.Logf("Warning: failed to cleanup profile %s: %s", profileID, result.Stderr) } diff --git a/tests/integration/page_commands_test.go b/tests/integration/page_commands_test.go index 9ad19d5..02ab814 100644 --- a/tests/integration/page_commands_test.go +++ b/tests/integration/page_commands_test.go @@ -33,7 +33,7 @@ func TestPageGoto(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate using page goto - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) if result.Stdout == "" { @@ -48,11 +48,11 @@ func TestPageClick(t *testing.T) { defer cleanupSession(t, sessionID) // First navigate to a page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Click on a link (example.com has an "a" tag with "More information...") - result = runCLIWithTimeout(t, 120*time.Second, "page", "click", "a", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "click", "a", "--session-id", sessionID) requireSuccess(t, result) if result.Stdout == "" { @@ -67,16 +67,16 @@ func TestPageScrollDown(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Scroll down without amount (default) - result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page scroll-down (default)") // Scroll down with specific amount - result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "300", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "300", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page scroll-down with amount") } @@ -87,15 +87,15 @@ func TestPageScrollUp(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Scroll down first - result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "500", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "500", "--session-id", sessionID) requireSuccess(t, result) // Then scroll up - result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-up", "200", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-up", "200", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page scroll-up") } @@ -106,11 +106,11 @@ func TestPageWait(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Wait for 500ms - result = runCLIWithTimeout(t, 120*time.Second, "page", "wait", "500", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "wait", "500", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page wait") } @@ -121,11 +121,11 @@ func TestPagePress(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Press Tab key - result = runCLIWithTimeout(t, 120*time.Second, "page", "press", "Tab", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "press", "Tab", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page press") } @@ -136,11 +136,11 @@ func TestPageReload(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Reload the page - result = runCLIWithTimeout(t, 120*time.Second, "page", "reload", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "reload", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page reload") } @@ -151,20 +151,20 @@ func TestPageBackForward(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to first page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Navigate to second page - result = runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.org", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.org", "--session-id", sessionID) requireSuccess(t, result) // Go back - result = runCLIWithTimeout(t, 120*time.Second, "page", "back", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "back", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page back") // Go forward - result = runCLIWithTimeout(t, 120*time.Second, "page", "forward", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "forward", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page forward") } @@ -175,11 +175,11 @@ func TestPageNewTab(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to initial page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Open new tab - result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page new-tab") } @@ -190,15 +190,15 @@ func TestPageSwitchTab(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to initial page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Open new tab - result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--session-id", sessionID) requireSuccess(t, result) // Switch back to first tab (index 0) - result = runCLIWithTimeout(t, 120*time.Second, "page", "switch-tab", "0", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "switch-tab", "0", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page switch-tab") } @@ -209,15 +209,15 @@ func TestPageCloseTab(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to initial page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Open new tab - result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "new-tab", "https://example.org", "--session-id", sessionID) requireSuccess(t, result) // Close current tab (the new one) - result = runCLIWithTimeout(t, 120*time.Second, "page", "close-tab", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "close-tab", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page close-tab") } @@ -228,11 +228,11 @@ func TestPageScrape(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Scrape with instructions - result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract the page title", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract the page title", "--session-id", sessionID) requireSuccess(t, result) if result.Stdout == "" { @@ -247,11 +247,11 @@ func TestPageScrapeMainOnly(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page first - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) // Scrape with main-only flag - result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract the main content", "--only-main-content", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract the main content", "--only-main-content", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page scrape with only-main-content") } @@ -262,37 +262,37 @@ func TestPageCommandsWorkflow(t *testing.T) { defer cleanupSession(t, sessionID) // Step 1: Navigate to a page - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 1: Navigated to example.com") // Step 2: Wait for page to stabilize - result = runCLIWithTimeout(t, 120*time.Second, "page", "wait", "500", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "wait", "500", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 2: Waited 500ms") // Step 3: Scroll down - result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "200", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scroll-down", "200", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 3: Scrolled down") // Step 4: Scrape content - result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract all text content", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "scrape", "--instructions", "Extract all text content", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 4: Scraped content") // Step 5: Navigate to another page - result = runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.org", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.org", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 5: Navigated to example.org") // Step 6: Go back - result = runCLIWithTimeout(t, 120*time.Second, "page", "back", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "back", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 6: Went back to example.com") // Step 7: Reload - result = runCLIWithTimeout(t, 120*time.Second, "page", "reload", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "reload", "--session-id", sessionID) requireSuccess(t, result) t.Log("Step 7: Reloaded page") @@ -305,18 +305,18 @@ func TestPageFormFill(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with a form (using httpbin for testing) - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // Fill form with JSON data using valid field names from API schema // Valid fields: first_name, last_name, email, phone, etc. formData := `{"first_name":"Test","last_name":"User","email":"test@example.com","phone":"555-1234"}` - result = runCLIWithTimeout(t, 120*time.Second, "page", "form-fill", "--data", formData, "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "form-fill", "--data", formData, "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page form-fill") } -// TestPageUsesCurrentSession tests that page commands use the current session when --id is not specified +// TestPageUsesCurrentSession tests that page commands use the current session when --session-id is not specified func TestPageUsesCurrentSession(t *testing.T) { // Start a session (this sets the current session) result := runCLI(t, "sessions", "start", "--headless") @@ -334,16 +334,16 @@ func TestPageUsesCurrentSession(t *testing.T) { // Wait for session to be ready time.Sleep(2 * time.Second) - // Run page command WITHOUT --id flag (should use current session) + // Run page command WITHOUT --session-id flag (should use current session) result = runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://example.com") requireSuccess(t, result) - t.Log("Successfully used current session without --id flag") + t.Log("Successfully used current session without --session-id flag") } // TestPageCommandErrors tests error handling for page commands func TestPageCommandErrors(t *testing.T) { // Test without a session - result := runCLI(t, "page", "goto", "https://example.com", "--id", "nonexistent-session-id") + result := runCLI(t, "page", "goto", "https://example.com", "--session-id", "nonexistent-session-id") requireFailure(t, result) t.Log("Correctly failed with invalid session ID") } @@ -354,11 +354,11 @@ func TestPageFillCommand(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with an input field - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // Fill an input field using CSS selector - result = runCLIWithTimeout(t, 120*time.Second, "page", "fill", "input[name=custname]", "Test User", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "fill", "input[name=custname]", "Test User", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page fill with selector") } @@ -369,11 +369,11 @@ func TestPageFillWithFlags(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with an input field - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // Fill with --clear flag - result = runCLIWithTimeout(t, 120*time.Second, "page", "fill", "input[name=custname]", "Cleared and filled", "--clear", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "fill", "input[name=custname]", "Cleared and filled", "--clear", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page fill with --clear flag") } @@ -384,11 +384,11 @@ func TestPageSelect(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with a select dropdown - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // Select a dropdown option - result = runCLIWithTimeout(t, 120*time.Second, "page", "select", "select[name=size]", "medium", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "select", "select[name=size]", "medium", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page select") } @@ -399,11 +399,11 @@ func TestPageCheck(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with checkboxes - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // Check a checkbox - result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page check") } @@ -414,15 +414,15 @@ func TestPageCheckUncheck(t *testing.T) { defer cleanupSession(t, sessionID) // Navigate to a page with checkboxes - result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--id", sessionID) + result := runCLIWithTimeout(t, 120*time.Second, "page", "goto", "https://httpbin.org/forms/post", "--session-id", sessionID) requireSuccess(t, result) // First check - result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--value=true", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--value=true", "--session-id", sessionID) requireSuccess(t, result) // Then uncheck - result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--value=false", "--id", sessionID) + result = runCLIWithTimeout(t, 120*time.Second, "page", "check", "input[name=topping][value=bacon]", "--value=false", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully executed page check/uncheck") } diff --git a/tests/integration/personas_test.go b/tests/integration/personas_test.go index 81ad8e8..ddaccfc 100644 --- a/tests/integration/personas_test.go +++ b/tests/integration/personas_test.go @@ -36,7 +36,7 @@ func TestPersonasCreateAndDelete(t *testing.T) { defer cleanupPersona(t, personaID) // Show persona details - result = runCLI(t, "personas", "show", "--id", personaID) + result = runCLI(t, "personas", "show", "--persona-id", personaID) requireSuccess(t, result) if !containsString(result.Stdout, personaID) { t.Error("Persona show did not contain persona ID") @@ -72,7 +72,7 @@ func TestPersonasCreateWithVault(t *testing.T) { defer cleanupPersona(t, personaID) // Show persona details - result = runCLI(t, "personas", "show", "--id", personaID) + result = runCLI(t, "personas", "show", "--persona-id", personaID) requireSuccess(t, result) t.Log("Persona with vault created successfully") } @@ -92,7 +92,7 @@ func TestPersonasEmails(t *testing.T) { defer cleanupPersona(t, personaID) // List emails for the persona - result = runCLI(t, "personas", "emails", "--id", personaID) + result = runCLI(t, "personas", "emails", "--persona-id", personaID) requireSuccess(t, result) t.Log("Successfully listed persona emails") } @@ -112,21 +112,21 @@ func TestPersonasSms(t *testing.T) { defer cleanupPersona(t, personaID) // List SMS messages for the persona - result = runCLI(t, "personas", "sms", "--id", personaID) + result = runCLI(t, "personas", "sms", "--persona-id", personaID) requireSuccess(t, result) t.Log("Successfully listed persona SMS messages") } func TestPersonasShowNonexistent(t *testing.T) { // Try to show a non-existent persona - result := runCLI(t, "personas", "show", "--id", "nonexistent-persona-id-12345") + result := runCLI(t, "personas", "show", "--persona-id", "nonexistent-persona-id-12345") requireFailure(t, result) t.Log("Correctly failed to show non-existent persona") } func TestPersonasDeleteNonexistent(t *testing.T) { // Try to delete a non-existent persona - result := runCLI(t, "personas", "delete", "--id", "nonexistent-persona-id-12345") + result := runCLI(t, "personas", "delete", "--persona-id", "nonexistent-persona-id-12345") requireFailure(t, result) t.Log("Correctly failed to delete non-existent persona") } diff --git a/tests/integration/profiles_test.go b/tests/integration/profiles_test.go index ad8d634..41b586c 100644 --- a/tests/integration/profiles_test.go +++ b/tests/integration/profiles_test.go @@ -36,7 +36,7 @@ func TestProfilesCreateAndDelete(t *testing.T) { defer cleanupProfile(t, profileID) // Show profile details - result = runCLI(t, "profiles", "show", "--id", profileID) + result = runCLI(t, "profiles", "show", "--profile-id", profileID) requireSuccess(t, result) if !containsString(result.Stdout, profileID) { t.Error("Profile show did not contain profile ID") @@ -72,7 +72,7 @@ func TestProfilesCreateWithName(t *testing.T) { defer cleanupProfile(t, profileID) // Show profile to verify name - result = runCLI(t, "profiles", "show", "--id", profileID) + result = runCLI(t, "profiles", "show", "--profile-id", profileID) requireSuccess(t, result) if !containsString(result.Stdout, "test-profile-integration") { t.Log("Profile name might not be in show output, but creation succeeded") @@ -82,14 +82,14 @@ func TestProfilesCreateWithName(t *testing.T) { func TestProfilesShowNonexistent(t *testing.T) { // Try to show a non-existent profile - result := runCLI(t, "profiles", "show", "--id", "nonexistent-profile-id-12345") + result := runCLI(t, "profiles", "show", "--profile-id", "nonexistent-profile-id-12345") requireFailure(t, result) t.Log("Correctly failed to show non-existent profile") } func TestProfilesDeleteNonexistent(t *testing.T) { // Try to delete a non-existent profile - result := runCLI(t, "profiles", "delete", "--id", "nonexistent-profile-id-12345") + result := runCLI(t, "profiles", "delete", "--profile-id", "nonexistent-profile-id-12345") requireFailure(t, result) t.Log("Correctly failed to delete non-existent profile") } diff --git a/tests/integration/storage_test.go b/tests/integration/storage_test.go index 815d777..c9ef57c 100644 --- a/tests/integration/storage_test.go +++ b/tests/integration/storage_test.go @@ -58,7 +58,7 @@ func TestStorageDownloadFromSession(t *testing.T) { time.Sleep(2 * time.Second) // List downloads from session (likely empty) - result = runCLI(t, "files", "list", "--downloads", "--id", sessionID) + result = runCLI(t, "files", "list", "--downloads", "--session-id", sessionID) requireSuccess(t, result) t.Log("Successfully listed session downloads") } @@ -85,7 +85,7 @@ func TestStorageDownloadNonexistent(t *testing.T) { defer cleanupSession(t, sessionID) // Try to download a non-existent file - result = runCLI(t, "files", "download", "nonexistent-file-12345.txt", "--id", sessionID) + result = runCLI(t, "files", "download", "nonexistent-file-12345.txt", "--session-id", sessionID) requireFailure(t, result) t.Log("Correctly failed to download non-existent file") } diff --git a/tests/integration/vaults_test.go b/tests/integration/vaults_test.go index 95506af..f3a7c3a 100644 --- a/tests/integration/vaults_test.go +++ b/tests/integration/vaults_test.go @@ -82,7 +82,7 @@ func TestVaultsCredentialsLifecycle(t *testing.T) { // Add credentials result = runCLI(t, "vaults", "credentials", "add", - "--id", vaultID, + "--vault-id", vaultID, "--url", "https://example.com", "--email", "test@example.com", "--password", "testpassword123", @@ -91,7 +91,7 @@ func TestVaultsCredentialsLifecycle(t *testing.T) { t.Log("Successfully added credentials") // List credentials - result = runCLI(t, "vaults", "credentials", "list", "--id", vaultID) + result = runCLI(t, "vaults", "credentials", "list", "--vault-id", vaultID) requireSuccess(t, result) if !containsString(result.Stdout, "example.com") { t.Log("Credentials URL might be stored differently") @@ -99,12 +99,12 @@ func TestVaultsCredentialsLifecycle(t *testing.T) { t.Log("Successfully listed credentials") // Get credentials for URL - result = runCLI(t, "vaults", "credentials", "get", "--id", vaultID, "--url", "https://example.com") + result = runCLI(t, "vaults", "credentials", "get", "--vault-id", vaultID, "--url", "https://example.com") requireSuccess(t, result) t.Log("Successfully retrieved credentials") // Delete credentials - result = runCLI(t, "vaults", "credentials", "delete", "--id", vaultID, "--url", "https://example.com") + result = runCLI(t, "vaults", "credentials", "delete", "--vault-id", vaultID, "--url", "https://example.com") requireSuccess(t, result) t.Log("Vault credentials lifecycle completed successfully") } @@ -125,7 +125,7 @@ func TestVaultsCredentialsWithUsername(t *testing.T) { // Add credentials with username result = runCLI(t, "vaults", "credentials", "add", - "--id", vaultID, + "--vault-id", vaultID, "--url", "https://test-site.com", "--username", "testuser", "--password", "testpassword456", @@ -134,7 +134,7 @@ func TestVaultsCredentialsWithUsername(t *testing.T) { t.Log("Successfully added credentials with username") // Get credentials - result = runCLI(t, "vaults", "credentials", "get", "--id", vaultID, "--url", "https://test-site.com") + result = runCLI(t, "vaults", "credentials", "get", "--vault-id", vaultID, "--url", "https://test-site.com") requireSuccess(t, result) t.Log("Credentials with username test completed successfully") } @@ -155,7 +155,7 @@ func TestVaultsCredentialsWithMFA(t *testing.T) { // Add credentials with MFA secret result = runCLI(t, "vaults", "credentials", "add", - "--id", vaultID, + "--vault-id", vaultID, "--url", "https://secure-site.com", "--email", "mfa@example.com", "--password", "securepassword", @@ -180,14 +180,14 @@ func TestVaultsUpdate(t *testing.T) { defer cleanupVault(t, vaultID) // Update vault name - result = runCLI(t, "vaults", "update", "--id", vaultID, "--name", "updated-name") + result = runCLI(t, "vaults", "update", "--vault-id", vaultID, "--name", "updated-name") requireSuccess(t, result) t.Log("Successfully updated vault name") } func TestVaultsDeleteNonexistent(t *testing.T) { // Try to delete a non-existent vault - result := runCLI(t, "vaults", "delete", "--id", "nonexistent-vault-id-12345") + result := runCLI(t, "vaults", "delete", "--vault-id", "nonexistent-vault-id-12345") requireFailure(t, result) t.Log("Correctly failed to delete non-existent vault") } @@ -207,7 +207,7 @@ func TestVaultsCredentialsGetNonexistent(t *testing.T) { defer cleanupVault(t, vaultID) // Try to get credentials for a URL that doesn't exist - result = runCLI(t, "vaults", "credentials", "get", "--id", vaultID, "--url", "https://nonexistent-url.com") + result = runCLI(t, "vaults", "credentials", "get", "--vault-id", vaultID, "--url", "https://nonexistent-url.com") requireFailure(t, result) t.Log("Correctly failed to get non-existent credentials") }