Manage test secrets
Keep passwords, API keys, and one-time codes out of recorded traces, .e2e/cache/ files, and generated test code by redacting them into named secret slots at capture time and injecting SP_SECRET_<SLOT> environment variables at runtime.
Redact sensitive fields during capture
When inputCapture is set to "secrets-only", @softprobe/web-record and Softprobe mobile SDKs replace sensitive input values with { kind: "secret", slot } references before exporting softprobe.ui.action spans. Standard form fields keep their typed text so generated tests can replay them directly.
By default, "secrets-only" recognizes password inputs, payment-card fields, one-time-code fields, and inputs whose name, label, or identifier includes token or secret.
To redact additional fields under a specific slot name, pass secretSlots when initializing the SDK:
import { RecordSdk } from "@softprobe/web-record";
RecordSdk.init({
ingestionKey: "spk_REPLACE_WITH_INGESTION_KEY",
serviceName: "my-web",
captureSemanticActions: true,
inputCapture: "secrets-only",
secretSlots: {
'input[name="apiKey"]': "API_KEY",
},
});Mobile SDKs support the same secretSlots option:
@softprobe/react-native. MapstestId,accessibilityId,name, orlabelto a slot name.- Android (
SoftprobeUiActionRecorder). Maps view identifiers orsecretSlotarguments oninstrumentEditTextto a slot name. - iOS (
SoftprobeUiActionRecorder). Maps control identifiers orsecretSlotarguments onrecordFillto a slot name.
See JavaScript and TypeScript SDK reference for full configuration options.
Common secret slot names
Slot names map directly to environment variables using the SP_SECRET_<SLOT> naming convention. Use uppercase letters, digits, and underscores.
| Slot name | Environment variable | Typical input |
|---|---|---|
PASSWORD | SP_SECRET_PASSWORD | Login or signup password |
API_KEY | SP_SECRET_API_KEY | API key or client token input |
OTP | SP_SECRET_OTP | One-time verification code |
TOKEN | SP_SECRET_TOKEN | Personal access token or invite token |
PIN | SP_SECRET_PIN | Numeric PIN code |
ADMIN_PASSWORD | SP_SECRET_ADMIN_PASSWORD | Privileged or admin password |
Inject SP_SECRET_<SLOT> at test runtime
Generated tests read secret values from the environment when they execute, so no plaintext credentials are stored in Git.
Playwright tests
Generated Playwright tests read process.env.SP_SECRET_<SLOT> when filling redacted fields. Export each required slot alongside your Blackbox query credentials:
SOFTPROBE_TOKEN="YOUR_BLACKBOX_TOKEN" \
SOFTPROBE_WORKSPACE_ID="YOUR_WORKSPACE_ID" \
SP_SECRET_PASSWORD="YOUR_TEST_PASSWORD" \
SP_SECRET_API_KEY="YOUR_TEST_API_KEY" \
npx playwright testMaestro flows
Generated Maestro YAML flows reference ${SP_SECRET_<SLOT>} in inputText steps:
- tapOn:
id: "admin_password"
- inputText: ${SP_SECRET_ADMIN_PASSWORD}Pass each variable with --env when running Maestro:
maestro test \
--env SP_SECRET_ADMIN_PASSWORD="YOUR_TEST_PASSWORD" \
.maestro/Natural-language e2e and @softprobe/e2e/mobile
In agent.act tests, pass secrets.get("<SLOT>") in params so @softprobe/e2e substitutes the value at runtime without writing it to .e2e/cache/. Configure the secrets map in e2e.config.ts to read process.env.SP_SECRET_<SLOT>.
Inject secrets in CI
Store test credentials in your CI provider's secret store and pass them as environment variables to the test job:
- name: Run Playwright UI tests
env:
SOFTPROBE_TOKEN: ${{ secrets.SOFTPROBE_TOKEN }}
SOFTPROBE_WORKSPACE_ID: ${{ secrets.SOFTPROBE_WORKSPACE_ID }}
SP_SECRET_PASSWORD: ${{ secrets.SP_SECRET_PASSWORD }}
SP_SECRET_API_KEY: ${{ secrets.SP_SECRET_API_KEY }}
run: npx playwright testLegacy E2E_SECRET_<SLOT> variables
Older e2e.config.ts examples use a requireSecretEnv("SP_SECRET_<SLOT>", "E2E_SECRET_<SLOT>") helper that falls back to E2E_SECRET_<SLOT> when SP_SECRET_<SLOT> is unset. New generated Playwright and Maestro suites use SP_SECRET_<SLOT> directly, so prefer SP_SECRET_<SLOT> for new test suites and CI secrets.