Esempio n. 1
0
 /// <summary>
 /// Can be called to wait for IsLoaded to fire.
 /// </summary>
 /// <returns>TView</returns>
 public virtual TView WaitToLoad()
 {
     try
     {
         if (IsLoaded())
         {
             return(this as TView);            // Load, so just immediately return this
         }
         var doNothing = new LambdaBrowserAction(() => {}, _NONE);
         var predicate = new LambdaPredicateQuery(IsLoaded, _NONE);
         _browserScope.TryUntil(doNothing, predicate);
     }
     catch (Exception e)
     {
         throw new ZukiniAssertionException($"Expected '{typeof(TView)}' failed to load.\nReason: {e}");
     }
     return(this as TView);
 }
        public void WaitProcessing(DriverScope scope)
        {
            // Wait until progress bar disappears during timeout
            var timeout = TimeSpan.FromSeconds(double.Parse(ConfigurationManager.AppSettings["Timeout"]));

            try
            {
                if (scope is BrowserWindow)
                {
                    scope.TryUntil(() => { Thread.Sleep(1000); }, () => (bool)((BrowserWindow)scope).ExecuteScript("if ($ === undefined) { return true } else { return $('body.cursorWait').length === 0 && $('#callbackFeedback.callbackFeedback').length === 0}"), timeout);
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(string.Format("JS processing is not finished for '{0}'.", timeout), exp);
            }

            // Wait 1 seconds to allow UI rendered
        }