Fixup integration tests
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Sarah Jamie Lewis 2023-06-14 11:57:49 -07:00
parent e416638e65
commit c3cd8d5d66
8 changed files with 30 additions and 9 deletions

View File

@ -1,12 +1,13 @@
@env:clean
Feature: Splash screen displays and then closes
Scenario: splash screen appears
Then I expect the widget 'SplashView' to be present within 10 seconds
Then I expect the widget 'ProfileManagerView' to be present within 10 seconds
# first-run of cwtch creates expected files and folders
Then I expect the folder 'integration_test/env/temp' to exist
And I expect the folder 'integration_test/env/temp/dev' to exist
And I expect the file 'integration_test/env/temp/dev/SALT' to exist
Then I wait for the file 'integration_test/env/temp/dev/ui.globals' to exist
And I expect the file 'integration_test/env/temp/dev/ui.globals' to exist
And I expect the folder 'integration_test/env/temp/dev/tor' to exist
And I expect the file 'integration_test/env/temp/dev/tor/torrc' to exist

View File

@ -32,6 +32,9 @@ Feature: Basic Profile Management
Scenario: Load Unencrypted Profile
Given I wait until the widget with type 'ProfileMgrView' is present
Then I expect a "ProfileRow" widget with text "Alice (Unencrypted)"
# This test is too short...if the test finishes before flutter has finished initializing then
# the framework gets very confused...
And I wait for 2 seconds
Scenario: Create Encrypted Profile
Given I wait until the widget with type 'ProfileMgrView' is present

View File

@ -56,6 +56,7 @@ void main() async {
// files
FolderExists(),
FileExists(),
WaitFileExists(),
];
var sb = StringBuffer();

View File

@ -19,3 +19,16 @@ StepDefinitionGeneric FileExists() {
},
);
}
StepDefinitionGeneric WaitFileExists() {
return then1<String, FlutterWorld>(
RegExp(r'I wait for the file {string} to exist'),
(input1, context) async {
await context.world.appDriver.waitUntil(
() async {
await context.world.appDriver.waitForAppToSettle();
return File(input1).existsSync();
});
},
);
}

View File

@ -33,7 +33,6 @@ StepDefinitionGeneric TorVersionPresent() {
break;
}
}
print('File is now closed.');
} catch (e) {
print('Error: $e');
}
@ -44,12 +43,14 @@ StepDefinitionGeneric TorVersionPresent() {
context.world.attach(versionString, "text/plain", "Then I expect the Tor version to be present");
//context.reporter.message("test!!!", MessageLevel.info);
print("looking for version string $versionString");
final finder = context.world.appDriver.findBy(
versionString,
FindType.text,
);
final isP = await context.world.appDriver.isPresent(finder);
context.expect(isP, true);
return await context.world.appDriver.waitUntil(() async {
final finder = context.world.appDriver.findBy(
versionString,
FindType.text,
);
final isP = await context.world.appDriver.isPresent(finder);
return isP;
});
},
);
}

View File

@ -19,3 +19,4 @@ StepDefinitionGeneric TakeScreenshot() {
},
);
}

View File

@ -78,6 +78,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
@override
initState() {
print("initState() started, setting up handlers");
globalSettings = Settings(Locale("en", ''), CwtchDark());
globalErrorHandler = ErrorHandler();
globalTorStatus = TorStatus();

View File

@ -7,7 +7,7 @@ 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 CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart
PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=test.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