public TestDescriptionEditorViewModel(TestItem testItem)
        {
            this.testItem = testItem;
            testItem.DescriptionChanged += TestItemOnDescriptionChanged;

            DefaultDescriptionCommand = new DelegateCommand(ExecuteDefaultDescriptionCommand);
        }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.OnScreenAction;
     testItem.Operation = new SetVariableOperation();
     testItem.Test = test;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.Message;
     testItem.Operation = new LogMessageOperation {Message = "Default Message"};
     testItem.Test = test;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.Delay;
     testItem.Operation = new DelayOperation {Delay = 5};
     testItem.Test = test;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.BackgroundAction;
     testItem.Operation = createOpFunc();//new RunTestOperation();
     testItem.Test = test;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.BackgroundAction;
     testItem.Operation = new SetTableVariableFromFileOperation();
     testItem.Test = test;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.OnScreenAction;
     testItem.Operation = new LeftClickOperation();
     testItem.Test = test;
     return testItem;
 }
        protected override TestItem CreateOnScreenValidation()
        {
            TestItem onScreenValidation = new TestItem{Type = TestItemTypes.ValidateTextAtPoint};
            ValidateTextAtPointOperation operation = new ValidateTextAtPointOperation();

            onScreenValidation.Operation = operation;

            return onScreenValidation;
        }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.LogGroup;
     testItem.Operation = new LogGroupOperation {GroupName = "Log Group"};
     testItem.Test = test;
     testItem.SupportsChildren = true;
     return testItem;
 }
        public TestOperationEditorViewModel(TestItem testItem)
        {
            this.testItem = testItem;

            if (testItem.Type == TestItemTypes.OnScreenAction)
            {
                Operations = new[] {"Left Click", "Right Click", "Keyboard"};
            }
        }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.BackgroundAction;
     testItem.Operation = new IfOperation();
     testItem.Test = test;
     testItem.SupportsChildren = true;
     return testItem;
 }
 private TestItem CreateTestItem()
 {
     TestItem testItem = new TestItem();
     testItem.Type = TestItemTypes.DataDrivenLoop;
     testItem.Operation = new DataDrivenLoopOperation();
     testItem.Test = test;
     testItem.SupportsChildren = true;
     return testItem;
 }
示例#13
0
        public void EditTestItem(TestItem testItem)
        {
            CurrentTestItem = testItem;
            testItemEditorWindow = testItemEditorWindowFactory.Create();
            ITestItemEditorViewModel testItemEditorViewModel = testItemEditorViewModelFactory.Create(testItem);

            testItemEditorWindow.DataContext = testItemEditorViewModel;

            testItemEditorWindow.ShowDialog();
        }
        public TestParameterEditorViewModel(TestItem testItem, 
            IOperationParameterViewModelFactory operationParameterViewModelFactory)
        {
            this.testItem = testItem;
            this.operationParameterViewModelFactory = operationParameterViewModelFactory;
            if (testItem.Operation != null)
            {
                Parameters = testItem.Operation.Parameters
                    .Select(operationParameterViewModelFactory.Create)
                    .ToArray();
            }

            testItem.OperationChanged += TestItemOnOperationChanged;
        }
        public TestObjectEditorViewModel(TestItem testItem,
            IGetObjectScreenSelectionViewModelFactory getObjectScreenSelectionViewModelFactory)
        {
            this.testItem = testItem;
            this.getObjectScreenSelectionViewModelFactory = getObjectScreenSelectionViewModelFactory;

            SetObjectCommand = new DelegateCommand(ExeuteSetObjectCommand);

            if (testItem != null && testItem.Control != null)
            {
                SelectedObject = testItem.Control;
            }

            Objects = testItem.AppManager.Processes.ToArray();

            SetGetObjectViewModels();
        }
示例#16
0
        public TestItemViewModel(TestItem testItem, ITestItemController testItemController)
        {
            this.testItemController = testItemController;
            TestItem = testItem;
            ObservableCollection<ITestItemViewModel> testItemViewModels = new ObservableCollection<ITestItemViewModel>();
            ChildItems = testItemViewModels;

            EditObjectCommand = new DelegateCommand(ExecuteEditObjectCommand);
            EditOperationCommand = new DelegateCommand(ExecuteEditOperationCommand);
            EditParameterCommand = new DelegateCommand(ExeccuteEditParameterCommand);
            EditDescriptionCommand = new DelegateCommand(ExecuteEditDescriptionCommand);

            if (TestItem != null)
            {
                TestItem.OperationChanged += TestItemOnOperationChanged;
                TestItem.ParametersChanged += TestItemOnParametersChanged;
                TestItem.DescriptionChanged += TestItemOnDescriptionChanged;
                TestItem.ControlChanged += TestItemOnControlChanged;
            }
        }
        public TestItemEditorViewModel(TestItem testItem,
            ITestObjectEditorViewModelFactory testObjectEditorViewModelFactory,
            ITestOperationEditorViewModelFactory testOperationEditorViewModelFactory,
            ITestParameterEditorViewModelFactory testParameterEditorViewModelFactory,
            ITestDescriptionEditorViewModelFactory testDescriptionEditorViewModelFactory,
            ITestItemController testItemController,
            IRecordingController recordingController)
        {
            this.testItem = testItem;
            this.testItemController = testItemController;
            this.recordingController = recordingController;

            TestObjectEditorViewModel = testObjectEditorViewModelFactory.Create(testItem);
            TestOperationEditorViewModel = testOperationEditorViewModelFactory.Create(testItem);
            TestParameterEditorViewModel = testParameterEditorViewModelFactory.Create(testItem);
            TestDescriptionEditorViewModel = testDescriptionEditorViewModelFactory.Create(testItem);

            CancelCommand = new DelegateCommand(ExecuteCancelCommand);
            FinishCommand = new DelegateCommand(ExecuteFinishCommand);
            nextCommand = new DelegateCommand(ExecuteNextCommand, CanExeccuteNextCommand);
            NextCommand = nextCommand;
        }
        bool TestItemsContains(IList<TestItem> testItems, TestItem testItem)
        {
            if (testItems.Contains(testItem))
                return true;

            foreach (var item in testItems)
            {
                if (TestItemsContains(item.TestItems, testItem))
                    return true;
            }

            return false;
        }
        private void GetTestItems(IEnumerable<ITestItemViewModel> testItemViewModels, List<TestItem> testItems, TestItem parentTestItem)
        {
            TestItem newParentTestItem = parentTestItem;
            foreach (ITestItemViewModel testItemViewModel in testItemViewModels)
            {
                if (testItemViewModel.TestItem != null )
                {
                    testItemViewModel.TestItem.TestItems = new ObservableCollection<TestItem>();
                    newParentTestItem = testItemViewModel.TestItem;

                    if (parentTestItem != null)
                        parentTestItem.TestItems.Add(testItemViewModel.TestItem);
                    else
                    {

                        testItems.Add(newParentTestItem);
                    }
                }
                else
                {
                    //newParentTestItem = null;
                }
                GetTestItems(testItemViewModel.ChildItems, testItems, newParentTestItem);
            }
        }
 public ITrainingItemViewModel Create(TestItem testItem)
 {
     return createModelFunc(testItem);
 }
 public ITestItemViewModel Create(TestItem testItem)
 {
     return createViewModelFunc(testItem);
 }
