Hello everyone i'm having this error when running widget tests
The following MissingPluginException was thrown running a test:
MissingPluginException(No implementation found for method create on channel flutter/platform_views)
When the exception was thrown, this was the stack:
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
<asynchronous suspension>
<asynchronous suspension>
the state is the correct, the mock data is also correct. Can anyone push me to the correct path. what im doing wrong?
void main() {
final TestWidgetsFlutterBinding binding =
TestWidgetsFlutterBinding.ensureInitialized();
group('scan tagOnboarding screen Golden Test', () {
late DashboardCubit dashboardCubit;
late MapboxMapCubit mapboxMapCubit;
late SessionCubit sessionCubit;
late StreamController<Customer> customerStream;
late StreamController<Site> siteStream;
late StreamController<bool> resetStream;
late StreamController<bool> liveMapStream;
tearDown(() {
customerStream.close();
siteStream.close();
resetStream.close();
dashboardCubit.close();
liveMapStream.close();
});
for (GoldenTheme theme in GoldenTheme.values) {
for (GoldenScale scale in GoldenScale.values) {
for (PhysicalSize physicalSizeDevices in PhysicalSize.values) {
testWidgets('dashboard screen Golden Test ' ,(WidgetTester tester) async {
// change screen size and pixel density ratio
binding.window.physicalSizeTestValue =
physicalSizeDevices.physicalSizes;
binding.window.devicePixelRatioTestValue = 1.0;
await loadAppFonts();
customerStream = StreamController<Customer>();
siteStream = StreamController<Site>();
resetStream = StreamController<bool>();
liveMapStream = StreamController<bool>();
sessionCubit = MockSessionCubit();
MockGlobalOptionsRepository globalOptionsRepository =
MockGlobalOptionsRepository();
final customersRepository = MockCustomersRepository();
final customerBroadcastStream =
customerStream.stream.asBroadcastStream();
final siteBroadcastStream = siteStream.stream.asBroadcastStream();
final resetBroadcastStream = resetStream.stream.asBroadcastStream();
when(globalOptionsRepository.getMaxZoom())
.thenAnswer((_) => Future.value(15));
when(sessionCubit.globalOptionsRepository)
.thenAnswer((_) => globalOptionsRepository);
when(sessionCubit.customersRepository)
.thenAnswer((_) => customersRepository);
dashboardCubit = DashboardCubit(
customerStream: customerBroadcastStream,
siteStream: siteBroadcastStream,
resetStream: resetBroadcastStream);
mapboxMapCubit = MapboxMapCubit(
customerStream: customerBroadcastStream,
siteStream: siteBroadcastStream,
liveMapStream: liveMapStream.stream,
globalOptionsRepository: globalOptionsRepository,
resetStream: resetBroadcastStream,
);
//mapboxMapCubit.mapboxController
siteStream.add(site1());
customerStream.add(customer1());
await pumpWithSettle(
tester,
GoldenApp(
theme: theme,
scale: scale,
child: BlocProvider<SessionCubit>(
create: (context) => sessionCubit,
child: MultiBlocProvider(
providers: [
BlocProvider(create: (context) => mapboxMapCubit),
BlocProvider(create: (context) => dashboardCubit)
],
child: MyMapboxMap(isFullscreen: true,)
)),
),
);
await expectLater(
find.byType(MyMapboxMap),
matchesGoldenFile(
'goldens/dashboard_${scale.name}_${theme.name}_${physicalSizeDevices.name}.png',
),
);
});
}
}
}
});
}
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
! Warning: dart on your path resolves to /opt/homebrew/Cellar/dart/3.1.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/andrecoelho/fvm/versions/3.7.11. Consider adding /Users/andrecoelho/fvm/versions/3.7.11/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.77.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
the map is all fine when running i just would like to do some widget tests.
even when doing a simple test i get that exception,
example of the simple test
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello everyone i'm having this error when running widget tests
the state is the correct, the mock data is also correct. Can anyone push me to the correct path. what im doing wrong?
above is the widget test file and my widget.
here goes my fvm flutter doctor
Doctor summary (to see all details, run flutter doctor -v): [!] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US) ! Warning:
dart
on your path resolves to /opt/homebrew/Cellar/dart/3.1.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/andrecoelho/fvm/versions/3.7.11. Consider adding /Users/andrecoelho/fvm/versions/3.7.11/bin to the front of your path. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.1) [✓] VS Code (version 1.77.1) [✓] Connected device (3 available) [✓] HTTP Host Availabilitythe map is all fine when running i just would like to do some widget tests.
even when doing a simple test i get that exception, example of the simple test
i'm using the latest version of mapbox: mapbox_gl: ^0.16.0