Skip to content

Not able to find element by Semantics in Release build #151238

@saikrishna321

Description

@saikrishna321

Steps to reproduce

Unable to find element by Semantics

Expected results

Should be able to find element bySemanticsLabel

Actual results

No element is found

Code sample

Code sample

FileName - test.dart

import 'package:appium_testing_app/main.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  group('end-to-end test', () {
    testWidgets('tap on the floating action button, verify counter',
            (tester) async {
          // Load app widget.
          await tester.pumpWidget(const MyApp());
          // Finds the floating action button to tap on.
          final fab = find.bySemanticsLabel('username_text_field');
          print(fab.evaluate());
          List<DiagnosticsNode> nodes = tester
              .widget(fab)
              .toDiagnosticsNode()
              .getProperties();
          // Emulate a tap on the floating action button.
          await tester.tap(fab);
          for (DiagnosticsNode node in nodes) {
            print("Flutter - ${node.name} -> ${node.value}");
          }
          // Trigger a frame.
          await tester.pumpAndSettle();
        });
  });
}

App Code

Semantics(
              label: "username_text_field",
              key: const Key("username_text_field"),
              // textField: true,
              explicitChildNodes: true,
              container: true,
              child: TextField(
                decoration:
                    const InputDecoration.collapsed(hintText: "Username"),
                controller: userNameController,
              ),
            ),

Command Used to build the IPA

flutter build ipa --release --export-options-plist=/Documents/ExportOptions.plist  /Downloads/git/appium-flutter-server/demo-app/integration_test/test.dart

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
{"msg":"Jul  3 19:22:35 God- kernel(AppleMobileFileIntegrity)[0] \u003cNotice\u003e: AMFI: constraint violation /private/var/containers/Bundle/Application/394C6BFC-9825-4665-A685-48F161BF8357/Runner.app/Frameworks/webview_flutter_wkwebview.framework/webview_flutter_wkwebview has entitlements but is not a main binary"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: 00:00 +0: end-to-end test tap on the floating action button, verify counter"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: Found 0 widgets with element matching predicate: []"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: Bad state: No element"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #0      Iterable.single (dart:core/iterable.dart:674)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #1      WidgetController.widget (package:flutter_test/src/controller.dart:801)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #2      main.\u003canonymous closure\u003e.\u003canonymous closure\u003e (file:///Users/saikrishna/Downloads/git/appium-flutter-server/demo-app/integration_test/test.dart:17)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: \u003casynchronous suspension\u003e"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #3      testWidgets.\u003canonymous closure\u003e.\u003canonymous closure\u003e (package:flutter_test/src/widget_tester.dart:183)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: \u003casynchronous suspension\u003e"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #4      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1017)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: \u003casynchronous suspension\u003e"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: #5      TestWidgetsFlutterBinding._createTestCompletionHandler.\u003canonymous closure\u003e (package:flutter_test/src/binding.dart:809)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: \u003casynchronous suspension\u003e"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: 00:00 +0: end-to-end test tap on the floating action button, verify counter [E]"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter:   Test failed. See exception logs above.\n  The test description was: tap on the floating action button, verify counter"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter:"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: 00:00 +0 -1: (tearDownAll)"}
{"msg":"Jul  3 19:22:36 God- Runner(Flutter)[66332] \u003cNotice\u003e: flutter: 00:00 +1 -1: Some tests failed."}

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: releaseChallenges faced when attempting to productionize an appf: integration_testThe flutter/packages/integration_test pluginfound in release: 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions