예제 #1
0
 public void Enter_DOB(RepoItemInfo textInfo, string IsPaed)
 {
     if (IsPaed == "true")
     {
         Ranorex.Report.Info("Enter today's date for date of birth");
         String Date_Today = System.DateTime.Now.ToString("dd/MM/yyyy");
         textInfo.FindAdapter <Text>().PressKeys(Date_Today);
         Delay.Milliseconds(200);
     }
     else if (IsPaed == "adult-paed")
     {
         Ranorex.Report.Info("Date of birth will be set to have patient with 15 years of age");
         System.DateTime Date_Today = System.DateTime.Now;
         System.DateTime DOB        = Date_Today.AddYears(-15);
         textInfo.FindAdapter <Text>().PressKeys(DOB.ToString("dd/MM/yyyy"));
         Delay.Milliseconds(200);
     }
     else if (IsPaed == "unknown")
     {
         Ranorex.Report.Info("Unknown Date of Birth");
         repo.FrmUpdatePatientDetails.UnknownDateOfBirth.Click();
         Delay.Milliseconds(200);
     }
     else
     {
         Report.Log(ReportLevel.Info, "Keyboard", "Key sequence from variable '$DOB' with focus on 'textInfo'.", textInfo);
         textInfo.FindAdapter <Text>().PressKeys(DOB);
         Delay.Milliseconds(200);
     }
 }
        public void ValidateValueWaterLevelInDocumentViewDA(RepoItemInfo cellInfo)
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (Text=$expectedValue) on item 'cellInfo'.", cellInfo);

            System.Globalization.CultureInfo fixedDataSourceCulture =  new CultureInfo("en-US");
            fixedDataSourceCulture.NumberFormat.NumberDecimalSeparator =   ".";
            fixedDataSourceCulture.NumberFormat.NumberGroupSeparator   =   "";
            System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture;

            Report.Log(ReportLevel.Info, "", cellInfo.FindAdapter <Cell>().GetAttributeValue <String>("AccessibleName"));

            string currentValue = cellInfo.FindAdapter <Cell>().GetAttributeValue <String>("Text");

            if (expectedValue == "-")
            {
                Validate.AreEqual(currentValue, expectedValue);
            }
            else
            {
                double expectedValueDouble = Double.Parse(expectedValue, fixedDataSourceCulture);
                double currentValueDouble  = Double.Parse(currentValue, currentCulture);

                Validate.AreEqual(currentValueDouble, expectedValueDouble);
            }
        }
