First, add user credentials to config use.inputs and add a target with setup targetType.

base.config.ts
import { defineConfig } from '@inspecter/cli/core'

export default defineConfig({
  project: 'admin-app',
  targets: [
    {
      name: 'setup',
      targetType: 'setup',
      use: {
        storageState: undefined,
      },
    },
    {
      name: 'tests',
    },
  ],
  use: {
    baseURL: 'https://your-website.com',
    inputs: {
      username: 'email@example.com',
      password: { value: 'Password123', mask: true },
    },
    storageState: './.auth/storage.json',
  },
})

Launch UI app with npx inspecter app and create login test with js step at the end.

await context.storageState({ path: './.auth/storage.json' })

Add setup tag to the script.

Run setup command and check that file ./.auth/storage.json is created.

npx inspecter setup

Now, authentication will run automatically on every npx inspecter run.

To cache auth state run npx inspecter setup every time before launching UI app.