Skip to content

Commit 55bf777

Browse files
committed
Add temporary storage path for tests in EnsembleTestHarness
Introduce a static variable for a temporary storage path in the EnsembleTestHarness class, enhancing the test environment by directing certain method channel calls to this path instead of the current directory. This change improves test isolation and management of temporary files during test execution.
1 parent 2719a48 commit 55bf777

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/ensemble_test_runner/lib/runner/ensemble_test_harness.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'dart:io';
23

34
import 'package:ensemble/ensemble.dart';
45
import 'package:ensemble/ensemble_app.dart';
@@ -37,6 +38,9 @@ void applyYamlTestBootstrap(EnsembleConfig config, EnsembleTestSetup setup) {
3738

3839
/// Boots the real Ensemble runtime for widget tests.
3940
class EnsembleTestHarness {
41+
static final String _testStoragePath =
42+
Directory.systemTemp.createTempSync('ensemble_test_runner_storage_').path;
43+
4044
static void ensureTestPlugins() {
4145
TestWidgetsFlutterBinding.ensureInitialized();
4246
const pathProviderChannel =
@@ -47,7 +51,7 @@ class EnsembleTestHarness {
4751
case 'getApplicationDocumentsDirectory':
4852
case 'getTemporaryDirectory':
4953
case 'getApplicationSupportDirectory':
50-
return '.';
54+
return _testStoragePath;
5155
default:
5256
return null;
5357
}

0 commit comments

Comments
 (0)