예제 #1
0
        private void PopulateCriteriaByType(SearchCriteria criteria, string fieldValue)
        {
            string fieldType = criteria.GetString(true);

            if (fieldType.Equals(TEXT))
            {
                if (criteria.Equals(SearchCriteria.MSLNo))
                {
                    EnterCriteria_MSLNumber(fieldValue);
                }
                else if (criteria.Equals(SearchCriteria.DocumentType))
                {
                    SelectDDL_DocumentType(fieldValue);
                    EnterCriteria_Number(fieldValue);
                }
                else
                {
                    PageAction.EnterText(By.Id(criteria.GetString()), fieldValue);
                }
            }
            else if (fieldType.Equals(DATE))
            {
                EnterDate_From(GetPastShortDate(fieldValue));
                EnterDate_To(fieldValue);
            }
            else if (fieldType.Equals(DDL) || fieldType.Equals(MULTIDDL))
            {
                if (criteria.Equals(SearchCriteria.DocumentType))
                {
                    fieldValue = $"-- {fieldValue}";
                }

                bool isMultiselectDDList = false;

                if (fieldType.Equals(MULTIDDL))
                {
                    isMultiselectDDList = true;
                }

                PageAction.ExpandAndSelectFromDDList(criteria, fieldValue, true, isMultiselectDDList);
            }
        }
예제 #2
0
        private KeyValuePair <EntryFieldType, string> PopulateFieldValue <T>(EntryFieldType entryField, T indexOrText, bool useContains = false)
        {
            string fieldType  = entryField.GetString(true);
            Type   argType    = indexOrText.GetType();
            object argValue   = null;
            bool   isValidArg = false;

            KeyValuePair <EntryFieldType, string> fieldValuePair;
            string fieldValue = string.Empty;

            try
            {
                if (argType == typeof(string))
                {
                    isValidArg = true;
                    argValue   = ConvertToType <string>(indexOrText);
                }
                else if (argType == typeof(int))
                {
                    isValidArg = true;
                    argValue   = ConvertToType <int>(indexOrText);
                }

                if (isValidArg)
                {
                    switch (fieldType)
                    {
                    case TEXT:
                    case DATE:
                    case FUTUREDATE:
                        if (!((string)argValue).HasValue())
                        {
                            if (fieldType.Equals(DATE) || fieldType.Equals(FUTUREDATE))
                            {
                                argValue = fieldType.Equals(DATE)
                                        ? GetShortDate()
                                        : GetFutureShortDate();
                            }
                            else
                            {
                                //argValue = GetVarForEntryField(entryField);
                                argValue = GetVar(entryField);
                                int argValueLength = ((string)argValue).Length;

                                By  inputLocator  = GetInputFieldByLocator(entryField);
                                int elemMaxLength = int.Parse(PageAction.GetAttribute(inputLocator, "maxlength"));

                                argValue = argValueLength > elemMaxLength
                                        ? ((string)argValue).Substring(0, elemMaxLength)
                                        : argValue;
                            }

                            fieldValue = (string)argValue;
                        }

                        PageAction.EnterText(By.Id(entryField.GetString()), fieldValue);

                        break;

                    case DDL:
                    case MULTIDDL:
                        if ((argType == typeof(string) && !((string)argValue).HasValue()) || (int)argValue < 1)
                        {
                            argValue = 1;
                        }

                        bool isMultiselectDDList = false;

                        if (fieldType.Equals(MULTIDDL))
                        {
                            isMultiselectDDList = true;
                        }

                        PageAction.ExpandAndSelectFromDDList(entryField, argValue, useContains, isMultiselectDDList);

                        break;

                    case RDOBTN:
                    case CHKBOX:
                        PageAction.SelectRadioBtnOrChkbox(entryField);

                        break;

                    case UPLOAD:
                        PageAction.UploadFile();

                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    log.Error($"Argument type ({argType}) is not supported : {indexOrText.ToString()}");
                }
            }
            catch (Exception e)
            {
                log.Error(e.StackTrace);
            }

            return(fieldValuePair = new KeyValuePair <EntryFieldType, string>(entryField, fieldValue));
        }
예제 #3
0
 public virtual void SelectDDL_SegmentArea <T>(T itemIndexOrName) => PageAction.ExpandAndSelectFromDDList(SearchCriteria.SegmentArea, itemIndexOrName);
예제 #4
0
 //Used only in GLX
 public virtual void SelectDDL_Category <T>(T itemIndexOrName) => PageAction.ExpandAndSelectFromDDList(SearchCriteria.Category, itemIndexOrName);
예제 #5
0
 public virtual void SelectDDL_Status <T>(T itemIndexOrName) => PageAction.ExpandAndSelectFromDDList(SearchCriteria.Status, itemIndexOrName);
예제 #6
0
 //Page workflow common to all tenants
 public virtual void SelectDDL_DocumentType <T>(T itemIndexOrName) => PageAction.ExpandAndSelectFromDDList(SearchCriteria.DocumentType, itemIndexOrName);