[Bug] Integration tests are broken on Windows
Bug Description
Some integration tests on Windows have been broken since I started work here, but I needed help figuring out why. While I was working on adding custom fonts to AppFlowy, I realized that there was a problem with the following that I think causes the issue
static Future<Directory> testLocation(String? name) async {
final dir = await getApplicationDocumentsDirectory();
var path = '${dir.path}/flowy_test';
if (name != null) {
path += '/$name';
}
return Directory(path).create(recursive: true);
}
How to Reproduce
Any integration test that depends on TestFolder seems to be affected.
Expected Behavior
Tests pass on macOS and linux because the platform file separator is / and not \
Operating System
Windows
AppFlowy Version(s)
main
Screenshots
No response
Additional Context
No response
I just checked whether the platform path separator was the issue, and it turns out that the tests fail because the process cannot delete the test location because the application is still running during the teardown phase and has the test location open.
AppFlowy.exe can't be terminated to release the file handles because the way that some tests are written require the application to be open.