Unverified Commit ad612b59 authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Dump app on keyboard_textfield_test timeout (#98305)

parent 5515400a
...@@ -62,10 +62,11 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -62,10 +62,11 @@ class _MyHomePageState extends State<MyHomePage> {
Text('$offset', Text('$offset',
key: const ValueKey<String>(keys.kOffsetText), key: const ValueKey<String>(keys.kOffsetText),
), ),
if (isSoftKeyboardVisible) const Text( Text(
'keyboard visible', isSoftKeyboardVisible ? 'keyboard visible' : 'keyboard hidden',
key: ValueKey<String>(keys.kKeyboardVisibleView), key: const ValueKey<String>(keys.kKeyboardVisibleView),
), ),
const ElevatedButton(onPressed: debugDumpApp, child: Text('dump app')),
Expanded( Expanded(
child: ListView( child: ListView(
key: const ValueKey<String>(keys.kListView), key: const ValueKey<String>(keys.kListView),
......
...@@ -40,8 +40,23 @@ void main() { ...@@ -40,8 +40,23 @@ void main() {
// Bring up keyboard // Bring up keyboard
await driver.tap(textFieldFinder); await driver.tap(textFieldFinder);
const int keyboardTimeout = 3;
bool keyboardVisible = false;
for (int i = 0; i < keyboardTimeout; i++) {
await Future<void>.delayed(const Duration(seconds: 1));
final String keyboardVisibilityText = await driver.getText(keyboardVisibilityIndicatorFinder);
keyboardVisible = keyboardVisibilityText == 'keyboard visible';
if (keyboardVisible) {
break;
}
}
if (!keyboardVisible) {
await driver.tap(find.text('dump app'));
}
// TODO(jmagman): Remove timeout once flake has been diagnosed. https://github.com/flutter/flutter/issues/96787 // TODO(jmagman): Remove timeout once flake has been diagnosed. https://github.com/flutter/flutter/issues/96787
await driver.waitFor(keyboardVisibilityIndicatorFinder, timeout: const Duration(seconds: 5)); expect(keyboardVisible, isTrue);
// Ensure that TextField is visible again // Ensure that TextField is visible again
await driver.waitFor(textFieldFinder); await driver.waitFor(textFieldFinder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment