staging, and stores its URL and sign-in settings. The first environment you create becomes the project default. A command that selects a named environment uses that name within the project.
Manage environments
--url <url>; --local <port> is shorthand for --url http://localhost:<port>. Remote targets must be publicly reachable HTTP(S) URLs. A local address is for a frontend app and may include its entry path. A backend project’s environment must point at a publicly deployed API, so the CLI refuses a local address for one. To change the default, run testsprite project env set-default "$PROJECT_ID" staging. To delete another environment, use project env delete with the name and --confirm. The default must be reassigned before deletion. Testing Local Apps
Sign-in modes
For a frontend environment, set--sign-in at creation. Open the existing environment in the Portal to change its sign-in mode or capture a manual browser session. project env get shows the current settings.
--clear-credentials clears the stored account. Local environments support public and account. For plain-text frontend settings, --var REGION=west on create or update sets a variable. Its value is visible in project env get.
Backend API authentication
A backend environment stores the API base URL, credentials, and headers. A backend test that uses the environment URL picks up this setting. A URL written into the code stays as written.--authacceptsnone,bearer,basic, orapikey. Use a credential file to keep the value out of shell history. Selectingnoneclears the stored credential.--headerand--header-filereplace the set of extra headers sent with every request. Use oneName: valueper line in a file for headers containing secrets.- For a sign-in that refreshes the credential, use
--auto-auth-file ./login.json. The server validates the settings and tries the sign-in.project env getshows whether secrets are set and any sign-in error. Saving advanced settings depends on your workspace plan.
Choose an environment for a run
--env selects the target for a named test or a project run. Saved test lists instead use their stored environment mappings. A planning conversation works on the project’s default environment unless your request names another. When the agent proposes a run, apply --env <name> starts it on a different environment.
Preview targets and temporary environments
A run uses its environment’s address. To test another address, save it as an environment and select it with--env. In a GitHub pull request, ci run --env <name> --target-url <url> runs against the preview in a temporary copy of that environment. A ci run --target-url without --env reuses an environment at the same origin, or creates a temporary environment that takes its sign-in settings from the default. Temporary environments are hidden from the project’s list and are removed after the run. A recorded session, OTP, or login-once setup can require the original origin. CI/CD