Open expilu opened 4 years ago
In my case, the test fails.
Maybe because I'm doing golden testing.
await expectLater(
find.byType(MyWidgetUsingCachedNetWorkImage),
matchesGoldenFile('main.png'),
);
I have exact same problem with widget tests while using CachedNetworkImage widget.
+1
This blog post might help: https://medium.com/flutter-community/golden-testing-using-cachednetworkimage-1b488c653af3
followed that blog post but still getting issue, seems base class is trying to create http client.
Tried calling: printOnFailure("Warning: At least one test in this suite creates an HttpClient. When\nrunning a test suite that uses TestWidgetsFlutterBinding, all HTTP\nrequests will return status code 400, and no network request will\nactually be made. Any test expecting a real network connection and\nstatus code will fail.\nTo test code that needs an HttpClient, provide your own HttpClient\nimplementation to the code under test, so that your test can\nconsistently provide a testable response to the code under test.")
package:test_api printOnFailure
package:flutter_test/src/_binding_io.dart 83:7 _MockHttpOverrides.createHttpClient
dart:_http new HttpClient
package:http/src/io_client.dart 23:52 new IOClient
package:http/src/io_client.dart 16:30 createClient
package:http/src/client.dart 35:23 new Client
package:flutter_cache_manager/src/web/file_service.dart 24:38 new HttpFileService
package:flutter_cache_manager/src/web/web_helper.dart 24:39 new WebHelper
package:flutter_cache_manager/src/cache_manager.dart 91:31 new BaseCacheManager
custom_cache_manager.dart 9:9 new TestCacheManager
hmm seems to work if add the GetIt call inside a setUpAll
method in the test. Still having test hang however but suspect that is probably due to using it with golden_toolkit
.
I have exact same problem with widget tests while using CachedNetworkImage widget.
me too.
Because cached_network_image >=3.2.0 depends on flutter_cache_manager ^3.3.0 which depends on sqflite ^2.0.0+3, cached_network_image >=3.2.0 requires sqflite from hosted. So, because app depends on both cached_network_image ^3.2.1 and sqflite from git, version solving failed.
i faced this error plz any one help me
ไฝ ๅฅฝ๏ผ้ฎไปถๅทฒ็ปๆถๅฐ๏ผ่ฐข่ฐข
๐ Bug Report
The plugin throws an exception when doing tests with
testWidgets
. The tests don't fail as the exception is thrown after it completes. But it leaves a lot of console spam like this:`โโโก EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ The following MissingPluginException was thrown running a test (but after the test had completed): MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
When the exception was thrown, this was the stack:
0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)