From a36a5ea2fe2606428332487dc62019cd71e90d8a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 22 Aug 2023 16:12:41 -0700 Subject: [PATCH] Fix UI Tests. --- README.md | 7 +++++++ lib/main.dart | 6 +++++- lib/settings.dart | 6 +++++- lib/views/addeditprofileview.dart | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 93473bbd..15654ef0 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,13 @@ Cwtch processes the following environment variables: - `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console - `LOG_LEVEL=debug` will set the log level to debug instead of info +## Running Tests + +You can run specific tests with `./run-tests-headless.sh`. See also the `.drone.yml` file for information on the specific tests that run.1 + +The gherkin test framework will occasionally fail silently with incomplete test. This is usually because a previous run resulted in an exception and the underlying Tor +process was not cleaned up (See #711). + ## Building ### Getting Started diff --git a/lib/main.dart b/lib/main.dart index f3ccc0ad..5a3ef06b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -109,7 +109,11 @@ class FlwtchState extends State with WindowListener { print("initState: invoking cwtch.Start()"); cwtch.Start(); print("initState: starting connectivityListener"); - startConnectivityListener(); + if (EnvironmentConfig.TEST_MODE == false) { + startConnectivityListener(); + } else { + connectivityStream = null; + } print("initState: done!"); super.initState(); } diff --git a/lib/settings.dart b/lib/settings.dart index e28c173e..1366f7e9 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -132,7 +132,11 @@ class Settings extends ChangeNotifier { switchLocaleByCode(settings["Locale"]); // Decide whether to enable Experiments - _fontScaling = double.parse(settings["FontScaling"].toString() ?? "1.0").clamp(0.5, 2.0); + var fontScale = settings["FontScaling"]; + if (fontScale == null) { + fontScale = 1.0; + } + _fontScaling = double.parse(fontScale.toString()).clamp(0.5, 2.0); blockUnknownConnections = settings["BlockUnknownConnections"] ?? false; streamerMode = settings["StreamerMode"] ?? false; diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index a80a70f7..a0513b22 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -227,7 +227,8 @@ class _AddEditProfileViewState extends State { // Enabled Visibility( - visible: Provider.of(context).onion.isNotEmpty, + // FIXME don't show the disable switch in test mode...this is a bug relating to scrolling things into view + visible: Provider.of(context).onion.isNotEmpty && (EnvironmentConfig.TEST_MODE == false), child: SwitchListTile( title: Text(AppLocalizations.of(context)!.profileEnabled, style: TextStyle(color: Provider.of(context).current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.profileEnabledDescription),