Chroma

Configuration

Configure Chroma for your testing needs

Playwright Configuration

Chroma works with standard Playwright configuration. Here's a recommended setup:

playwright.config.ts
import { defineConfig, devices } from '@playwright/test'

export default defineConfig({
  testDir: './tests',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: 'html',
  use: {
    baseURL: 'http://localhost:3000',
    trace: 'on-first-retry',
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
  webServer: {
    command: 'npm run dev',
    url: 'http://localhost:3000',
    reuseExistingServer: !process.env.CI,
  },
})

Test Timeouts

Wallet interactions can take time. Configure appropriate timeouts:

playwright.config.ts
import { defineConfig } from '@playwright/test'

export default defineConfig({
  timeout: 60000, // 60 seconds per test
  expect: {
    timeout: 10000, // 10 seconds for assertions
  },
})

Multiple Wallets

You can configure tests to use multiple wallets:

import { createWalletTest } from '@avalix/chroma'

const test = createWalletTest({
  wallets: [
    { type: 'polkadot-js' },
    { type: 'talisman' }
  ]
})

test('use multiple wallets', async ({ wallets }) => {
  const polkadotJs = wallets['polkadot-js']
  const talisman = wallets.talisman
  
  // Use different wallets in the same test
})

Next Steps

On this page