Exemple #1
0
 public void DoJAction(string actionName, Action <WebBaseElement> action, LogLevels level = LogLevels.Info)
 {
     TimerExtensions.ForceDone(() => {
         ProcessDemoMode();
         ActionScenarios.ActionScenario(_element, actionName, action, level);
     });
 }
Exemple #2
0
 public TResult DoJActionResult <TResult>(string actionName, Func <WebBaseElement, TResult> action,
                                          Func <TResult, string> logResult = null, LogLevels level = LogLevels.Info)
 {
     return(ActionWithException(() =>
     {
         ProcessDemoMode();
         return (TResult)ActionScenarios.ResultScenario(_element, actionName,
                                                        element =>
         {
             var result =
                 ActionWithException(() => new Timer(JDISettings.Timeouts.CurrentTimeoutSec)
                                     .GetResultByCondition(() => action.Invoke(element), res => true),
                                     ex => $"Do action {actionName} failed. Can't got result. Reason: {ex}");
             if (result == null)
             {
                 throw JDISettings.Exception($"Do action {actionName} failed. Can't got result");
             }
             return logResult == null
                     ? result.ToString()
                     : logResult.Invoke(result);
         },
                                                        level);
     }, ex => $"Failed to do '{actionName}' action. Reason: {ex}"));
 }