Add Tests for 02_global_settings to pipeline. Update bindings
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2023-02-08 15:05:36 -08:00
parent c78cff1e92
commit 47f3cd8ee1
16 changed files with 65 additions and 31 deletions

View File

@ -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

1
.gitignore vendored
View File

@ -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

View File

@ -1 +1 @@
2022-12-12-17-58-v1.10.1-3-g3d0a3a5
2023-02-08-16-57-v1.10.5

View File

@ -1 +1 @@
2022-12-12-22-59-v1.10.1-3-g3d0a3a5
2023-02-08-21-57-v1.10.5

View File

@ -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

View File

@ -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

View File

@ -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"
And I wait until the text 'Use Light Themes' is present
And I tap the widget that contains the text "Use Light Themes"

View File

@ -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

View File

@ -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

View File

@ -28,15 +28,37 @@ class ResetCwtchEnvironment extends Hook {
@override
Future<void> onBeforeScenario(TestConfiguration config, String scenario, Iterable<Tag> 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);
}

View File

@ -152,8 +152,14 @@ class CwtchFfi implements Cwtch {
Map<String, String> 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()) {

View File

@ -149,7 +149,6 @@ class _AddContactViewState extends State<AddContactView> {
height: 20,
),
CwtchTextField(
testKey: Key("txtAddP2P"),
key: Key("txtAddP2P"),
controller: ctrlrContact,
validator: (value) {

View File

@ -115,6 +115,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
trailing: Container(
width: MediaQuery.of(context).size.width / 4,
child: DropdownButton(
key: Key("languagelist"),
isExpanded: true,
value: Provider.of<Settings>(context).locale.toString(),
onChanged: (String? newValue) {
@ -127,7 +128,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
items: AppLocalizations.supportedLocales.map<DropdownMenuItem<String>>((Locale value) {
return DropdownMenuItem<String>(
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(

View File

@ -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"

View File

@ -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

View File

@ -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: <String>[$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