예제 #3
0
 private static void SetDynamicDropDownParameterInPropertiesPanel(Ranorex.Row row, string newValueForParameter, RepoItemInfo listItemInfo)
 {
     row.Click();
     row.Click(".98;.5");
     listItemInfo.FindAdapter <ListItem>().Focus();
     listItemInfo.FindAdapter <ListItem>().Click();
 }
        public static void Clear_TextBox(RepoItemInfo itemInfo, string elementType)
        {
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'itemInfo' at Center.", itemInfo);
            if (elementType == "Text")
            {
                itemInfo.FindAdapter <Text>().Click();
            }
            else if (elementType == "Combobox")
            {
                itemInfo.FindAdapter <ComboBox>().Click();
            }
            else
            {
                Ranorex.Report.Info("Element Type incorrect");
            }
            Delay.Milliseconds(200);

            Report.Log(ReportLevel.Info, "Keyboard", "Key 'Home' Press.");
            Keyboard.Press(System.Windows.Forms.Keys.Home, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
            Delay.Milliseconds(200);

            Report.Log(ReportLevel.Info, "Keyboard", "Key 'Shift+End' Press.");
            Keyboard.Press(System.Windows.Forms.Keys.End | System.Windows.Forms.Keys.Shift, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
            Delay.Milliseconds(200);

            Report.Log(ReportLevel.Info, "Keyboard", "Key 'Back' Press.");
            Keyboard.Press(System.Windows.Forms.Keys.Back, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
            Delay.Milliseconds(200);
        }
예제 #5
0
        public void InsertTheName(RepoItemInfo textInfo, string myName)
        {
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'textInfo' at 81;7.");
            textInfo.FindAdapter <Text>().Click("81;7");

            Report.Log(ReportLevel.Info, "Value '" + myName + "' has been inserted");
            textInfo.FindAdapter <Text>().PressKeys(myName);
        }
 public void clickCheckBoxisChecked(RepoItemInfo item)
 {
     if (item.FindAdapter <InputTag>().Checked.Equals("False"))
     {
         Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'name' at Center.", item);
         item.FindAdapter <InputTag>().Click();
     }
 }
 public void Mouse_Click_ChkDistinct(RepoItemInfo inputtagInfo)
 {
     Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'inputtagInfo' at Center.", inputtagInfo);
     // Report.Info(inputtagInfo.FindAdapter<InputTag>().Checked.ToString());
     if (inputtagInfo.FindAdapter <InputTag>().Checked.Equals("False"))
     {
         inputtagInfo.FindAdapter <InputTag>().Click();
     }
 }
 public void FocusSelectAndClick(RepoItemInfo listitemInfo)
 {
     Report.Log(ReportLevel.Info, "Invoke action", "Invoking Focus() on item 'listitemInfo'.", listitemInfo);
     listitemInfo.FindAdapter <ListItem>().Focus();
     Report.Log(ReportLevel.Info, "Invoke action", "Invoking Select() on item 'listitemInfo'.", listitemInfo);
     listitemInfo.FindAdapter <ListItem>().Select();
     Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'listitemInfo' at Center.", listitemInfo);
     listitemInfo.FindAdapter <ListItem>().Click();
 }
예제 #9
0
        public void SelectItemFromDynamicDropDownMenuInRowPropertiesPanel(RepoItemInfo listitemInfo, string pathToRowItemInPropertiesPanel)
        {
            AutomatedSystemTestsRepository myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance;
            Adapter propertiesPanelAdapter = myRepository.RiskeerMainWindow.ContainerMultipleViews.PropertiesPanelContainer.Table.Self;

            Ranorex.Row row = GetRowInPropertiesPanelGivenPath(propertiesPanelAdapter, pathToRowItemInPropertiesPanel);
            row.Click();
            row.Click(".98;.5");
            listitemInfo.FindAdapter <ListItem>().Focus();
            listitemInfo.FindAdapter <ListItem>().Click();
        }
예제 #10
0
 public void MergedUserCodeMethod(RepoItemInfo textInfo, RepoItemInfo textInfo1)
 {
     //Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'textInfo' at 65;13.", textInfo);
     textInfo.FindAdapter <Text>().Click("65;13");
     //Report.Log(ReportLevel.Info, "Keyboard", "Key sequence from variable '$FirstName' with focus on 'textInfo'.", textInfo);
     textInfo.FindAdapter <Text>().PressKeys(FirstName);
     //Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'textInfo1' at 26;15.", textInfo1);
     textInfo1.FindAdapter <Text>().Click("26;15");
     //Report.Log(ReportLevel.Info, "Keyboard", "Key sequence from variable '$LastName' with focus on 'textInfo1'.", textInfo1);
     textInfo1.FindAdapter <Text>().PressKeys(LastName);
 }
        public static void AcknowledgeAllergyBackup(RepoItemInfo AcknowledgedButtonInfo, Adapter AcknowledgeButton, RepoItemInfo ReasonBox, string ReasonAcknowledge, RepoItemInfo SaveButton)
        {
            if (AcknowledgedButtonInfo.Exists(1000))
            {
                Report.Log(ReportLevel.Info, "AcknowledgedButton esixt" + AcknowledgeButton.GetPath().ToString());
                //CheckBox chkbxItem= AcknowledgedButtonInfo.CreateAdapter<CheckBox>(true);

                if (AcknowledgeButton.Visible)
                {
                    //click on Acknowledge button
                    Delay.Milliseconds(200);
                    AcknowledgeButton.Click();
                    Delay.Milliseconds(100);
                    Report.Log(ReportLevel.Info, "Click on AcknowledgedButton");
                    // enter reason detail

                    Text txtItem = ReasonBox.CreateAdapter <Text>(true);
                    txtItem.Click();
                    Delay.Milliseconds(100);

                    Keyboard.Press(ReasonAcknowledge);
                    Delay.Milliseconds(100);
                    Report.Log(ReportLevel.Info, "Enter on Acknowledged reason" + txtItem.GetPath().ToString());

                    // Click on Save
                    //Text txtItemSave= SaveButton.CreateAdapter<Text>(true);
                    Report.Log(ReportLevel.Info, "Save pathe: " + SaveButton.AbsolutePath.ToString());
                    SaveButton.FindAdapter <Text>().Click();

                    //string xpath=SaveButton.AbsolutePath.ToString();


                    //Ranorex.Text txtItemSave =xpath;
                    //txtItemSave.Click();
                    //repo.MainWindow.Modalities.AllergyChecking.Save.Click();

                    //IList<Ranorex.Text> lstText = Host.Local.Find<Ranorex.Text>(SaveButton.AbsolutePath);
                    //Text item =  Host.Local.FindSingle(SaveButton.AbsolutePath);
                    //item.Click();
                    //Report.Log(ReportLevel.Info,"CLick Save" + item.GetPath().ToString());

                    //if(lstText != null && lstText.Count>0)
                    //	lstText[0].Click();

                    //Report.Log(ReportLevel.Info,"CLick Save" + lstText[0].GetPath().ToString());
                    //  Report.Log(ReportLevel.Info,"Number" + lstText.Count.ToString());

                    //txtItemSave.Click();
                    Delay.Milliseconds(1000);
                    Report.Log(ReportLevel.Info, "CLick Save" + SaveButton.FindAdapter <Text>().GetPath().ToString());
                }
            }
        }
예제 #12
0
        public static TreeItem FindNodeInTree(string pathItem, RepoItemInfo rootNodeInfo, Action <TreeItem> actionsOnFinalChild)
        {
            Mouse.DefaultMoveTime        = 0;
            Keyboard.DefaultKeyPressTime = 0;
            Delay.SpeedFactor            = 0.0;

            var stepsPathItem = pathItem.Split('>').ToList();
            IList <Ranorex.Unknown> children = (new List <Ranorex.Unknown>()
            {
                rootNodeInfo.FindAdapter <Ranorex.Unknown>()
            });
            var stepChild = rootNodeInfo.FindAdapter <TreeItem>();

            for (int i = 0; i < stepsPathItem.Count; i++)
            {
                // Find the item corresponding to the step
                var step = stepsPathItem[i];
                if (step == "*" && children.Count == 1)
                {
                    Report.Info("Information", "Using wildcard '*'. One single child found.");
                    stepChild = children.Single().As <TreeItem>();
                }
                else
                {
                    var childrenWithStepInName       = children.Where(ch => ch.ToString().Contains(step));
                    int amountChildrenWithStepInName = childrenWithStepInName.Count();
                    if (amountChildrenWithStepInName == 1)
                    {
                        stepChild = childrenWithStepInName.FirstOrDefault().As <TreeItem>();
                    }
                    else if (amountChildrenWithStepInName > 1)
                    {
                        Report.Info("Information", "Multiple occurrences of '" + step + "' found: choosing first item with this exact name.");
                        stepChild = childrenWithStepInName.FirstOrDefault(ch => NameOfTreeItem(ch.As <TreeItem>()) == step).As <TreeItem>();
                    }
                    else
                    {
                        throw new Ranorex.RanorexException("No occurrences of '" + step + "' found.");
                    }
                }
                if (i != stepsPathItem.Count - 1)
                {
                    // Update the children
                    children = stepChild.Children;
                }
                else
                {
                    // child is last one in path
                    actionsOnFinalChild(stepChild);
                }
            }
            return(stepChild);
        }
        public void SelectAndAddLevel(RepoItemInfo selecttagInfo, RepoItemInfo inputtagInfo, String varListOption)
        {
            String[] lstOption = null;
            Report.Info(varListOption);
            if (varListOption.Contains(","))
            {
                lstOption = varListOption.Split(',');
            }
            else
            {
                lstOption = new string[1] {
                    varListOption
                };
            }


            for (int i = 0; i < lstOption.Length; i++)
            {
                Report.Info(lstOption[i]);

                Report.Log(ReportLevel.Info, "Select", "SetValue item .", selecttagInfo);
                selecttagInfo.FindAdapter <SelectTag>().TagValue = lstOption[i];

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'inputtagInfo' at Center.", inputtagInfo);
                inputtagInfo.FindAdapter <InputTag>().Click();
            }
        }
예제 #14
0
        public void Swipe_gesture_Hours(RepoItemInfo iospickerInfo)
        {
            String check    = "1";
            bool   areEqual = String.Equals(TimerHrs, check, StringComparison.OrdinalIgnoreCase);

            if (areEqual == false)
            {
                Report.Log(ReportLevel.Info, "Touch gestures", "Swipe gesture with direction 'Up (270°)' starting from 'Center' with distance '.1' with swipe duration'500ms' and step count '0' on item 'iospickerInfo'.", iospickerInfo);
                iospickerInfo.FindAdapter <IosPicker>().Swipe(Location.Center, ValueConverter.ArgumentFromString <Ranorex.Core.Recorder.Touch.GestureDirection>("SwipeDirection", "Up (270°)"), ValueConverter.ArgumentFromString <Ranorex.Core.Distance>("Distance", ".1"), ValueConverter.ArgumentFromString <Ranorex.Duration>("SwipeDuration", "500ms"), 0);
            }
            else
            {
                Report.Log(ReportLevel.Info, "Touch gestures", "Swipe gesture with direction 'Down (90°)' starting from 'Center' with distance '.1' with swipe duration'500ms' and step count '0' on item 'iospickerInfo'.", iospickerInfo);
                iospickerInfo.FindAdapter <IosPicker>().Swipe(Location.Center, ValueConverter.ArgumentFromString <Ranorex.Core.Recorder.Touch.GestureDirection>("SwipeDirection", "Down (90°)"), ValueConverter.ArgumentFromString <Ranorex.Core.Distance>("Distance", ".1"), ValueConverter.ArgumentFromString <Ranorex.Duration>("SwipeDuration", "500ms"), 0);
            }
        }
예제 #15
0
 public static void PressKeyExist(RepoItemInfo objInfo, string strKeys)
 {
     if (objInfo.Exists(3000))
     {
         objInfo.FindAdapter <Unknown>().PressKeys(strKeys);
     }
 }
        public void Validate_GenericParameterVisibleInProjectExplorer(RepoItemInfo rowInfo)
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeEqual (AccessibleValue=$expectedValueText) on item 'rowInfo'.", rowInfo);
            System.Globalization.CultureInfo fixedDataSourceCulture =  new CultureInfo("en-US");
            fixedDataSourceCulture.NumberFormat.NumberDecimalSeparator =   ".";
            fixedDataSourceCulture.NumberFormat.NumberGroupSeparator   =   "";
            System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture;

            Report.Log(ReportLevel.Info, "", rowInfo.FindAdapter <Row>().GetAttributeValue <String>("AccessibleName"));

            double expectedValueDouble = Double.Parse(expectedValue, fixedDataSourceCulture);
            string currentValue        = rowInfo.FindAdapter <Row>().GetAttributeValue <String>("AccessibleValue");
            double currentValueDouble  = Double.Parse(currentValue, currentCulture);

            Validate.AreEqual(currentValueDouble, expectedValueDouble);
        }
        public void Get_value_LstTestBox(RepoItemInfo listInfo, string listItems)
        {
            TCOS_POC_DEMOAPPRepository repo = TCOS_POC_DEMOAPPRepository.Instance;

            Ranorex.List HDComboBox = listInfo.FindAdapter <List>();

            HDComboBox.Click(Location.Center);

            IList <Ranorex.ListItem> MyListItems = HDComboBox.FindDescendants <Ranorex.ListItem>();

            string[] actualStrArrItems;

            actualStrArrItems = new string[MyListItems.Count];

            foreach (Ranorex.ListItem ThisListItem in MyListItems)
            {
                actualStrArrItems[ThisListItem.Index] = ThisListItem.Text.ToString();
            }


//		Report.Log(ReportLevel.Info,"**"+string.Join(",", actualStrArrItems)+"**");
//		Report.Log(ReportLevel.Info,"**"+listItems+"**");

            Validate.AreEqual(string.Join(",", actualStrArrItems), listItems);
        }
        public static void AcknowledgeAllergy(string ReasonAcknowledge, RepoItemInfo AckButton, RepoItemInfo SaveButton)
        {
            if (AckButton.Exists(3000))
            {
                Report.Log(ReportLevel.Info, "AcknowledgedButton exist");

                //if the Acknowledge Button displays, click on Acknowledge button
                Delay.Milliseconds(500);
                Report.Log(ReportLevel.Info, "Click on AcknowledgedButton");
                AckButton.FindAdapter <CheckBox>().Click();
                Delay.Milliseconds(100);

                // enter reason detail
                repo.MainWindow.Modalities.ReasonForAcknowledgeAllergy.Reason.Click();
                Delay.Milliseconds(100);

                Report.Log(ReportLevel.Info, "Enter on Acknowledged reason");
                Keyboard.Press(ReasonAcknowledge);
                Delay.Milliseconds(100);

                // Click on Save
                Delay.Milliseconds(100);
                Report.Log(ReportLevel.Info, "Click on Save");
                SaveButton.FindAdapter <Text>().Click();
                Delay.Milliseconds(1000);
            }
            else
            {
                Report.Log(ReportLevel.Info, "No allergy. AcknowledgedButton does not exist");
            }
        }
        public void Invoke_action_ResultInitialMech(RepoItemInfo cellInfo)
        {
            var el = cellInfo.FindAdapter <Cell>().Element;

//            string colorOfCell = (string)el.InvokeRemotely( delegate(System.Windows.Forms.Control control, object input)
//                {
//                                                System.Windows.Forms.DataGridView dataGrid = (System.Windows.Forms.DataGridView) control;
//
//                                                // There you can access each cell:
//                                                Color color = dataGrid.Rows[1].Cells[2].Style.BackColor;
//                                                Console.WriteLine("Color: "+color);
//                                                return color.ToString();
//                 }
//                 );
            Report.Log(ReportLevel.Info, "Invoke action", "Invoking Focus() on item 'cellInfo'.", cellInfo);
            cellInfo.FindAdapter <Cell>().Focus();
        }
예제 #20
0
 public void Mouse_Click_ButtonOK(RepoItemInfo buttonInfo)
 {
     Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'buttonInfo' at Center.", buttonInfo);
     try {
         buttonInfo.WaitForExists(2000);
         buttonInfo.FindAdapter <Button>().Click();
     } catch (Exception) { }
 }
 public void Mouse_Click_ButtonRun(RepoItemInfo buttonInfo)
 {
     if (buttonInfo.Exists(5000))
     {
         Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'buttonInfo' at Center.", buttonInfo);
         buttonInfo.FindAdapter <Button>().Click();
     }
 }
 public void Mouse_Click_SecondNeedleUsed(RepoItemInfo checkboxInfo)
 {
     if (repo.AddRegionalBlock.Needle.SecondNeedleUsed.Checked == false)
     {
         Report.Log(ReportLevel.Info, "Mouse", "CLick on \"Seccond Needle\" checkbox\r\nMouse Left Click item 'checkboxInfo' at Center.", checkboxInfo);
         checkboxInfo.FindAdapter <CheckBox>().Click();
     }
 }
 public void ConfirmOverwrite(RepoItemInfo buttonInfo)
 {
     if (buttonInfo.Exists())
     {
         Report.Log(ReportLevel.Info, "Mouse", "(Optional Action)\r\nMouse Left Click item 'buttonInfo' at Center.", buttonInfo);
         buttonInfo.FindAdapter <Button>().Click();
     }
 }
 public void Mouse_Click_No(RepoItemInfo buttonInfo)
 {
     if (repo.FrmConfirmation.ConfirmationInfo.Exists(2000))
     {
         Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'buttonInfo' at Center.", buttonInfo);
         buttonInfo.FindAdapter <Button>().Click();
     }
 }
 public void Mouse_Click_ButtonNoIfConformationDialogAppears(RepoItemInfo buttonInfo)
 {
     Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'buttonInfo'.", buttonInfo);
     try {
         buttonInfo.WaitForExists(2000);
         buttonInfo.FindAdapter <Button>().Click();
     } catch (Exception) { }
 }
 public void Mouse_Click_Next(RepoItemInfo spantagInfo)
 {
     if (TestSuite.Current.GetTestContainer("SmartFolder").Parameters["nextpresent"] == "true")
     {
         Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'spantagInfo' at Center.", spantagInfo);
         spantagInfo.FindAdapter <SpanTag>().Click();
     }
 }
 public void DoNotSaveIfAsked(RepoItemInfo buttonInfo)
 {
     if (buttonInfo.Exists(Duration.FromMilliseconds(1000)))
     {
         Report.Log(ReportLevel.Info, "Mouse", "(Optional Action)\r\nMouse Left Click item 'buttonInfo' at Center.", buttonInfo);
         buttonInfo.FindAdapter <Button>().Click();
     }
 }
예제 #28
0
 public void ConfirmOverwrite(RepoItemInfo buttonInfo)
 {
     try {
         Report.Log(ReportLevel.Info, "Mouse", "(Optional Action)\r\nMouse Left Click item 'buttonInfo' at Center.", buttonInfo);
         buttonInfo.FindAdapter <Button>().Click();
     } catch (Exception) {
         Report.Log(ReportLevel.Info, "No confirmation dialog to overwrite confuguration file.");
     }
 }
예제 #29
0
 public void MergeScreenshotAndWaitUntilDialogClosed(RepoItemInfo formInfo)
 {
     try {
         formInfo.WaitForExists(2000);
         Report.Screenshot(ReportLevel.Info, "User", "", formInfo.FindAdapter <Form>(), false);
         Report.Info("Waiting 4h to not exist. Associated repository item: 'formInfo'" + formInfo.ToString());
         formInfo.WaitForNotExists(14400000);
     } catch (Exception) { }
 }
        public void SelectCalculationsToAddInHydraulicBC_DA(RepoItemInfo tableInfo)
        {
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'cellInfo' at Center when required.");
            int index           = Int32.Parse(rowIndex);
            var row             = tableInfo.FindAdapter <Table>().Rows[index + 1];
            var calculationCell = row.Children[1].As <Cell>();

            ClickOnCheckboxCellIfNeeded(calculationCell, calculationMustBeChecked);
        }