waitUntilVisible method

Future<void> waitUntilVisible(
  1. CompoundSelector selector, {
  2. String? appId,
  3. Duration? timeout,
})

Waits until the native view specified by selector becomes visible.

appId is only used on iOS, where native queries must be scoped to a single application. If not provided, defaults to the bundle id of the app under test.

Implementation

Future<void> waitUntilVisible(
  CompoundSelector selector, {
  String? appId,
  Duration? timeout,
}) {
  return platform.action.mobile(
    android: () =>
        platform.android.waitUntilVisible(selector.android, timeout: timeout),
    ios: () => platform.ios.waitUntilVisible(
      selector.ios,
      appId: appId,
      timeout: timeout,
    ),
    desktop: () async {
      final visible = await platform.desktop.isElementVisible(
        name: selector.android.text,
        className: selector.android.className,
      );
      if (!visible) {
        throw Exception('Element not visible: ${selector.android.text}');
      }
    },
  );
}