public static Ranorex.Row GetRowInPropertiesPanelGivenPath(string pathItem, Adapter argumentAdapter) { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; int minimumIndex = 0; var stepsPathItem = pathItem.Split('>').ToList(); Ranorex.Row stepRow = argumentAdapter.As <Table>().Rows.ToList()[1]; for (int i = 0; i < stepsPathItem.Count; i++) { // Find the item corresponding to the step var step = stepsPathItem[i]; var completeList = argumentAdapter.As <Table>().Rows.ToList(); var searchList = completeList.GetRange(minimumIndex, completeList.Count - minimumIndex); var kk = searchList.Where(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step)); var kk2 = searchList.Select(rw => rw.GetAttributeValue <string>("AccessibleName")); var indexStepRow = searchList.FindIndex(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step)); stepRow = searchList[indexStepRow]; stepRow.Focus(); stepRow.Select(); if (i != stepsPathItem.Count - 1 && stepRow.Element.GetAttributeValueText("AccessibleState").Contains("Collapsed")) { stepRow.PressKeys("{Right}"); } minimumIndex += 1 + indexStepRow; } return(stepRow); }
public void CheckRepeatedItem() { // create a table Fluid from path Ranorex.Table tblFluid = "/form[@name='frmMain']/?/?/form[@name='frmFluidBalanceModule']/?/?/tabpage[@name='tsFluidInput']/?/?/table[@class='TcxGridSite']"; // get the last row of the table Ranorex.Row lastRow = tblFluid.Rows[tblFluid.Rows.Count - 1]; // get list cells of this row IList <Cell> lstCell = lastRow.Cells; // Validate Finishlevel (cell4), VolumeGiven (cell5), and TotalRunning(cell7) are null // in code thesse number should be (number -1) Report.Log(ReportLevel.Info, "Validation", "Validate Finishlevel is empty"); Validate.AreEqual(lstCell[3].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(0); Report.Log(ReportLevel.Info, "Validation", "Validate VolumeGiven is empty"); Validate.AreEqual(lstCell[4].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(0); Report.Log(ReportLevel.Info, "Validation", "Validate TotalRunningl is empty"); Validate.AreEqual(lstCell[6].GetAttributeValue <string>("Text"), (string)null); Delay.Milliseconds(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(); }
private int GetIndexCombinedProbability(Ranorex.Row row) { string queryOldResultTable = "Gedetailleerde toets per vak\r\nfaalkans"; string queryNewResultTable = ""; var newResultTableType1 = new List <string>() { "STPH", "STBI" }; var newResultTableType2 = new List <string>() { "HTKW", "BSKW", "STKWp", "GEKB" }; if (newResultTableType1.Contains(labelFM)) { queryNewResultTable = "mechanisme per doorsnede"; } else if (newResultTableType2.Contains(labelFM)) { queryNewResultTable = "mechanisme per vak"; } int indexColumnCombinedProbability = GetIndex(row, queryOldResultTable); if (indexColumnCombinedProbability > 0) { Report.Warn($"Old Result View Windows. Using column with header containing {queryOldResultTable}"); } else { Report.Warn($"New Results View. Using column with header containing '{queryNewResultTable}'"); indexColumnCombinedProbability = GetIndex(row, queryNewResultTable); } return(indexColumnCombinedProbability); }
private void ValidateSingleCell(Ranorex.Row row, string logMessage, string indexColumn, string expectedValue) { string actualValue = ""; Report.Log(ReportLevel.Info, logMessage); if (indexRow == "0") { actualValue = row.Cells[Int32.Parse(indexColumn)].Element.GetAttributeValueText("AccessibleValue"); } else { var currentCell = row.Cells[Int32.Parse(indexColumn)]; currentCell.Select(); actualValue = currentCell.Element.GetAttributeValueText("AccessibleValue"); if (Int32.Parse(indexColumn) > 1) { System.Globalization.CultureInfo fixedDataSourceCulture = new CultureInfo("en-US"); fixedDataSourceCulture.NumberFormat.NumberDecimalSeparator = "."; fixedDataSourceCulture.NumberFormat.NumberGroupSeparator = ""; System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture; actualValue = Double.Parse(actualValue, currentCulture).ToString(fixedDataSourceCulture); expectedValue = Double.Parse(expectedValue, fixedDataSourceCulture).ToString(fixedDataSourceCulture); } } Validate.AreEqual(actualValue, expectedValue); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { AutomatedSystemTestsRepository myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; Adapter propertiesPanelAdapter = myRepository.RiskeerMainWindow.ContainerMultipleViews.PropertiesPanelContainer.Table.Self; Ranorex.Row row = PropertiesPanelHelpers.GetRowInPropertiesPanelGivenPath(pathToElementInPropertiesPanel, propertiesPanelAdapter); row.SetValue(newValueForParameter, typeParameter); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { AutomatedSystemTestsRepository myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; Adapter propertiesPanelAdapter = myRepository.RiskeerMainWindow.ContainerMultipleViews.PropertiesPanelContainer.Table.Self; Ranorex.Row row = PropertiesPanelHelpers.GetRowInPropertiesPanelGivenPath(pathToElementInPropertiesPanel, propertiesPanelAdapter); valueOfElement = row.Element.GetAttributeValueText("AccessibleValue"); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { var repo = AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; var table = repo.RiskeerMainWindow.ContainerMultipleViews.PropertiesPanelContainer.Table.SelfInfo.CreateAdapter <Table>(true); Ranorex.Row row = PropertiesPanelHelpers.GetRowInPropertiesPanelGivenPath(pathToRowInPP, table); string currentValue = row.Element.GetAttributeValueText("AccessibleValue"); Validate.AreEqual(currentValue, expectedText); }
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(); }
public static void ClickThis(this Ranorex.Row item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("Row Click Failed : " + ex.Message); } }
public static IList <Cell> GetLastRowOfTable(string xPath) { IList <Cell> lstCell = null; // create a table from path Ranorex.Table tblFluid = xPath; if (tblFluid != null) { // get the last row of the table Ranorex.Row lastRow = tblFluid.Rows[tblFluid.Rows.Count - 1]; // get list cells of last row lstCell = lastRow.Cells; } return(lstCell); }
public void ValidateValueDoubleOfParameterInPropertiesPanelGivenPath(Adapter propertiesPanelAdapter, string pathToRowInPropertiesPanel) { System.Globalization.CultureInfo fixedDataSourceCulture = new CultureInfo("en-US"); fixedDataSourceCulture.NumberFormat.NumberDecimalSeparator = "."; fixedDataSourceCulture.NumberFormat.NumberGroupSeparator = ""; System.Globalization.CultureInfo currentCulture = CultureInfo.CurrentCulture; Ranorex.Row row = PropertiesPanelHelpers.GetRowInPropertiesPanelGivenPath(pathToRowInPropertiesPanel, propertiesPanelAdapter); string currentValueString = row.Element.GetAttributeValueText("AccessibleValue"); double currentValueDouble = Double.Parse(currentValueString, currentCulture); double expectedValueDouble = Double.Parse(expectedValueString, fixedDataSourceCulture); double deviation = Math.Abs(currentValueDouble - expectedValueDouble); Validate.IsTrue(deviation < 0.00000001); }
public void SelectFirstOutputItem() { // create a table Fluid from path Ranorex.Table tblFluid = "/form[@controlname='frmMain']/?/?/form[@name='frmFluidBalanceModule']/?/?/tabpage[@name='tsFluidOutput']/?/?/table[@class='TcxGridSite']"; // get the first row of the table if (tblFluid.Rows.Count > 0) { Ranorex.Row firstRow = tblFluid.Rows[1]; // get list cells of this row IList <Cell> lstCell = firstRow.Cells; // get time of firt Output fluid string sttrTime = lstCell[0].GetAttributeValue <string>("Text"); repo.TimeAddFluid = sttrTime; Delay.Milliseconds(0); } }
private void ValidateRow(Ranorex.Row row) { if (indexRow == "0" && fmLabel != "STPH" && fmLabel != "STBI") { Report.Log(ReportLevel.Info, "Validating that column Nvak is not present."); Validate.IsFalse(row.Cells[row.Cells.Count - 1].Element.GetAttributeValueText("AccessibleName").Contains("Nvak*")); } ValidateSingleCell(row, "Validating 1st column", indexColumnName, valueColumnName); ValidateSingleCell(row, "Validating 2nd column", indexColumnOffsetFrom, valueColumnOffsetFrom); ValidateSingleCell(row, "Validating 3rd column", indexColumnOffsetTo, valueColumnOffsetTo); ValidateSingleCell(row, "Validating 4th column", indexColumnLength, valueColumnLength); if (fmLabel == "STPH") { Report.Log(ReportLevel.Info, "FM is " + fmLabel + " so validating 5th column."); ValidateSingleCell(row, "Validating 5th column", indexColumnNvak, valueColumnNvakSTPH); } else if (fmLabel == "STBI") { Report.Log(ReportLevel.Info, "FM is " + fmLabel + " so validating 5th column."); ValidateSingleCell(row, "Validating 5th column", indexColumnNvak, valueColumnNvakSTBI); } }
public static void SetValue(this Ranorex.Row row, string newValue, string parameterType) { switch (parameterType) { case "Text": SetTextParameterInPropertiesPanel(row, newValue); break; case "Double": SetDoubleParameterInPropertiesPanel(row, newValue); break; case "DropDown": //RepoItemInfo listItemInfo = new RepoItemInfo(myRepository.DropDownMenuInRowPropertiesPanel.List, "genericItemInDropDownList", "listitem[@accessiblename~" + newValueForParameter + "]", 30000, null); //SetDynamicDropDownParameterInPropertiesPanel(row, newValueForParameter, listItemInfo); break; default: Report.Log(ReportLevel.Error, "Type of parameter " + parameterType + " not implemented!"); break; } }
public Ranorex.Row GetRowInPropertiesPanelGivenPath(Adapter argumentAdapter, string pathItem) { int minimumIndex = 0; var stepsPathItem = pathItem.Split('>').ToList(); Ranorex.Row stepRow = argumentAdapter.As <Table>().Rows.ToList()[1]; for (int i = 0; i < stepsPathItem.Count; i++) { // Find the item corresponding to the step var step = stepsPathItem[i]; var completeList = argumentAdapter.As <Table>().Rows.ToList(); var searchList = completeList.GetRange(minimumIndex, completeList.Count - minimumIndex); var indexStepRow = searchList.FindIndex(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step)); stepRow = searchList[indexStepRow]; // if step is intermediate if (i != stepsPathItem.Count - 1) { var stateStepRow = stepRow.Element.GetAttributeValueText("AccessibleState"); // if intermediate step is collapsed if (stateStepRow.Contains("Collapsed")) { // Select and expand the intermediate item Report.Log(ReportLevel.Info, "was collapsed"); stepRow.Focus(); stepRow.Select(); stepRow.PressKeys("{Right}"); } } else { // Select the final item stepRow.Focus(); stepRow.Select(); } // Update the minimum index administration (only search forward) minimumIndex += 1 + indexStepRow; } return(stepRow); }
private static void SetTextParameterInPropertiesPanel(Ranorex.Row row, string newValue) { row.Element.SetAttributeValue("AccessibleValue", newValue); }
private static void SetDoubleParameterInPropertiesPanel(Ranorex.Row row, string newValue) { row.Element.SetAttributeValue("AccessibleValue", newValue.ToCurrentCulture()); }