Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app crashes while semantics is enalbled for automation testing in web #614

Open
vaishakNiveus opened this issue Jan 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@vaishakNiveus
Copy link

Steps to reproduce

1)enable semantics in void main() using SemanticsBinding.instance.ensureSemantics();
2)wrap the typeahead widget with semantics and add a label
3)run the application in web
4)open inspect and click on "select an element in page to inspect " icon
5)click on typeahead textfield in screen and type some words select anything form the suggestion or press enter key after typing
6) app crashes without giving any error in console

Expected results

app is not supposed to crash

Actual results

while i tried running the app using "flutter run --verbose" getting the following error:-

[ +4 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:55030/main_module.bootstrap.js
[+8354 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true
[ +49 ms] ChromeProxyService: Caching package:flutter/src/widgets/widget_inspector.dart in expression compiler worker
[ +83 ms] DevHandler: Debug service listening on ws://127.0.0.1:55091/W9QwPx3WQHY=/ws

[ +9 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 10, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 10, params: {streamId: Stdout,
includePrivateMembers: false}}}}
[ +5 ms] This app is linked to the debug service: ws://127.0.0.1:55091/W9QwPx3WQHY=/ws
[ +1 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 11, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 11, params: {streamId: Stderr,
includePrivateMembers: false}}}}
[ +9 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 13, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 13, params: {streamId: Isolate,
includePrivateMembers: false}}}}
[ +3 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 14, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 14, params: {streamId: Extension,
includePrivateMembers: false}}}}
[ +4 ms] Debug service listening on ws://127.0.0.1:55091/W9QwPx3WQHY=/ws
[ +2 ms] To hot restart changes while running, press "r" or "R".
[ ] For a more detailed help message, press "h". To quit, press "q".
[ ] A Dart VM Service on Chrome is available at: http://127.0.0.1:55091/W9QwPx3WQHY=
[ +116 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart
[ +29 ms] ExpressionEvaluator: Evaluating JS: "function () {
try {
return (function() {
const dart_sdk = require('dart_sdk');
const dart_rti = dart_sdk.dart_rti;
const dart = dart_sdk.dart;
return dart.fn(() => true, dart_rti._Universe.eval(dart_rti._theUniverse(), "core|bool()", true));
}(

             ))();
         } catch (error) {
           return error.name + ": " + error.message;
         }
       }" with scope: {}

[ +11 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}"
[+2073 ms] The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:55091/W9QwPx3WQHY=
[+191409 ms] ChromeProxyService: Destroying isolate
[ ] BatchedExpressionEvaluator: Closed
[ +13 ms] ChromeProxyService: Destroying isolate
[ +9 ms] Debugger: Target crashed!

Package Version

5.2.0

Platform

Web

Code sample

main.dart

void main() {
WidgetsFlutterBinding.ensureInitialized();
SemanticsBinding.instance.ensureSemantics();
FlutterError.onError = (FlutterErrorDetails details) {
print('Error is $details');
};
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const HomeScreen(),
debugShowCheckedModeBanner: false,

);

}
}

Typeahead.dart

import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';

class TypeAheadDemo extends StatelessWidget {
TypeAheadDemo({super.key});
final List dummyData = [
'Apple',
'Banana',
'Cherry',
'Date',
'Elderberry',
'Fig',
'Grapes',
'Honeydew',
];
final TextEditingController textEditingController = TextEditingController();

@OverRide
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Semantics(
container: true,
enabled: true,
label: 'Search for items',
hint: 'Enter a query to see suggestions',
focusable: true,
child: TypeAheadField(

      suggestionsCallback: (pattern) {

        // Return suggestions that match the input pattern
        return dummyData
            .where((item) =>
                item.toLowerCase().contains(pattern.toLowerCase()))
            .toList();
      },
      itemBuilder: (context, String suggestion) {
        // Build each suggestion item in the dropdown
        return ListTile(
          title: Text(suggestion),
        );
      },
      onSelected: (String suggestion) {
        // Action to take when a suggestion is selected
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text('You selected: $suggestion')),
        );
        textEditingController.text = suggestion;
      },
      controller: textEditingController,
      // textFieldConfiguration: TextFieldConfiguration(
      //   decoration: const InputDecoration(
      //     border: OutlineInputBorder(),
      //     hintText: 'Search for a fruit',
      //   ),
      // ),
      // noItemsFoundBuilder: (context) {
      //   // UI to show when no suggestions are found
      //   return const Padding(
      //     padding: EdgeInsets.all(8.0),
      //     child: Text(
      //       'No items found',
      //       style: TextStyle(color: Colors.grey),
      //     ),
      //   );
      // },
    ),
  ),
);

}
}

Logs

[ +4 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:55030/main_module.bootstrap.js
[+8354 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true
[ +49 ms] ChromeProxyService: Caching package:flutter/src/widgets/widget_inspector.dart in expression compiler worker
[ +83 ms] DevHandler: Debug service listening on ws://127.0.0.1:55091/W9QwPx3WQHY=/ws

[ +9 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 10, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 10, params: {streamId: Stdout,
includePrivateMembers: false}}}}
[ +5 ms] This app is linked to the debug service: ws://127.0.0.1:55091/W9QwPx3WQHY=/ws
[ +1 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 11, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 11, params: {streamId: Stderr,
includePrivateMembers: false}}}}
[ +9 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 13, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 13, params: {streamId: Isolate,
includePrivateMembers: false}}}}
[ +3 ms] DevHandler: VmService proxy responded with an error:
{jsonrpc: 2.0, id: 14, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 14, params: {streamId: Extension,
includePrivateMembers: false}}}}
[ +4 ms] Debug service listening on ws://127.0.0.1:55091/W9QwPx3WQHY=/ws
[ +2 ms] To hot restart changes while running, press "r" or "R".
[ ] For a more detailed help message, press "h". To quit, press "q".
[ ] A Dart VM Service on Chrome is available at: http://127.0.0.1:55091/W9QwPx3WQHY=
[ +116 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart
[ +29 ms] ExpressionEvaluator: Evaluating JS: "function () {
try {
return (function() {
const dart_sdk = require('dart_sdk');
const dart_rti = dart_sdk.dart_rti;
const dart = dart_sdk.dart;
return dart.fn(() => true, dart_rti._Universe.eval(dart_rti._theUniverse(), "core|bool()", true));
}(

             ))();
         } catch (error) {
           return error.name + ": " + error.message;
         }
       }" with scope: {}

[ +11 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}"
[+2073 ms] The Flutter DevTools debugger and profiler on Chrome is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:55091/W9QwPx3WQHY=
[+191409 ms] ChromeProxyService: Destroying isolate
[ ] BatchedExpressionEvaluator: Closed
[ +13 ms] ChromeProxyService: Destroying isolate
[ +9 ms] Debugger: Target crashed!

Screenshots or Video

Screenshots / Video demonstration [Upload media here]
@vaishakNiveus vaishakNiveus added the bug Something isn't working label Jan 6, 2025
@abhiBirwa
Copy link

abhiBirwa commented Jan 6, 2025

++ Looking forward to any updates or solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants