Exemplo n.º 1
0
        public static bool EnrollAPatient(string PatientID, EnrollPatientData PatientData)
        {
            bool isEnrollSuccessful = false;

            if (Control_PropertyUtilities.GetText(DL_PatientsPage.SelectedPatient) != PatientID)
            {
                Control_ActionUtilities.LogException("Verification of Patient on selecting a patient.", "Patient detail is not displayed as " + PatientID + " on the screen.", string.Empty);
                return(false);
            }
            string status = Control_PropertyUtilities.GetText(DL_PatientsPage.SelectedPatientStatus);

            if (status != "Screened")
            {
                Control_ActionUtilities.LogException("Verification of Patient status on patient details screen.", "Patient status detail is displayed as " + status + " on the screen.", string.Empty);
                return(false);
            }
            if (BP_ActionPaletteUtilities.InvokeActionPaletteLink("Enroll Patient", DL_PatientsPage.GetPatientActionPaletteID("Patient Actions")))
            {
                if (FillEnrollPatientCRF(PatientData))
                {
                    //Control_ActionUtilities.Click(DL_PatientsPage.EntryCompleteChkBox, "Unable to select Entry Complete checkbox.");
                    isEnrollSuccessful = Control_ActionUtilities.SubmitSaveNCloseButton(DL_CRFPage.SaveNCloseButton_CRF, "Unable to Enroll patient.");
                }
            }
            if (isEnrollSuccessful)
            {
                status = Control_PropertyUtilities.GetText(DL_PatientsPage.SelectedPatientStatus);
                if (status != "Enrolled")
                {
                    isEnrollSuccessful = false;
                }
            }
            return(isEnrollSuccessful);
        }
