probe_agent: widgets of package:material_ui and cupertino_ui get wrong answers for is enabled/disabled, is checked and the tooltip selector (Flutter 3.50)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- dart, flutter
- Ambito
- mobile-dev, testing-qa
Direzione di ricerca
Start with the type checks in probe_agent/lib/src/executor.dart, finder.dart, and device_view.dart, then review the measured cases in test/measure_test.dart. Compare handling of legacy and standalone Material and Cupertino widgets, especially enabled state, checked state, and tooltip lookup. Done means those cases pass for migrated widgets on a device while the existing legacy behavior and obscured-field protection remain correct.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
Flutter 3.50 deprecates package:flutter/material.dart and package:flutter/cupertino.dart in favour of the standalone packages material_ui and cupertino_ui ("Migrate to standalone material_ui and cupertino_ui packages", docs.flutter.dev, page dated 2026-11-09). The agent decides what a widget is by its Dart type, taken from package:flutter/material.dart and package:flutter/cupertino.dart (probe_agent/lib/src/executor.dart, finder.dart, device_view.dart). A widget of material_ui is a different class, so on an app that has migrated, some steps give a wrong answer, one of them a silent false pass.
Measured
A scratch app on Flutter 3.50.0 with material_ui 1.11.1 and cupertino_ui 1.1.7 (what ^1.0.0 resolved to), the agent of main (a path dependency), a widget test that runs the agent's own request handler on a screen of each library's widgets. The control is the same screen built from package:flutter/material.dart. One run, no device.
| Step | package:flutter/material.dart (control) |
material_ui / cupertino_ui |
|---|---|---|
see "Submit" (text) and tap "Submit" on an ElevatedButton |
ok | ok |
see #go is enabled (enabled button) |
ok | ok |
see #off is disabled (button with onPressed: null) |
ok | fails: "#off" is enabled |
see #off is enabled (the same disabled button) |
fails: is disabled |
passes (false pass) |
type "x" into #f and see #f contains "x" on a TextField |
ok | ok |
see #cb is checked (Checkbox) and see #sw is checked (Switch) |
ok | fail: "is not a checkable control" |
see #cs is checked (CupertinoSwitch) |
not run | fails: "is not a checkable control" |
tap "Add item" (an IconButton found by its tooltip) |
ok | fails: Widget not found |
type into a CupertinoTextField, contains |
not run | ok |
see #pw is filled (obscured TextField) |
ok | ok |
see "hunter2" (the value of an obscured field must not be found) |
not found, as designed | not found, as designed |
see #f is focused |
ok | ok |
So what runs through the widgets library (text, hit testing, EditableText, focus) works, and the obscured-field protection holds (it goes through EditableText). What is decided by a Material or Cupertino class does not: disabled state of buttons, checked state of checkboxes, switches and radios, the tooltip selector.
Not measured
Route handling (a material_ui Scaffold, dialog or bottom sheet: the agent's route code names BottomSheet, CupertinoPageScaffold and others), TextField(enabled: false), chips and list tiles, TextFormField, DropdownButton, the segmented and picker widgets, probe device view and Studio's inspector, and any device (iOS or Android). Whether the standalone packages re-export or wrap the in-framework classes in a way that would let one check cover both was not read in their source.
Why it matters, and what is not known
The in-framework libraries are still in packages/flutter on 3.50 (the page says "formally deprecated" and gives no removal version), so apps that have not migrated are unaffected. An app that migrates and is tested with FlutterProbe gets the answers above, and is enabled on a disabled button passes. The CLI cannot see it.
Not fixed here
This is a report with a measurement (the RELEASES log gets a note). A fix has to recognise both families of classes (by importing material_ui and cupertino_ui, which raises the Flutter floor of the agent to 3.47, by class name, or by another test of the widget) and has to be tested on a device with a migrated fixture; the choice is open.
The measurement test (scratch, test/measure_test.dart of an app that depends on material_ui, cupertino_ui and the agent)
import 'dart:convert';
import 'package:cupertino_ui/cupertino_ui.dart' as cui;
import 'package:flutter/material.dart' as fm; // the legacy in-framework library: the control
import 'package:flutter/widgets.dart';
import 'package:flutter_probe_agent/src/executor.dart';
import 'package:flutter_probe_agent/src/protocol.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:material_ui/material_ui.dart' as mu;
// What the agent does on widgets from package:material_ui / cupertino_ui compared with the same widgets from package:flutter/material.dart.
// Each case prints one line: "<library> | <step> | ok" or the error message.
final results = <String>[];
Future<String> run(ProbeExecutor ex, List<String> sent, String method, Map<String, dynamic> params) async {
sent.clear();
await ex.dispatch(ProbeRequest(jsonrpc: '2.0', id: 1, method: method, params: params));
final m = jsonDecode(sent.last) as Map<String, dynamic>;
return m.containsKey('error') ? ((m['error'] as Map)['message'] as String).split('\n').first : 'ok';
}
Map<String, dynamic> byText(String t, {String check = '', bool negated = false}) => {
'selector': {'kind': 'text', 'text': t},
if (check.isNotEmpty) 'check': check,
'negated': negated,
};
Map<String, dynamic> byId(String id, {String check = '', bool negated = false}) => {
'selector': {'kind': 'id', 'text': '#$id'},
if (check.isNotEmpty) 'check': check,
'negated': negated,
};
Widget muApp(Widget body) => mu.MaterialApp(home: mu.Scaffold(body: body));
Widget fmApp(Widget body) => fm.MaterialApp(home: fm.Scaffold(body: body));
void main() {
for (final lib in ['flutter/material', 'material_ui']) {
final isMu = lib == 'material_ui';
testWidgets('measure $lib', (tester) async {
final sent = <String>[];
final ex = ProbeExecutor((m) => sent.add(m));
bool checked = true;
bool sw = true;
final pw = TextEditingController(text: 'hunter2-SECRET');
final field = TextEditingController();
final body = Column(children: [
isMu ? mu.ElevatedButton(key: const ValueKey('go'), onPressed: () {}, child: const Text('Submit')) : fm.ElevatedButton(key: const ValueKey('go'), onPressed: () {}, child: const Text('Submit')),
isMu ? const mu.ElevatedButton(key: ValueKey('off'), onPressed: null, child: Text('Disabled one')) : const fm.ElevatedButton(key: ValueKey('off'), onPressed: null, child: Text('Disabled one')),
isMu ? mu.TextField(key: const ValueKey('f'), controller: field) : fm.TextField(key: const ValueKey('f'), controller: field),
isMu ? mu.TextField(key: const ValueKey('pw'), obscureText: true, controller: pw) : fm.TextField(key: const ValueKey('pw'), obscureText: true, controller: pw),
isMu ? mu.Checkbox(key: const ValueKey('cb'), value: checked, onChanged: (v) {}) : fm.Checkbox(key: const ValueKey('cb'), value: checked, onChanged: (v) {}),
isMu ? mu.Switch(key: const ValueKey('sw'), value: sw, onChanged: (v) {}) : fm.Switch(key: const ValueKey('sw'), value: sw, onChanged: (v) {}),
isMu ? mu.IconButton(key: const ValueKey('ib'), tooltip: 'Add item', icon: const Icon(IconData(0xe047)), onPressed: () {}) : fm.IconButton(key: const ValueKey('ib'), tooltip: 'Add item', icon: const Icon(IconData(0xe047)), onPressed: () {}),
]);
await tester.pumpWidget(isMu ? muApp(body) : fmApp(body));
await tester.pumpAndSettle();
Future<void> rec(String step, String method, Map<String, dynamic> p) async => results.add('$lib | $step | ${await run(ex, sent, method, p)}');
await rec('see "Submit"', ProbeMethods.see, byText('Submit'));
await rec('tap "Submit"', ProbeMethods.tap, byText('Submit'));
await rec('see #go is enabled', ProbeMethods.see, byId('go', check: 'enabled'));
await rec('see #off is disabled', ProbeMethods.see, byId('off', check: 'disabled'));
await rec('see #off is enabled (should fail)', ProbeMethods.see, byId('off', check: 'enabled'));
await rec('type "x" into #f', ProbeMethods.type_, {'selector': {'kind': 'id', 'text': '#f'}, 'text': 'x'});
await rec('see #f contains "x"', ProbeMethods.see, {...byId('f', check: 'contains'), 'check_val': 'x'});
await rec('see #cb is checked', ProbeMethods.see, byId('cb', check: 'checked'));
await rec('see #sw is checked', ProbeMethods.see, byId('sw', check: 'checked'));
await rec('tap "Add item" (tooltip)', ProbeMethods.tap, byText('Add item'));
await rec('see #pw is filled', ProbeMethods.see, byId('pw', check: 'filled'));
await rec('see "hunter2" (must NOT find the password)', ProbeMethods.see, byText('hunter2'));
await rec('see #f is focused', ProbeMethods.see, byId('f', check: 'focused'));
});
}
testWidgets('cupertino_ui', (tester) async {
final sent = <String>[];
final ex = ProbeExecutor((m) => sent.add(m));
await tester.pumpWidget(mu.MaterialApp(home: mu.Scaffold(body: Column(children: [
cui.CupertinoTextField(key: const ValueKey('ct'), placeholder: 'Type here'),
cui.CupertinoSwitch(key: const ValueKey('cs'), value: true, onChanged: (v) {}),
]))));
await tester.pumpAndSettle();
results.add('cupertino_ui | type "x" into #ct | ${await run(ex, sent, ProbeMethods.type_, {'selector': {'kind': 'id', 'text': '#ct'}, 'text': 'x'})}');
results.add('cupertino_ui | see #ct contains "x" | ${await run(ex, sent, ProbeMethods.see, {...byId('ct', check: 'contains'), 'check_val': 'x'})}');
results.add('cupertino_ui | see #cs is checked | ${await run(ex, sent, ProbeMethods.see, byId('cs', check: 'checked'))}');
});
tearDownAll(() {
// ignore: avoid_print
print('\n=== RESULTS ===\n${results.join('\n')}\n=== END ===');
});
}
- Lingua principale
- Go
- Stelle
- 6
- Fork
- 3
- Merge medio
- 6h 28m
- PR unite (30g)
- 362
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AlphaWaveSystems/flutter-probe
-
agent: is checked on a wrapper holding several checkables answers from the first one in tree orderApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AlphaWaveSystems/flutter-probe#865 ·
I maintainer di solito rispondono entro 1 giorno
-
area/cli bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
AlphaWaveSystems/flutter-probe#424 ·
I maintainer di solito rispondono entro 1 giorno
-
area/docs documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
AlphaWaveSystems/flutter-probe#409 ·
I maintainer di solito rispondono entro 1 giorno
-
Dial timeout error should say how long it waited and name the timeout settingForse già presa @jay23606 l’ha presa 2 giorni fa. Apertaarea/cli bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AlphaWaveSystems/flutter-probe#408 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
AlphaWaveSystems/flutter-probe#888 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di AlphaWaveSystems/flutter-probe
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
fluxcd/notification-controller#1441 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
volcengine/volcengine-go-sdk#163 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
OneBusAway/maglev#2145 ·
I maintainer di solito rispondono entro 2 giorni
-
priority/medium status/ready type/chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
discobox-ai/discobox#1357 ·
I maintainer di solito rispondono entro 1 giorno