buildConfig static method

Map<String, dynamic> buildConfig()

Implementation

static Map<String, dynamic> buildConfig() {
  return RunnerBenchmark.sync('tools', 'buildConfig', () {
    return {
      '\$schema': schemaVersion,
      '\$id': configSchemaId,
      'title': 'Ensemble declarative test config',
      'description': 'Suite-wide config for app-local tests/config.yaml',
      'type': 'object',
      'additionalProperties': false,
      'properties': {
        'mode': {
          'type': 'string',
          'enum': ['widget', 'integration'],
          'default': 'widget',
          'description': 'Suite execution environment.',
        },
        'services': {
          'type': 'array',
          'items': {
            'type': 'object',
            'additionalProperties': false,
            'required': ['name', 'command'],
            'properties': {
              'name': {'type': 'string'},
              'command': {'type': 'string'},
              'url': {'type': 'string', 'format': 'uri'},
              'arguments': {
                'type': 'array',
                'items': {'type': 'string'},
              },
              'workingDirectory': {'type': 'string'},
              'environment': {
                'type': 'object',
                'additionalProperties': {'type': 'string'},
              },
              'readyUrl': {'type': 'string'},
              'readyTimeoutMs': {'type': 'integer', 'minimum': 1},
            },
          },
        },
        'mocks': {
          ..._mocksPropertySchema(),
          'description':
              'Suite-wide API mocks applied before each test file mocks',
        },
        'initialState': {
          '\$ref': '#/\$defs/initialState',
          'description':
              'Suite-wide storage/secureStorage/keychain/env applied before each test '
                  'initialState. Test values override suite values per key.',
        },
        'profiles': {
          'type': 'object',
          'additionalProperties': false,
          'description':
              'Suite profile configuration. default selects a concrete '
                  'profile or group for tests without a profiles selector.',
          'properties': {
            'default': {'type': 'string', 'minLength': 1},
            'groups': {
              'type': 'object',
              'additionalProperties': {
                'type': 'array',
                'minItems': 1,
                'items': {'type': 'string', 'minLength': 1},
              },
            },
            'definitions': {
              'type': 'object',
              'additionalProperties': {'\$ref': '#/\$defs/profile'},
            },
          },
        },
        'devices': {
          'type': 'array',
          'description':
              'Suite device matrix. Widget mode expands each test once per '
                  'entry with that platform/model viewport, optional locale '
                  '(APP_LOCALE), and optional theme. Integration mode ignores '
                  'viewport/model (real display) and keeps entries whose '
                  'platform matches the connected emulator/simulator so locale '
                  'and theme still apply; other platforms are skipped. '
                  'Each device run writes its own screenshot frames (HTML gallery).',
          'items': {'\$ref': '#/\$defs/testDevice'},
        },
        'screenshots': {
          'type': 'object',
          'additionalProperties': false,
          'properties': {
            'enabled': {'type': 'boolean'},
            'includeSteps': {
              'type': 'array',
              'items': {'type': 'string'},
            },
            'excludeSteps': {
              'type': 'array',
              'items': {'type': 'string'},
            },
          },
        },
        'performance': {
          'type': 'object',
          'additionalProperties': false,
          'properties': {
            'enabled': {'type': 'boolean'},
          },
        },
        'timers': {
          'type': 'object',
          'additionalProperties': false,
          'properties': {
            'enabled': {'type': 'boolean'},
            'maxStartAfterSeconds': {'type': 'integer', 'minimum': 0},
            'maxRepeatIntervalSeconds': {'type': 'integer', 'minimum': 0},
            'maxNumberOfTimes': {
              'type': 'integer',
              'minimum': 0,
              'description':
                  'Cap on YAML timer maxNumberOfTimes. Must outlive mid-test mock waits that rely on later polls.',
            },
            'maxNumberOfTimesByScreen': {
              'type': 'object',
              'description':
                  'Optional maxNumberOfTimes caps keyed by screen YAML filename without .yaml.',
              'additionalProperties': {
                'type': 'integer',
                'minimum': 0,
              },
            },
          },
        },
        'logApiCalls': {
          'type': 'object',
          'additionalProperties': false,
          'description':
              'When enabled, write a per-test API call log attached to each result.',
          'properties': {
            'enabled': {'type': 'boolean'},
          },
        },
        'logStorage': {
          'type': 'object',
          'additionalProperties': false,
          'description':
              'When enabled, write a per-test storage snapshot attached to each result.',
          'properties': {
            'enabled': {'type': 'boolean'},
            'key': {'type': 'string'},
          },
        },
        'wifi': {
          '\$ref': '#/\$defs/wifi',
          'description':
              'Wi-Fi test double settings for connectToWifi / getNetworkInfo under flutter test.',
        },
      },
      '\$defs': {
        'initialState': _initialStateDef(),
        'profile': _profileDef(),
        'testDevice': _testDeviceDef(),
        'wifi': _wifiDef(),
        'mockResponse': _mockResponseDef(),
        'inlineMocks': _inlineMocksDef(),
      },
    };
  });
}