public override bool Play(MappedItem mappedItem, Log log) { string text = textParam.GetValue(); Keyboard.SendKeys(text); AppProcess process = AppManager.GetProcess(mappedItem); MappedItem window = AppManager.GetWindow(mappedItem); IUIItem uiItem = AppPlaybackService.GetControl(process, window, mappedItem, AppManager); AutomationElement findWindowElement = uiItem.AutomationElement; while (findWindowElement.Current.LocalizedControlType != "window" && !(findWindowElement.Current.LocalizedControlType == "pane" && TreeWalker.ControlViewWalker.GetParent(findWindowElement).Current.LocalizedControlType == "process")) { findWindowElement = TreeWalker.ControlViewWalker.GetParent(findWindowElement); } Screenshot screenshot = CreateScreenshot(log, findWindowElement.Current.NativeWindowHandle); screenshot.Adornments.Add( new ControlHighlightAdornment { X = (int)uiItem.Bounds.X - (int)findWindowElement.Current.BoundingRectangle.X, Y = (int)uiItem.Bounds.Y - (int)findWindowElement.Current.BoundingRectangle.Y, Width = (int)uiItem.Bounds.Width, Height = (int)uiItem.Bounds.Height }); string description = string.Format("The text '{0}' was entered in {1}", text, mappedItem.Name); log.CreateLogItem(LogItemCategory.Event, description, screenshot); return true; }
public override bool Play(MappedItem control, Log log) { Variable variable = this.TestItem.Test.Variables.FirstOrDefault(v => v.Name.Equals(variableParam.Value)); variable.Value = valueParam.GetValue(); log.CreateLogItem(LogItemCategory.Message, string.Format("Variable '{0}' was set to value: {1}", variable.Name, variable.Value)); return true; }
public void ShowLog(Log log) { ILogMainShellViewModel logMainShellViewModel = logMainShellViewModelFactory.Create(log); IViewWithDataContext logMainShellView = logMainShellViewFactory.Create(); logMainShellView.DataContext = logMainShellViewModel; regionManager.Regions[Regions.WorkspaceViewRegion].AddAndActivate(logMainShellView); }
public override bool Play(MappedItem control, Log log) { log.CreateLogItem(LogItemCategory.Event, nameParameter.GetValue()); log.StartLogItemChildren(); foreach (TestItem testItem in TestItem.TestItems) { if (!testItem.Play(log)) return false; } log.EndLogItemChildren(); return true; }
public override bool Play(MappedItem control, Log log) { VariableOperationParameterValue variableOperationParameterValue = variableParameter.ParameterValue as VariableOperationParameterValue; Variable variable = variableOperationParameterValue.GetVariable(); variable.CurrentTableRow = 0; for (int i = 0; i < variable.DataTableValue.Rows.Count; i++) { foreach (TestItem testItem in TestItem.TestItems) { if (!testItem.Play(log)) return false; } variable.CurrentTableRow++; } variable.CurrentTableRow = 0; return true; }
public override bool Play(MappedItem mappedItem, Log log) { AppProcess process = AppManager.GetProcess(mappedItem); MappedItem window = AppManager.GetWindow(mappedItem); IUIItem uiItem = AppPlaybackService.GetControl(process, window, mappedItem, AppManager); AutomationElement findWindowElement = ExternalAppInfoManager.GetWindowAutomationElement(uiItem); Point clickPoint = this.GetClickPoint(CreateScreenshot(log, findWindowElement.Current.NativeWindowHandle, false)); Point globalPoint = new Point((int)uiItem.Bounds.X + clickPoint.X, (int)uiItem.Bounds.Y + clickPoint.Y); Cursor.Position = globalPoint; Screenshot screenshot = CreateScreenshot(log, findWindowElement.Current.NativeWindowHandle); screenshot.Adornments.Add( new ControlHighlightAdornment { X = (int)uiItem.Bounds.X - (int)findWindowElement.Current.BoundingRectangle.X, Y = (int)uiItem.Bounds.Y - (int)findWindowElement.Current.BoundingRectangle.Y, Width = (int)uiItem.Bounds.Width, Height = (int)uiItem.Bounds.Height }); Cursor.RightClick(globalPoint); string description = string.Format("The {0} was clicked with the left mouse button", mappedItem.Type); log.CreateLogItem(LogItemCategory.Event, description, screenshot); int screenshotX = globalPoint.X - (int)findWindowElement.Current.BoundingRectangle.X; int screenshotY = globalPoint.Y - (int)findWindowElement.Current.BoundingRectangle.Y; screenshot.Adornments.Add(new ClickAdornment { ClickX = screenshotX, ClickY = screenshotY }); return true; }
public LogScreenshotsViewModel(Log log) { Screenshots = log.LogItems.Where(t => t.HasScreenshot) .Select(t => t.Screenshot).ToArray(); }
protected virtual void ExecuteDefaultCommand() { log = logFileManager.Open(logFile.FilePath); log.Owner = logFile.Project; logController.ShowLog(log); }
public LogShellViewModel(Log log, ILogDetailsViewModelFactory logDetailsViewModelFactory) { LogDetailsViewModel = logDetailsViewModelFactory.Create(log); }