buildConfig static method

Map<String, dynamic> buildConfig()

Implementation

static Map<String, dynamic> 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': {
      '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. Each test runs once per entry with that '
                'platform/model viewport, optional locale (APP_LOCALE), and '
                'optional theme (EnsembleThemeManager Light/Dark). '
                '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},
        },
      },
      'dumpTree': {
        'type': 'object',
        'additionalProperties': false,
        'properties': {
          'enabled': {'type': 'boolean'},
        },
      },
      '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(),
    },
  };
}