public static void CheckArticleOnLeftMenu(string catname, string arname, bool isClick) { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); Dictionary <string, Object> category = (Dictionary <string, Object>)categories[catname]; string cattitle = (String)category["title"]; Dictionary <string, Object> articles = (Dictionary <string, Object>)category["articles"]; // check article title Dictionary <string, Object> article = (Dictionary <string, Object>)articles[arname]; string artitle = (String)article["title"]; System.Console.WriteLine("Article: " + artitle); try{ Text arText = repo.DHSMainWindow.ContentManagementControl.ArticleTitleList.FindSingle("./listitem/text[@text='" + artitle + "']"); Report.Log(ReportLevel.Success, "Check if Article title on Side bar with text \"" + artitle + "\""); if (isClick) { arText.Click(); Delay.Milliseconds(1000); } } catch (RanorexException ex) { Report.Log(ReportLevel.Failure, "Check if Article title on Side bar with text \"" + artitle + "\""); throw; } }
public void ClickQuickStartGuide() { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, string> navPanel = reader.GetNavigationPanelText("Manuals"); string qsg = navPanel["QuickStartGuide"]; Text qsgText = repo.DHSMainWindow.NavigationPanel.FindSingle <Text>(@"./button/text[@text='" + qsg + "']"); qsgText.Click(); Delay.Milliseconds(1000); }
public void ClickManualsTab() { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, string> leftmenutexts = reader.GetLeftMenuText(); string manuals = leftmenutexts["Manuals"]; Text manualsTab = repo.DHSMainWindow.LeftMenuListbox.FindSingle <Text>(@"./listitem/text[@text='" + manuals + "']"); manualsTab.Click(); Delay.Milliseconds(2000); }
/// <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() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, string> repoDict = reader.GetRepoText(); repo.varDHSAppName = repoDict["DHSAppName"]; }
public void ClickViewAllManuals() { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, string> navPanel = reader.GetNavigationPanelText("Manuals"); string viewAllManuals = navPanel["ViewAllManuals"]; viewAllManuals = viewAllManuals.Replace(@"{0}", Utils.GetPlatformName()); Text viewAllText = repo.DHSMainWindow.NavigationPanel.FindSingle <Text>(@"./button/text[@text='" + viewAllManuals + "']"); viewAllText.Click(); Delay.Milliseconds(2000); }
/* * public void CheckCategoriesAndArticles() * { * CultureInfo ci = GetOSLanguage(); * * //close navigation panel if it's visible * if(repo.DHSMainWindow.NavigationPanel.Visible == true){ * repo.DHSMainWindow.ClosePanelImage.Click(); * Delay.Milliseconds(1000); * } * * Text helptext = repo.DHSMainWindow.HELPCATEGORIES.FindSingle("."); * * // get list of categories * IList<Button> listbuttons = helptext.Find<Button>("./following-sibling::button"); * * XmlReader reader = XmlReader.Create(Directory.GetCurrentDirectory() + @"\Resources\DHSTranslate.xml"); * // If the node has value * reader.Read(); * reader.ReadToFollowing("language"); * do { * if(reader.GetAttribute("code") == ci.Name){ * // check help categories * reader.ReadToDescendant("helpcategories"); * string expecthelpcategories = reader.ReadString(); * try{ * Validate.AreEqual(helptext.TextValue, expecthelpcategories, "Check if text \"" + helptext.TextValue + "\" is in " + ci.DisplayName + " as expected: \"" + expecthelpcategories + "\""); * } * catch(RanorexException){ * } * * reader.ReadToNextSibling("categories"); * XmlReader catReader = (XmlReader)reader.ReadSubtree(); * catReader.ReadToDescendant("category"); * int i = 0; * do{ * catReader.ReadToDescendant("name"); * string expectedcategoryname = catReader.ReadString(); * // get actual category name * Button button = listbuttons[i]; * Text buttontext = button.FindSingle("./text"); * string actualbuttontext = buttontext.TextValue; * try{ * Validate.AreEqual(actualbuttontext, expectedcategoryname, "Check if Category with text \"" + actualbuttontext + "\" is in " + ci.DisplayName + " as expected: \"" + expectedcategoryname + "\""); * } * catch(RanorexException){ * } * * button.Click(); * * // compare category name on left menu * Text catTitle = repo.DHSMainWindow.ContentManagementControl.Self.FindSingle("./text[1]"); * string catTitleText = catTitle.TextValue; * try{ * Validate.AreEqual(catTitleText, expectedcategoryname, "Check if Category title on Side bar with text \"" + catTitleText + "\" is in " + ci.DisplayName + " as expected: \"" + expectedcategoryname + "\""); * } * catch(RanorexException){ * } * * catReader.ReadToNextSibling("articles"); * XmlReader artReader = (XmlReader)catReader.ReadSubtree(); * artReader.ReadToDescendant("article"); * * IList<ListItem> listarticles = repo.DHSMainWindow.ContentManagementControl.ArticleTitleList.Find<ListItem>("./listitem"); * int j=0; * do{ * artReader.ReadToDescendant("name"); * string expectedarticlename = artReader.ReadString(); * ListItem article = listarticles[j]; * // get actual title * Text actualarticle = article.FindSingle("./text"); * string actualarticlename = actualarticle.TextValue; * try{ * Validate.AreEqual(actualarticlename, expectedarticlename, "Check if Article with text \"" + actualarticlename + "\" is in " + ci.DisplayName + " as expected: \"" + expectedarticlename + "\""); * } * catch(RanorexException){ * } * * article.Click(); * Delay.Milliseconds(1000); * // check the article title in the content area * artReader.ReadToNextSibling("content"); * artReader.ReadToDescendant("title"); * string expectedarticletitle = artReader.ReadString(); * // get actual title * H1Tag articletitle = repo.DHSArticleContentArea.ArticleTitle.FindSingle<H1Tag>("."); * string actualarticletitle = articletitle.InnerText; * try{ * Validate.AreEqual(actualarticletitle, expectedarticletitle, "Check if Article title in content area with text \"" + actualarticletitle + "\" is in " + ci.DisplayName + " as expected: \"" + expectedarticletitle + "\""); * } * catch(RanorexException){ * } * * j++; * } * while(artReader.ReadToFollowing("article")); * * repo.DHSMainWindow.BackButton.Click(); * Delay.Milliseconds(1000); * i++; * } * while(catReader.ReadToFollowing("category")); * break; * } * } while (reader.ReadToNextSibling("language")); * } */ public void CheckCategoriesArticles() { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); int i = 0; foreach (string key in categories.Keys) { if (i++ > 0) { break; } Dictionary <string, Object> category = (Dictionary <string, Object>)categories[key]; string title = (String)category["title"]; Text helptext = repo.DHSMainWindow.HELPCATEGORIES.FindSingle("."); // get list of categories try{ Picture categoryIcon = helptext.FindSingle <Picture>("./following-sibling::button/text[@text~'" + title + "']/preceding-sibling::picture[1]", 1000); Report.Log(ReportLevel.Success, "Found and Click on Category: " + title); categoryIcon.Click(); } catch (ElementNotFoundException ex) { Report.Log(ReportLevel.Success, "Not Found Category: " + title); continue; } Delay.Milliseconds(1000); DHSCategory.CheckCategoryOnLeftMenu(key); // get the first article Dictionary <string, Object> articles = (Dictionary <string, Object>)category["articles"]; string firstArticle = (String)articles["#first"]; Delay.Milliseconds(1000); DHSArticle.CheckArticleOnContentPanel(key, firstArticle); foreach (string arKey in articles.Keys) { if (arKey != "#first" && arKey != firstArticle) { System.Console.WriteLine(arKey + ":" + firstArticle); Dictionary <string, Object> article = (Dictionary <string, Object>)articles[arKey]; string arTitle = (String)article["title"]; // open article Text arText = repo.DHSMainWindow.ContentManagementControl.ArticleTitleList.FindSingle <Text>("./listitem/text[@text~'" + arTitle + "']"); arText.Click(); DHSArticle.CheckArticleOnContentPanel(key, arKey); } } // click back repo.DHSMainWindow.BackButton.Click(); } }
public static void CheckArticleOnContentPanel(string catname, string arname) { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); Dictionary <string, Object> category = (Dictionary <string, Object>)categories[catname]; string cattitle = (String)category["title"]; Dictionary <string, Object> articles = (Dictionary <string, Object>)category["articles"]; // check article title Dictionary <string, Object> article = (Dictionary <string, Object>)articles[arname]; string artitle = (String)article["title"]; System.Console.WriteLine("Article: " + artitle); Dictionary <string, Object> content = (Dictionary <string, Object>)article["content"]; string header = (String)content["header"]; System.Console.WriteLine("Header: " + header); // get actual header H1Tag arHeader = Host.Local.FindSingle <H1Tag>(@"/dom//div[#'ArticleBody']//h1"); arHeader.Click(); Delay.Milliseconds(1000); string arHeaderText = arHeader.InnerText; Report.Log((arHeaderText == header)?ReportLevel.Success:ReportLevel.Failure, "Check Article title on Content Area: expected text is: \"" + header + "\" and actuall text is: \"" + arHeaderText + "\""); // check verticle scroll bar is shown if article content spread more than 1 page try{ Ranorex.WebElement invisibleElement = Host.Local.FindSingle <Ranorex.WebElement>(@"/dom//div[#'ArticleBody']//*[@visible='False']", 10000); CheckVerticleScrollBar(true); } catch (ElementNotFoundException ex) { CheckVerticleScrollBar(false); } string networkStatus = repo.Taskbar.NetwordIcon.GetAttributeValue <String>("Text"); Delay.Milliseconds(5000); if (networkStatus.Contains("access")) { // check article language Report.Log(ReportLevel.Info, "Check article language when connect network!"); CheckArticleLanguage(artitle); } }
public static void CheckCategoryOnLeftMenu(string name) { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); Dictionary <string, Object> category = (Dictionary <string, Object>)categories[name]; string cattitle = (String)category["title"]; // check category title System.Console.WriteLine("Category: " + cattitle); // compare category name on left menu try{ Text catText = repo.DHSMainWindow.ContentManagementControl.Self.FindSingle("./text[@text='" + cattitle + "']"); Report.Log(ReportLevel.Success, "Check if Category title on Side bar with text \"" + cattitle + "\""); } catch (RanorexException ex) { Report.Log(ReportLevel.Failure, "Check if Category title on Side bar with text \"" + cattitle + "\""); throw; } /* * Dictionary<string, Object> articles = (Dictionary<string, Object>)category["articles"]; * foreach(string key in articles.Keys){ * // check article title * Dictionary<string, Object> article = (Dictionary<string, Object>)articles[key]; * string artitle = (String)article["title"]; * System.Console.WriteLine("Article: " + artitle); * * try{ * Text arText = repo.DHSMainWindow.ContentManagementControl.ArticleTitleList.FindSingle("./listitem/text[@text='"+artitle+"']"); * Report.Log(ReportLevel.Success, "Check if Article title on Side bar with text \"" + artitle + "\""); * arText.Click(); * Delay.Milliseconds(1000); * } * catch(RanorexException ex){ * Report.Log(ReportLevel.Failure, "Check if Category title on Side bar with text \"" + artitle + "\""); * throw; * } * * Dictionary<string, Object> content = (Dictionary<string, Object>)article["content"]; * string header = (String)content["header"]; * System.Console.WriteLine("Header: " + header); * } */ }
public void CheckCategoriesOnMouseHover() { repo.DHSMainWindow.SelfInfo.WaitForExists(10000); DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); int count = categories.Count; // Notify user to start check category border string msg = "Please observe if Categories icon will be highlight with white circle border when mouse hover.\n\n" + "To start walk-through " + count + " categories, Press OK"; WinForms.MessageBox.Show(new WinForms.Form { TopMost = true }, msg, "Notification", WinForms.MessageBoxButtons.OK, MessageBoxIcon.Information); foreach (string key in categories.Keys) { Dictionary <string, Object> category = (Dictionary <string, Object>)categories[key]; string title = (String)category["title"]; Text helptext = repo.DHSMainWindow.HELPCATEGORIES.FindSingle("."); // get list of categories Picture categoryIcon = helptext.FindSingle <Picture>("./following-sibling::button/text[@text~'" + title + "']/preceding-sibling::picture[1]"); categoryIcon.MoveTo(); Delay.Milliseconds(1000); } if (isConfirmManualSteps.Equals("True")) { msg = "Please confirm all Categories icon was highlighted with white circle border? (Yes/No)"; string msgResult = "Check all Categories icon was highlighted with white circle border"; DialogResult result = WinForms.MessageBox.Show(new WinForms.Form { TopMost = true }, msg, "Confirm Step", WinForms.MessageBoxButtons.YesNo, WinForms.MessageBoxIcon.Question, WinForms.MessageBoxDefaultButton.Button1); Report.Log(result == DialogResult.Yes?ReportLevel.Success:ReportLevel.Failure, msgResult); } }
public Dictionary <string, string> GetArticleNameFromTitle(string title) { DHSTranslateReader reader = new DHSTranslateReader(); Dictionary <string, Object> categories = reader.GetCategories(); Dictionary <string, string> dict = new Dictionary <string, string>(); foreach (string key in categories.Keys) { Dictionary <string, Object> category = (Dictionary <string, Object>)categories[key]; Dictionary <string, Object> articles = (Dictionary <string, Object>)category["articles"]; foreach (string key1 in articles.Keys) { if (key1 == "#first") { continue; } Dictionary <string, Object> article = (Dictionary <string, Object>)articles[key1]; if (article.ContainsKey("featuretitle")) { string artitle = (String)article["featuretitle"]; if (artitle.Trim() != "" && artitle.Trim().ToLower() == title.Trim().ToLower()) { dict.Add("category", key); dict.Add("article", key1); return(dict); } } else { string artitle = (String)article["title"]; if (artitle.Trim().ToLower() == title.Trim().ToLower()) { dict.Add("category", key); dict.Add("article", key1); return(dict); } Dictionary <string, Object> content = (Dictionary <string, Object>)article["content"]; string arheader = (String)content["header"]; if (arheader.Trim().ToLower() == title.Trim().ToLower()) { dict.Add("category", key); dict.Add("article", key1); return(dict); } } } } /* * foreach(string key in categories.Keys){ * Dictionary<string, Object> category = (Dictionary<string, Object>)categories[key]; * Dictionary<string, Object> articles = (Dictionary<string, Object>)category["articles"]; * foreach(string key1 in articles.Keys){ * if(key1 == "#first"){ * continue; * } * Dictionary<string, Object> article = (Dictionary<string, Object>)articles[key1]; * string artitle = (String)article["title"]; * if(artitle.Trim().ToLower() == title.Trim().ToLower()){ * dict.Add("category", key); * dict.Add("article", key1); * return dict; * } * } * } * foreach(string key in categories.Keys){ * Dictionary<string, Object> category = (Dictionary<string, Object>)categories[key]; * Dictionary<string, Object> articles = (Dictionary<string, Object>)category["articles"]; * foreach(string key1 in articles.Keys){ * if(key1 == "#first"){ * continue; * } * Dictionary<string, Object> article = (Dictionary<string, Object>)articles[key1]; * Dictionary<string, Object> content = (Dictionary<string, Object>)article["content"]; * string arheader = (String)content["header"]; * if(arheader.Trim().ToLower() == title.Trim().ToLower()){ * dict.Add("category", key); * dict.Add("article", key1); * return dict; * } * } * } */ return(null); }