Example

inspecter-tests/base.config.ts
import { defineConfig } from 'inspecter/core'

export default defineConfig({
  project: 'airbnb',

  targets: [
    {
      name: 'setup-staging',
      targetType: 'setup',
      use: {
        baseURL: 'https://www.staging.airbnb.com',
        storageState: undefined,
      },
    },
    {
      name: 'staging',
      use: {
        baseURL: 'https://www.staging.airbnb.com',
      },
    },
    {
      name: 'prod',
      grepInvert: '@data-modification',
    },
  ],

  use: {
    baseURL: 'https://www.airbnb.com',
    storageState: './auth/storage-state.json',
    viewport: { width: 1280, height: 720 },
    inputs: {
      username: 'InspectorGadget',
      password: { value: 'Qwerty123', mask: true },
    },
  },

  // Fail test if a step takes longer than 5 seconds
  stepTimeout: 5_000,

  // Fail test if it takes longer than 90 seconds
  testTimeout: 90_000,
})

Config

Options

project
string
required

The name of the app or the team.

targets
Target[]

The target environment to run tests against

use
Use

Configuration for the browser and test runtime.

globalSetup
() => Promise<undefined | () => Promise<void>>

A function that runs before all tests. May return a function that will run after all tests are done.

Use this to set up a database, create a user, etc.

globalTeardown
() => Promise<void>

A function that runs after all tests are done.

grep
string | RegExp

Filter to only run tests with a title matching one of the patterns. For example, passing grep: /cart/ should only run tests with “cart” in the title. Also available in the command line with the -g option. The regular expression will be tested against the string that consists of the target name, path of the test file, title of the test and tags starting with @.

e.g. staging configure-dashboard.yaml "Configure dashboard" @dashboard @data-modification

grepInvert
string | RegExp

Filter to only run tests with a title not matching one of the patterns. This is the opposite of Config.grep. Also available in the command line with the --grep-invert option.

workers
number
default:5

Number of tests to run in parallel.

| gotoWaitUntil | load, domcontentloaded, networkidle,commit. Default is load. Refer to Playwright docs | | stepTimeout | Fail test if step takes longer than defined timeout unless overridden. In case of AI steps it will as much as needed. Default: 5000 milliseconds | | testTimeout | Fail test if it takes longer than defined timeout. Default: 90000 milliseconds |

Target

Use-cases:

  • Run setup before all tests to cache login session and reuse it for all tests.
  • Run tests on multiple environments: staging, canary, prod.
  • Run tests on multiple browsers and different viewports: chrome, firefox, edge.
  • Run subset of tests based on changes in your codebase: dashboard, user-management.

Target-specific options should be put to Config.targets, but top-level Config can also define base options shared between all targets.

name
string
required

Short id of the target

targetType
'test' | 'setup' | 'teardown'
default:"test"

The type of the target.

use
Use
grep
string | RegExp
grepInvert
string | RegExp

Use

baseURL
string

Page will navigate to this URL before the start of the test.

storageState
string

Path to the file with storage state that will be loaded into the browser.

inputs
Record<string, any | { value: any; mask?: boolean }>

Values that you need to pass to the test script.

Set mask: true to remove sensitive data from results of tests.

viewport
Viewport

Screen size of the browser.

browserType
'chromium' | 'firefox' | 'webkit'
default:"chromium"
stepTimeout
number
default:5000

Fail test if a step takes longer than defined timeout unless overridden. If cache of step is not up-to-date, Inspecter will wait this amount of time before calling AI.

navigationTimeout
number
default:10000

Fail test if goto takes longer than defined timeout.

testTimeout
number
default:90000

Fail test if it takes longer than defined timeout.

Other parameters for browser and browser context are available. Read Playwright documentation for more details.