public void Setup() { // This is an attempt to get around a suspected race condition with 'ext.flutter.driver' not existing in the ExtensionRPCs // This only happens on startup (and mostly in the CI/CD) - so retry until we get a successful deployment // // TODO: Root cause this properly through Appium and logcat var numberOfRetryAttempts = ReadEnvironmentVariable("TESTAPP_RESTART_ATTEMPTS", 1); System.Console.WriteLine($"Number of retry attempts: {numberOfRetryAttempts}"); foreach (var currentAttempt in Enumerable.Range(1, numberOfRetryAttempts)) { try { Console.WriteLine($"Start Attempt: {currentAttempt}"); FlutterDriver = StartApplication(); break; } catch (Exception ex) { Console.WriteLine($"ERROR: Starting attempt {currentAttempt}"); Console.WriteLine($"ERROR: {ex}"); if (currentAttempt == numberOfRetryAttempts) { throw; } } } }
public void SetupFlutterMobileTest() { IWrapsDriver wrapsDriver = WebDriver as IWrapsDriver; var remoteWebDriver = wrapsDriver?.WrappedDriver as RemoteWebDriver; if (null == remoteWebDriver) { throw new System.InvalidOperationException($"FlutterDriver is intended to wrap AppiumDrivers"); } FlutterDriver = new FlutterDriver(remoteWebDriver, Resolve <ICommandExecutor>(), Resolve <IControlSettings>().WaitUntilTimeoutInSeconds); }