EnsembleTestHarness class

Boots the real Ensemble runtime for widget tests.

Constructors

EnsembleTestHarness({String? appPath, String? appHome, String? i18nPath, Map<String, Function>? externalMethods, ExecutionMode executionMode = ExecutionMode.widget})

Properties

appHome → String?
final
appPath → String?
Optional overrides for a host's local definition target.
final
executionMode → ExecutionMode
final
externalMethods → Map<String, Function>?
final
hashCode → int
The hash code for this object.
no setterinherited
i18nPath → String?
final
runtimeAdapter → EnsembleTestRuntimeAdapter
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

applyViewport(WidgetTester tester, EnsembleTestContext context, {DeviceInfo? screenshotDevice, bool ensureDefaultViewport = true, bool reportLogicalDisplaySize = true}) → Future<void>
Widget tests may emulate a screenshot device. Integration tests keep the real simulator/emulator view so hit-testing and layout stay aligned.
bootstrapRuntime(EnsembleConfig config, EnsembleTestSetup setup, {TestApiProviderOverlay? apiOverlay, bool clearPersistentState = false}) → Future<EnsembleConfig>
buildConfig({Locale? forcedLocale}) → Future<EnsembleConfig>
loadScreen({required WidgetTester tester, required EnsembleTestCase testCase, required EnsembleTestContext context, EnsembleConfig? existingConfig, EnsembleTestConfig suiteConfig = const EnsembleTestConfig(), Future<void> beforeBootstrap()?, Locale? forcedLocale}) → Future<EnsembleConfig>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

appFontsLoaded → bool
no setter
testStoragePathCreatedForTest → bool
Exposes initialization state for the startup-boundary regression test.
no setter

Static Methods

afterTestPluginBootstrap() → void
applyInPlaceSetup(EnsembleTestContext ctx) → Future<void>
assertPhysicalDeviceStorageAcknowledged({required bool deviceIsPhysical, required bool allowMutation, required bool resetStorage}) → void
Pure gate used by requirePhysicalDeviceStorageAcknowledgment and tests.
configureTestIntegrations(Iterable<TestIntegrationRegistration> registrations) → void
deviceInfoMockForTest() → Map<String, Object?>
disposeTestStorage() → void
ensureAppFontsLoaded() → Future<void>
ensureDefaultViewport(WidgetTester tester, EnsembleTestContext context) → Future<void>
ensureIntegrationRuntime() → void
ensurePreSuiteStorageSnapshot() → Future<void>
Captures the pre-suite storage baseline once. When resetDeviceStorage is true, wipes first so the baseline is empty.
ensureTestPlugins() → void
fontAssetCandidatesForTest(String asset) → List<String>
fontFamilyAliasesForTest(String family) → List<String>
initializeRealApiProviders(EnsembleConfig config) → Future<void>
installTestApiOverlay(EnsembleConfig config, TestApiProviderOverlay mock) → void
Wraps real providers with mock for call recording and optional overrides.
normalizeAppPath(String path) → String
openSessionScreen(WidgetTester tester, EnsembleTestCase testCase, {required NavigationFlowRecorder navigationFlow}) → Future<void>
packageInfoForTest(String appDir) → Map<String, String>
recordPhysicalDisplaySize(WidgetTester tester, EnsembleTestContext context) → void
requirePhysicalDeviceStorageAcknowledgment() → void
Physical devices require --allow-device-storage-mutation or --reset-device-storage before storage is captured or mutated.
resetPreSuiteStorageSnapshotForTest() → void
Test hook: drop the cached baseline between unit tests.
resetTestRuntime({NavigationFlowRecorder? navigationFlow}) → void
resetViewport(WidgetTester tester) → Future<void>
Restores the widget-test view after a report screenshot viewport override.
restorePreSuiteStorage() → Future<void>
Restores the cached pre-suite storage baseline (capturing it first if needed).
restorePreSuiteStorageAtSuiteEnd() → Future<void>
Restores the pre-suite baseline at suite teardown (including after failures) so the device returns to its pre-run storage state.
restorePreSuiteStorageForTest() → Future<void>
Test hook exposing restorePreSuiteStorage.
runtimeAdapterFor(ExecutionMode mode) → EnsembleTestRuntimeAdapter
runWithRealNetworkHttpOverrides<T>(Future<T> run()) → Future<T>
setViewportForDevice(WidgetTester tester, EnsembleTestContext context, DeviceInfo device) → Future<void>
waitForInitialWidgets(WidgetTester tester, {EnsembleTestCase? testCase}) → Future<void>
wipeAllPersistentStorage() → Future<void>
Wipes all public / encrypted / keychain storage. Destructive — only used when resetDeviceStorage is set or when capturing an empty baseline.

Constants

allowDeviceStorageMutation → const bool
Explicit acknowledgment that integration tests may mutate storage on a physical device (baseline capture + between-test restores).
deviceIsPhysical → const bool
True when the integration target is a physical device (not emulator/sim).
resetDeviceStorage → const bool