示例#1
0
        public void CreateDuplicationAction()
        {
            //Arrange
            ActUIElement actGotoURL = new ActUIElement();

            actGotoURL.Description = "www.google.com";

            //Act
            ActUIElement a2 = (ActUIElement)actGotoURL.CreateCopy();

            //Assert
            Assert.AreEqual(actGotoURL.Description, a2.Description);
        }
示例#2
0
        public ActUIElement CreateActUIElementObject(String descriptionString, String DescriptionValue, String rowVal, String colVal, String LocateRowType)
        {
            ActUIElement a = (ActUIElement)mAct.CreateCopy();

            a.Description = descriptionString + DescriptionValue;
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, mAct.GetInputParamValue(ActUIElement.Fields.ControlAction));
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ColSelectorValue.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateColTitle, colVal.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, LocateRowType);
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowValue, rowVal.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRowNum, RowNum.IsChecked.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByRandRow, AnyRow.IsChecked.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.BySelectedRow, BySelectedRow.IsChecked.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.ByWhere, Where.IsChecked.ToString());
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector));
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle));
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue));
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator));
            a.AddOrUpdateInputParamValue(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty));

            return(a);
        }
        private void UpdateRelatedActions()
        {
            string previousSelectedControlAction = null;

            if (mActions != null)
            {
                if (mActions.CurrentItem != null)
                {
                    if (mActions.CurrentItem is ActUIElement)
                    {
                        previousSelectedControlAction = ((ActUIElement)mActions.CurrentItem).GetOrCreateInputParam(ActUIElement.Fields.ControlAction).ToString();
                    }
                }

                mActions.Clear();
            }

            if (cmbColSelectorValue.ComboBox.SelectedIndex != -1)
            {
                mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.ColSelectorValue, ((GingerCore.General.ComboEnumItem)cmbColSelectorValue.ComboBox.SelectedItem).Value.ToString());
            }

            string description = "";
            string rowVal      = "";
            string colVal      = "";

            if (RowNum.IsChecked == true)
            {
                mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Row Number");
                if (RowSelectorValue != null)
                {
                    if (RowSelectorValue.ComboBox.SelectedIndex != -1)
                    {
                        rowVal = RowSelectorValue.ComboBox.SelectedItem.ToString();
                    }
                    else
                    {
                        rowVal = RowSelectorValue.ComboBox.Text;
                    }
                    description = " on Row:" + rowVal;
                }
            }
            else if (AnyRow.IsChecked == true)
            {
                mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Any Row");
                description = " on Random Row";
            }
            else if (BySelectedRow.IsChecked == true)
            {
                mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "By Selected Row");
                description = " on Selected Row";
            }
            else if (Where.IsChecked == true)
            {
                mAct.AddOrUpdateInputParamValue(ActUIElement.Fields.LocateRowType, "Where");
                description = " on Row with condition";
            }

            if (cmbColumnValue != null)
            {
                if (cmbColumnValue.ComboBox.SelectedIndex != -1)
                {
                    colVal = cmbColumnValue.ComboBox.SelectedItem.ToString();
                }
                else
                {
                    colVal = cmbColumnValue.ComboBox.Text;
                }
                description = description + " and Column:" + colVal;
            }

            if (eBaseWindow.Equals(BaseWindow.WindowExplorer) && cmbColSelectorValue.ComboBox.SelectedIndex != -1 && WhereColumn != null && WhereColumn.ComboBox.SelectedIndex != -1 && RowSelectorValue != null &&
                WhereProperty != null && WhereProperty.ComboBox.SelectedIndex != -1 && WhereOperator != null && WhereOperator.ComboBox.SelectedIndex != -1)
            {
                List <string> descriptionString = new List <string>();
                descriptionString.Add("Get Value of Cell: ");
                descriptionString.Add("Set Value of Cell: ");
                descriptionString.Add("Type Value in Cell: ");
                descriptionString.Add("Click Cell: ");
                descriptionString.Add("WinClick Cell: ");
                descriptionString.Add("Get Selected Cell from Column: ");

                ActUIElement actObj = (ActUIElement)mAct.CreateCopy();
                actObj.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.SetValue.ToString());
                actObj.Description = "Set Value of Cell: " + description;
                actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector));
                actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle));
                actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue));
                actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator));
                actObj.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty));
                mActions.Add(actObj);


                ActUIElement actObj1 = (ActUIElement)mAct.CreateCopy();;
                actObj1.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.GetValue.ToString());
                actObj1.Description = "Get Value of Cell: " + description;
                actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector));
                actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle));
                actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue));
                actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator));
                actObj1.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty));
                mActions.Add(actObj1);


                ActUIElement actObj2 = (ActUIElement)mAct.CreateCopy();;
                actObj2.AddOrUpdateInputParamValue(ActUIElement.Fields.ControlAction, ActUIElement.eElementAction.Click.ToString());
                actObj2.Description = "Click Cell: " + description;
                actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, mAct.GetInputParamValue(ActUIElement.Fields.WhereColSelector));
                actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle));
                actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, mAct.GetInputParamValue(ActUIElement.Fields.WhereColumnValue));
                actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, mAct.GetInputParamValue(ActUIElement.Fields.WhereOperator));
                actObj2.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, mAct.GetInputParamValue(ActUIElement.Fields.WhereProperty));
                mActions.Add(actObj2);
            }
            if (previousSelectedControlAction != null)
            {
                if (mActions != null)
                {
                    foreach (ActUIElement act in mActions)
                    {
                        if (act.GetOrCreateInputParam(ActUIElement.Fields.ControlAction).ToString() == previousSelectedControlAction)
                        {
                            mActions.CurrentItem = act;
                            break;
                        }
                    }
                }
            }
            if (mActions != null && mActions.CurrentItem == null && mActions.Count > 0)
            {
                mActions.CurrentItem = mActions[0];
            }
        }