示例#22
0
        private void MouseHookListenerOnMouseDown(object sender, MouseEventArgs mouseEventArgs)
        {
            mouseDownMouseEventArgs = mouseEventArgs;

            IUIItem whiteControl;
            TestItem action = CreateOnScreenAction(mouseEventArgs, out whiteControl, false);

            AutomationElement findWindowElement = FindWindowElement(whiteControl);

            int processId = findWindowElement.Current.ProcessId;

            if (Process.GetCurrentProcess().Id == processId)
            {
                currentUiItem = null;
                mouseActionFromDown = null;
                return;
            }

            mouseActionFromDown = action;
            currentUiItem = whiteControl;

            action.Screenshot = CreateNewScreenshot(findWindowElement.Current.NativeWindowHandle);

            if (currentInputType == InputType.Keyboard)
            {
                if (keyboardHelper.KeyboardText != "")
                {
                    CreateKeyboardOnScreenAction(keyboardHelper.KeyboardText);
                    keyboardHelper.ResetKeyboardText();
                }

            }

            currentInputType = InputType.Mouse;

            //throw new NotImplementedException();
        }
示例#23
0
        private TestItem CreateOnScreenAction(MouseEventArgs mouseEventArgs, out IUIItem whiteControl, bool takeScreenshot = true)
        {
            TestItem action = new TestItem { Type = TestItemTypes.OnScreenAction };
            MappedItem mappedItem = null;

            whiteControl = CreateWhiteControl(mouseEventArgs.Location, ref mappedItem);
            currentMappedItem = mappedItem;
            action.ControlId = mappedItem.Id;

            if (ScreenshotsEnabled && takeScreenshot)
            {
                Screenshot screenshot = CreateNewScreenshot();
                action.Screenshot = screenshot;
            }

            return action;
        }
 public ITestParameterEditorViewModel Create(TestItem testItem)
 {
     return createModelFunc(testItem);
 }
 public void DoValidation(TestItem onScreenValidation)
 {
     onScreenValidation.Test = recorder.CurrentTest;
     testItemController.EditTestItem(onScreenValidation);
 }
 public TrainingItemViewModel(TestItem testItem)
 {
     this.testItem = testItem;
 }
示例#27
0
        private TestItem CreateOnScreenAction()
        {
            TestItem action = new TestItem{Type = TestItemTypes.OnScreenAction};

            if (ScreenshotsEnabled)
            {
                Screenshot screenshot = CreateScreenshotFromCurrentBitmap();

                action.Screenshot = screenshot;
            }

            return action;
        }
        private void AddTestItemEventHandler(TestItem testItem)
        {
            if (SelectedTestItem != null && SelectedTestItem.TestItem != null)
            {
                int index = test.TestItems.IndexOf(SelectedTestItem.TestItem);
                test.TestItems.Insert(index, testItem);
            }
            else
            {
                test.TestItems.Add(testItem);
            }

            RefreshTestItems();

            SelectedTestItem = TestItems.FirstOrDefault(t => t.TestItem == testItem);

            /*
            ITestItemViewModel testitemViewModel = testItemViewModelFactory.Create(testItem);
            testItem.Test = test;

            if (SelectedTestItem == null)
            {
                TestItems.Add(testitemViewModel);
                return;
            }

            int index = TestItems.IndexOf(SelectedTestItem);

            if (index >=0)
            {
                TestItems.Insert(index, testitemViewModel);
                return;
            }

            ITestItemViewModel testItemViewModel = GetParent(SelectedTestItem);

            index = testItemViewModel.ChildItems.IndexOf(SelectedTestItem);

            testItemViewModel.ChildItems.Insert(index, testitemViewModel);*/
        }
 public ITestDescriptionEditorViewModel Create(TestItem testItem)
 {
     return createModelFunc(testItem);
 }
 public ITestObjectEditorViewModel Create(TestItem testItem)
 {
     return createModelFunc(testItem);
 }