Questions tagged [widget-test-flutter]

100 questions
1
vote
1 answer

Flutter: Mapbox onMapCreated not called in widget test

I'm using the Mapbox map and when I run the app in an emulator, it works fine. However, in my widget test, the onMapCreated method is never called, which makes it impossible to test the behavior of the app. My MapWidget (condensed): class MapWidget…
bear
  • 96
  • 5
1
vote
1 answer

widget test, testing a button with CircularProgressIndicator

I have two tests that after a click on a button I want to test if a CircularProgressIndicator will appear on the button. The problem is after the tap and the tester.pump(), it can't find the CircularProgressIndicator causing the test to fail, I…
Rafael Honda
  • 197
  • 2
  • 2
  • 7
1
vote
0 answers

How to deal with device width and orientation in widget testing?

The widget that I want to test is dependent on the device width and orientation. Is it possible to set those parameters for a widget test, so that I can write a test for different devices sizes and orientations?
Frederik
  • 1,221
  • 2
  • 13
  • 22
0
votes
1 answer

Flutter Test - Check widgets after first setState

I have an action taken on a button click. The method looks like void _buttonAction() async { setState(() { _loading = true; }); // Api call takes place here setState(() { _loading = false; }); } In my widget test, after…
Ameya Savale
  • 431
  • 1
  • 8
  • 21
0
votes
0 answers

My widget tests is not correctly being set when using Auto_route package

I have a flutter project, and i am using auto_route: ^7.8.3 package for navigation i have set up a bottom nav bar with 4 tabs and a screen for each tab when i run it it works as i expect it, my issue is i am trying to set up some widget test and get…
0
votes
0 answers

Flutter DataRow.key does not show key for find.byKey Widget Testing

I'm writing widget tests for a Flutter app. I have a DataTable that I'm trying to test, but when I try to find a specific DataRow by the ValueKey I've assigned, I get the error: Expected: exactly one matching node in the widget tree Actual:…
bubba
  • 83
  • 6
0
votes
1 answer

Flutter Test Cases issue : EXCEPTION CAUGHT BY WIDGETS LIBRARY - 'No Firebase App has been created'

I am doing widget testing and for my main flutter web page I have written a simple test case as below: void main(){ group("test cases for main screen page after login",(){ testWidgets("should have one title for the page on top",…
Jaimin Modi
  • 1,530
  • 4
  • 20
  • 72
0
votes
0 answers

Widget testing Error: The getter 'mounted' isn't defined for the class 'BuildContext'

I am doing widget testing but I got Error: The getter 'mounted' isn't defined for the class 'BuildContext'.. How can I fix this error? fvm flutter --version Flutter 3.7.12 • channel stable • https://github.com/flutter/flutter.git Framework •…
Jaehyuck Choi
  • 169
  • 11
0
votes
1 answer

Widget Testing not working as expected in Flutter

testWidgets('Login Widget Testing', (WidgetTester tester) async { await tester.pumpWidget(makeTestableWidget(Child: loginView)); Finder userNameField = find.byKey(Key('username')); await tester.enterText(userNameField, 'demo'); Finder…
0
votes
0 answers

How to write widget test for screen which uses provider using mocktail or mockito?

how write widget tests using mocktail or mockito for a screen that calls an API from a provider in the initState ? the below screen calls an api from provider in initState. so here i want to write test cases to check the screen state such as empty,…
0
votes
0 answers

Bloc was not initialized in Widget test cases

I utilized Container and Text widgets in Flutter to create a basic example, and also incorporated a test case for my sample. However, during the test run(widget test case), I encountered a null exception as the bloc was not initialized. I have…
Gowtham
  • 31
  • 2
0
votes
0 answers

Flutter Widget Test on VS Gui \ Terminal

I'm running test widgets on my Flutter app, to avoid overflow problems I had to set FlutterError.onError = ignoreOverflowErrors, also due to responsive layout app i needed to set a size of the screeen in the testing enviroment…
Gpp22
  • 43
  • 1
  • 9
0
votes
0 answers

How to do widget test of an animation in flutter?

I have an AnimatedPositioned widget that listens to a variable (called show). When the variable changes to true, it appears from the bottom of the screen to the center. How do I properly do a widget test of this? I'm new in widget testing in…
0
votes
0 answers

How to test TextButton in flutter?

I'mm testing a Textbutton in ListTile as trailing, but it throws an exception. The finder "zero widgets with icon "IconData(U+0E1B9)" (ignoring offstage widgets)" (used in a call to "tap()") could not find any matching widgets. This is my test: …
0
votes
0 answers

Test Report in Azure Devops is not showing the details of failed tests

I've created widget and integration tests for my flutter application then deployed it on azure devops and created a pipeline that can generate a test report. The problem is in the report I'm not getting a detailed information of the failed test (…