Exemplo n.º 2
0
 public static bool VerifyTagsInXMLFile(string FileName, List <XMLData> TagsTable)
 {
     try
     {
         XmlDocument xmlDoc   = new XmlDocument();
         string      FilePath = GetXMLFilePath(FileName);
         xmlDoc.Load(FilePath);
         XmlNodeList nodes = xmlDoc.SelectNodes("//*");
         if (nodes.Count != TagsTable.Count)
         {
             Control_ActionUtilities.LogException("Verification of tags in XML file.", "Tags count in test input is not matching with tags in XML file.", string.Empty);
             return(false);
         }
         int counter = 0;
         foreach (XmlNode node in nodes)
         {
             if (node.Name.Trim() != TagsTable[counter].TagName.Trim())
             {
                 Control_ActionUtilities.LogException("Verification of tags in XML file.", "Tags in test input is not matching with tags in XML file.", string.Empty);
                 return(false);
             }
             counter++;
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public static bool AddCommentsToAFlatQuestion(string QuestionPrompt, string Comments)
 {
     try
     {
         if (SelectAddCommentElementForFlatQuestion(QuestionPrompt))
         {
             BrowserUtilities.SwitchToFrame();
             string QuestText = Control_PropertyUtilities.GetText(DL_CRFPage.GetQuestionOnAddCommentModal);
             if (!QuestText.Contains(QuestionPrompt))
             {
                 Control_ActionUtilities.LogException("Verify question prompt on add comments modal.", "Question is not displayed correctly", string.Empty);
                 return(false);
             }
             IControl CommentsTextBox = DL_CRFPage.GetTextAreaOnAddCommentModal;
             Control_ActionUtilities.Textbox_SetText(CommentsTextBox, Comments, "Unable to set comments for the question " + QuestionPrompt);
             IControl SaveButton = DL_CRFPage.GetButtonOnAddCommentModal("Save");
             Control_ActionUtilities.ClickModalButton(SaveButton);
             BrowserUtilities.SwitchToWindow();
             return(true);
         }
     }
     catch (Exception e)
     {
         new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
     }
     return(false);
 }
Exemplo n.º 4
0
 public static bool VerifyAttributesInExpectedAndActualXMLNodes(XmlNode ExpNode, XmlNode ActNode, string TagName)
 {
     try
     {
         XmlAttributeCollection ExpAttCol = ExpNode.Attributes;
         XmlAttributeCollection ActAttCol = ActNode.Attributes;
         if (ExpAttCol.Count != ActAttCol.Count)
         {
             Control_ActionUtilities.LogException("Verification of attributes in xml tag", "Number of attributes/fields for " + TagName + " in expected and actual xml data files is not matching.", string.Empty);
             return(false);
         }
         foreach (XmlAttribute expAtt in ExpAttCol)
         {
             string       ExpAttName = expAtt.Name;
             XmlAttribute ActAtt     = ActNode.Attributes[ExpAttName];
             if (ActAtt != null)
             {
                 if (ActAtt.Value != expAtt.Value)
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 5
0
 public static bool CompareDataIn2XMLFiles(string xmlFileNameFromProject, string xmlFileNameFromTestFolder, List <string> TagsToExclude, List <string> FieldsToExclude, out string FailMsg)
 {
     FailMsg = "";
     try
     {
         string      ActTagName, ExpTagName;
         XmlDocument xmlDocFromProject    = LoadAndGetXMLDocFromProject(xmlFileNameFromProject);
         XmlDocument xmlDocFromTestFolder = LoadAndGetXMLDocFromFileLocation(xmlFileNameFromTestFolder);
         if (xmlDocFromProject != null && xmlDocFromTestFolder != null)
         {
             XmlNodeList nodes1 = xmlDocFromProject.SelectNodes("//*");
             XmlNodeList nodes2 = xmlDocFromTestFolder.SelectNodes("//*");
             if (nodes1.Count != nodes2.Count)
             {
                 Control_ActionUtilities.LogException("Verification of data in XML files", "Number of tags in actual and expected XML files is not matching.", string.Empty);
                 FailMsg = "Number of tags in actual and expected XML files is not matching.";
                 return(false);
             }
             for (int counter = 0; counter < nodes1.Count; counter++)
             {
                 ActTagName = nodes1[counter].Name;
                 ExpTagName = nodes2[counter].Name;
                 if (!TagsToExclude.Contains(ActTagName) && (ActTagName == ExpTagName))
                 {
                     if (!VerifyAttributesInExpectedAndActualXMLNodes(nodes1[counter], nodes2[counter], FieldsToExclude))
                     {
                         FailMsg = "Fields in tag " + ActTagName + " are not matching.";
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Control_ActionUtilities.LogException("Verification of data in XML files", "XML file is not loaded properly.", string.Empty);
             FailMsg = "XML file is not loaded properly..";
             return(false);
         }
     }
     catch (Exception e)
     {
         new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
         return(false);
     }
 }
Exemplo n.º 6
0
 public static bool CompareNodesCountInExpectedAndActualXMLs(XmlNodeList ExpNodesList, XmlNodeList ActNodeList, string TagName)
 {
     if (ExpNodesList.Count == 0)
     {
         Control_ActionUtilities.LogException("Verification of data in actual and expected xml files.", "The tag " + TagName + " is not displayed in expected XML data file.", string.Empty);
         return(false);
     }
     if (ActNodeList.Count == 0)
     {
         Control_ActionUtilities.LogException("Verification of data in actual and expected xml files.", "The tag " + TagName + " is not displayed in actual XML data file.", string.Empty);
         return(false);
     }
     if (ExpNodesList.Count != ActNodeList.Count)
     {
         Control_ActionUtilities.LogException("Verification of data in actual and expected xml files.", "The number of tags " + TagName + " is not matching in expected and actual XML data files.", string.Empty);
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
 public static bool VerifyTagsInXMLFile(string xmlFileNameFromProject, string xmlFileNameFromTestFolder)
 {
     try
     {
         XmlDocument xmlDocFromProject    = LoadAndGetXMLDocFromProject(xmlFileNameFromProject);
         XmlDocument xmlDocFromTestFolder = LoadAndGetXMLDocFromProject(xmlFileNameFromTestFolder);
         if (xmlDocFromProject != null && xmlDocFromTestFolder != null)
         {
             XmlNodeList nodes1 = xmlDocFromProject.SelectNodes("//*");
             XmlNodeList nodes2 = xmlDocFromTestFolder.SelectNodes("//*");
             if (nodes1.Count != nodes2.Count)
             {
                 Control_ActionUtilities.LogException("Verification of tags in XML file.", "Tags count in XML file in project and XML file in test location are not matching.", string.Empty);
                 return(false);
             }
             int counter = 0;
             foreach (XmlNode node in nodes1)
             {
                 if (node.Name.Trim() != nodes2[counter].Name.Trim())
                 {
                     Control_ActionUtilities.LogException("Verification of tags in XML file.", "Tags in XML file in project and XML file in test location are not matching.", string.Empty);
                     return(false);
                 }
                 counter++;
             }
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         new DebugLogGenerator().WriteException(MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, e);
         return(false);
     }
 }
        public static void AddCommentsToTableQuestionsInCRF(string TableName, List <AddCommentsForQuestion> QuestionData)
        {
            string PrevRow = "";

            foreach (AddCommentsForQuestion Data in QuestionData)
            {
                int      rowNumber = Convert.ToInt32(Data.RowNumber);
                IControl Table     = DL_CRFPage.GetTableInCRF(TableName, rowNumber);
                if (Table != null && Table.WebElement != null)
                {
                    IControl TableRow = DL_CRFPage.GetRowOfTableInCRF(Table, Data.RowNumber);
                    if (TableRow != null && TableRow.WebElement != null)
                    {
                        if (PrevRow != Data.RowNumber)
                        {
                            ExpandTableRow(TableName, rowNumber);
                            //ExpandOrCollapseATableRow(TableRow, "Collapsed");
                        }
                        AddCommentsToATableQuestion(TableRow, Data);
                        if (Data.RowButtonToClick != string.Empty)
                        {
                            //ClickButtonOnTableRow(TableRow, Data.RowButtonToClick);
                            ClickTableButtonForExpandedRow(TableName, Data.RowButtonToClick);
                        }
                        PrevRow = Data.RowNumber;
                    }
                    else
                    {
                        Control_ActionUtilities.LogException("Table row #" + Data.RowNumber + " not found.", "", "");
                    }
                }
                else
                {
                    Control_ActionUtilities.LogException("Table with name " + TableName + " is not found.", "", "");
                }
            }
        }