diff --git a/.drone.yml b/.drone.yml index 2f646fda..0fd09e19 100644 --- a/.drone.yml +++ b/.drone.yml @@ -67,7 +67,8 @@ steps: path: /root/.pub-cache commands: - ./fetch-tor.sh - - ./run-tests-headless.sh 01_general + # Run 01_general and 02_global_settings features... + - ./run-tests-headless.sh "01_general|02_global_settings" - name: test-build-android image: openpriv/flutter-desktop:linux-fstable-3.7.1 diff --git a/.gitignore b/.gitignore index 85f4ee78..341dac30 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ integration_test/gherkin/ integration_test/CustomSteps.md analysis_options.yaml integration_test/env/default/tor +integration_test/env/temp* linux/Tor linux/tor.tar.gz diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version index 56c3ca8d..20efa54b 100644 --- a/LIBCWTCH-GO-MACOS.version +++ b/LIBCWTCH-GO-MACOS.version @@ -1 +1 @@ -2022-12-12-17-58-v1.10.1-3-g3d0a3a5 \ No newline at end of file +2023-02-08-16-57-v1.10.5 \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index 05e99b26..1ea0cad7 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-12-12-22-59-v1.10.1-3-g3d0a3a5 \ No newline at end of file +2023-02-08-21-57-v1.10.5 \ No newline at end of file diff --git a/integration_test/features/01_general/03_tor.feature b/integration_test/features/01_general/03_tor.feature index cd03613f..08a981c3 100644 --- a/integration_test/features/01_general/03_tor.feature +++ b/integration_test/features/01_general/03_tor.feature @@ -3,12 +3,11 @@ Feature: Tor initializes correctly Given I wait until the widget with type 'ProfileMgrView' is present And I tap the icon with type "TorIcon" Then I expect the Tor version to be present - And I expect the string 'Online' to be present within 60 seconds + And I expect the string 'Online' to be present within 120 seconds Scenario: Reset Tor Given I wait until the widget with type 'ProfileMgrView' is present And I tap the icon with type "TorIcon" - Then I expect the string 'Online' to be present within 60 seconds + Then I expect the string 'Online' to be present within 120 seconds Then I tap the button that contains the text "Reset" - And I wait for 1 second - Then I expect the text "Online" to be absent + Then I expect the text "Online" to be absent within 5 seconds diff --git a/integration_test/features/02_global_settings/01_language.feature b/integration_test/features/02_global_settings/01_language.feature index 29da3dad..36ad1247 100644 --- a/integration_test/features/02_global_settings/01_language.feature +++ b/integration_test/features/02_global_settings/01_language.feature @@ -5,12 +5,12 @@ Feature: Global 'language' setting And I wait until the text 'Language' is present Then I expect the text 'Language' to be present And I expect the text 'Langue' to be absent - When I tap the widget that contains the text "English" + When I tap the dropdown button that contains the text "English" And I wait until the text 'French' is present - And I tap the widget that contains the text "French" + And I tap the dropdown button that contains the text "French" And I wait until the text 'Langue' is present And I expect the text 'Language' to be absent - When I tap the widget that contains the text "Français" - And I tap the widget that contains the text "Anglais" + And I scroll the dropdown list "languagelist" by -10 + And I tap the dropdown button that contains the text "Anglais" And I wait until the text 'Language' is present And I expect the text 'Langue' to be absent \ No newline at end of file diff --git a/integration_test/features/02_global_settings/02_theme.feature b/integration_test/features/02_global_settings/02_theme.feature index 757c391c..f838cd36 100644 --- a/integration_test/features/02_global_settings/02_theme.feature +++ b/integration_test/features/02_global_settings/02_theme.feature @@ -2,11 +2,12 @@ Feature: Global 'Theme' setting Scenario: Change the theme to Mermaid Given I wait until the widget with type 'ProfileMgrView' is present Given I tap the 'OpenSettingsView' button - And I wait for 1 second + And I wait until the text 'Use Light Themes' is present When I tap the "DropdownTheme" button - And I tap the element that contains the text "Mermaid" + And I wait until the text 'Mermaid' is present + And I tap the dropdown button that contains the text "Mermaid" Scenario: Change the theme to Light Mode Given I wait until the widget with type 'ProfileMgrView' is present Given I tap the 'OpenSettingsView' button - And I wait for 1 second - And I tap the widget that contains the text "Theme" \ No newline at end of file + And I wait until the text 'Use Light Themes' is present + And I tap the widget that contains the text "Use Light Themes" \ No newline at end of file diff --git a/integration_test/features/02_global_settings/04_block_unknown.feature b/integration_test/features/02_global_settings/04_block_unknown.feature index 62190fae..eb8ce33b 100644 --- a/integration_test/features/02_global_settings/04_block_unknown.feature +++ b/integration_test/features/02_global_settings/04_block_unknown.feature @@ -3,18 +3,21 @@ Feature: Block unknown contacts setting Scenario: Carol adds Alice but Alice doesn't see it because Block Unknowns is enabled Given I wait until the widget with type 'ProfileMgrView' is present Given I tap the 'OpenSettingsView' button + And I wait until the text "Block Unknown Contacts" is present When I tap the widget that contains the text "Block Unknown Contacts" Then I expect the switch that contains the text "Block Unknown Contacts" to be checked - Given I tap the back button + Then I tap the back button + And I wait until the tooltip "Online" is present And I wait until the text "Carol" is present And I tap the button that contains the text "Carol" + And I wait until the text "Conversations" is present And I tap the button with tooltip "Add a new contact or conversation" + And I tap the button that contains the text "Add contact" + And I wait until the text "Paste a cwtch address" is present When I fill the "txtAddP2P" field with "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd" - And I wait for 1 second - And I take a screenshot + And I wait for 3 seconds And I tap the back button And I wait until the text "Alice" is present - And I wait until the tooltip "Online" is present And I tap the button that contains the text "Alice" And I wait for 20 seconds Then I expect the text "yxj2pvhozedflp4g7yitpqkeho63maaffi2qgsj3e6s2fbmosuuas2qd" to be absent \ No newline at end of file diff --git a/integration_test/features/02_global_settings/05_streamer.feature b/integration_test/features/02_global_settings/05_streamer.feature index cc53babf..011c198b 100644 --- a/integration_test/features/02_global_settings/05_streamer.feature +++ b/integration_test/features/02_global_settings/05_streamer.feature @@ -5,7 +5,7 @@ Feature: Streamer mode And I wait until the text "vbmmsbx3rhndpfz6t3jkrd7m3yu62xzrldxkdgsw4rsehiwuw3tmo7yd" is present And I wait until the text "pjurzypqui3dnpxj6aemk6cqz22yx6zfr5lq4jzu7muwe2yyx2zrnzyd" is present Given I tap the 'OpenSettingsView' button - And I wait for 1 second + And I wait until the text "Streamer/Presentation Mode" is present And I tap the widget that contains the text "Streamer/Presentation Mode" Then I expect the switch that contains the text "Streamer/Presentation Mode" to be checked When I tap the back button diff --git a/integration_test/hooks/env.dart b/integration_test/hooks/env.dart index 192d62f4..7b85c8e9 100644 --- a/integration_test/hooks/env.dart +++ b/integration_test/hooks/env.dart @@ -28,15 +28,37 @@ class ResetCwtchEnvironment extends Hook { @override Future onBeforeScenario(TestConfiguration config, String scenario, Iterable tags) async { if (tags.any((t) => t.name == "@env:persist")) { - await Process.run("mv", ["integration_test/env/temp-persist", "integration_test/env/temp"]); + return Process.run("rm", ["-rf", "integration_test/env/temp"]).then((value) { + return Process.run("mv", + ["integration_test/env/temp-persist", "integration_test/env/temp"]) + .then((value) { + print("copied persist!"); + return super.onBeforeScenario(config, scenario, tags); + }); + }); } else if (tags.any((t) => t.name == "@env:aliceandbob1")) { - await Process.run("cp", ["-R", "integration_test/env/aliceandbob1", "integration_test/env/temp"]); + return Process.run("rm", ["-rf", "integration_test/env/temp"]).then((value) { + return Process.run("cp", [ + "-R", + "integration_test/env/aliceandbob1", + "integration_test/env/temp" + ]).then((value) { + print("copied aliceandbob!"); + return super.onBeforeScenario(config, scenario, tags); + }); + }); } else if (!(tags.any((t) => t.name == "@env:clean"))) { // use the default environment if no @env: tag specified - await Process.run("cp", ["-R", "integration_test/env/default", "integration_test/env/temp"]); - } else { - print("clean environment initialized"); + return Process.run("rm", ["-rf", "integration_test/env/temp"]).then((value) { + return Process.run("cp", + ["-R", "integration_test/env/default", "integration_test/env/temp"]) + .then((value) { + print("copied clean!"); + return super.onBeforeScenario(config, scenario, tags); + }); + }); } + print("potentially dirty environment initialized - clean not specified"); return super.onBeforeScenario(config, scenario, tags); } diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 1dc2483f..cdd0b1ff 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -152,8 +152,14 @@ class CwtchFfi implements Cwtch { Map envVars = Platform.environment; String cwtchDir = ""; if (Platform.isLinux) { - cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); home = envVars['HOME'] ?? ""; + if (EnvironmentConfig.TEST_MODE) { + cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); + } else { + cwtchDir = envVars['CWTCH_HOME']!; + } + + if (await File("linux/Tor/tor").exists()) { bundledTor = "linux/Tor/tor"; } else if (await File("lib/Tor/tor").exists()) { diff --git a/lib/views/addcontactview.dart b/lib/views/addcontactview.dart index 1b83c0b4..56b28a1a 100644 --- a/lib/views/addcontactview.dart +++ b/lib/views/addcontactview.dart @@ -149,7 +149,6 @@ class _AddContactViewState extends State { height: 20, ), CwtchTextField( - testKey: Key("txtAddP2P"), key: Key("txtAddP2P"), controller: ctrlrContact, validator: (value) { diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index 8d1dcc69..a8306250 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -115,6 +115,7 @@ class _GlobalSettingsViewState extends State { trailing: Container( width: MediaQuery.of(context).size.width / 4, child: DropdownButton( + key: Key("languagelist"), isExpanded: true, value: Provider.of(context).locale.toString(), onChanged: (String? newValue) { @@ -127,7 +128,7 @@ class _GlobalSettingsViewState extends State { items: AppLocalizations.supportedLocales.map>((Locale value) { return DropdownMenuItem( value: value.toString(), - child: Text(getLanguageFull(context, value.languageCode, value.countryCode)), + child: Text( key: Key("dropdownLanguage" + value.languageCode), getLanguageFull(context, value.languageCode, value.countryCode)), ); }).toList()))), SwitchListTile( diff --git a/pubspec.lock b/pubspec.lock index 639eb47c..2dd65711 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -280,7 +280,7 @@ packages: description: path: "." ref: main - resolved-ref: "9b817676e4ad623a875accaa26097669a9bd2c7c" + resolved-ref: bc846ee4df720288a17b8455ec4cc1ccbe90ecdb url: "https://git.openprivacy.ca/openprivacy/flutter_gherkin" source: git version: "3.0.0-rc.17" diff --git a/pubspec.yaml b/pubspec.yaml index 062e47ae..bcd78cde 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,6 +52,7 @@ dev_dependencies: msix: ^3.6.2 build_runner: any flutter_gherkin: + #path: ./flutter_gherkin git: url: https://git.openprivacy.ca/openprivacy/flutter_gherkin ref: main diff --git a/run-tests.sh b/run-tests.sh index c080b73c..b162ad0e 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,13 +1,13 @@ #!/bin/bash -paths=$(find . -wholename "./integration_test/features/*$1*.feature" | sort | sed -z "s/\\n/','/g;s/,'$//;s/^/'/") +paths=$(find . -regextype posix-extended -regex "./integration_test/features/($1).*feature" | sort | sed -z "s/\\n/','/g;s/,'$//;s/^/'/") sed "s|featurePaths: REPLACED_BY_SCRIPT|featurePaths: [$paths]|" integration_test/gherkin_suite_test.editable.dart > integration_test/gherkin_suite_test.dart flutter pub run build_runner clean flutter pub run build_runner build --delete-conflicting-outputs PATH=$PATH:$PWD/linux/Tor LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$PWD/linux/":"$PWD/linux/Tor/" -PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=/home/sarah/PARA/projects/cwtch/cwtch.log CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart +LOG_LEVEL=debug PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=/home/sarah/PARA/projects/cwtch/cwtch.log CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart #node index2.js #if [ "$HEADLESS" = "false" ]; then # xdg-open integration_test/gherkin/reports/cucumber_report.html