On this page
Environment variables
xtest reads no environment variables from you. There is nothing installed on your machine to read them, and every setting lives in the dashboard. Two places still involve one: a recorded test that fills in a password, and your own pipeline holding an API key.
Secrets in a recorded test
When you record a flow, a password is never written into the file. It comes out as process.env.TEST_PASSWORD, and a username that matches a saved credential as process.env.TEST_USERNAME, so the test is safe to commit.
import { test, expect } from '@playwright/test';
test('sign in', async ({ page }) => {
await page.goto('https://your-site.example/login');
await page.getByLabel('Email').fill(process.env.TEST_USERNAME || '');
await page.getByLabel('Password').fill(process.env.TEST_PASSWORD || '');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page).toHaveURL(/dashboard/);
});You supply the values when you run it yourself:
TEST_USERNAME='qa@your-company.example' \
TEST_PASSWORD='…' \
npx playwright testA test that xtest replays for you may only read a variable whose name starts with TEST_, E2E_, QA_ or STAGING_. Any other name is refused rather than read, so a step cannot quietly help itself to a server secret.
The API key in your pipeline
Keep it as a secret in whatever runs your build, and pass it in the header. The name of the variable is yours to choose; XTEST_API_KEY is only a convention.
# Your pipeline names this variable; xtest only cares about the header.
export XTEST_API_KEY="xtest_live_…"
curl -X POST "https://xtest.io/api/v1/suites/$SUITE_ID/runs" \
-H "X-API-Key: $XTEST_API_KEY"Where the rest of it lives
Logins the AI signs in with go in Test logins, and your Anthropic key goes in Setup, Anthropic key. Both are encrypted with AES-256-GCM before they are stored, which is a better place for them than a shell profile.