public void CheckGetOnline() { MessageBoxManualsOffline.ClickGetOnline(); DHSCategory.CheckCategoryOnLeftMenu("Connecting to Wireless and Accessories"); DHSArticle.CheckArticleOnContentPanel("Connecting to Wireless and Accessories", "Wireless troubleshooting"); }
/* * 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 void CheckFeatureArticles() { for (int i = 1; i < 5; i++) { int j = 1; if (i == 1) { j = 2; } Button button = repo.DHSMainWindow.CarouselImageButtonTwo.FindSingle <Button>("./following-sibling::button[][" + j + "]"); button.Click(); Delay.Milliseconds(1000); // get the article title string title1 = repo.DHSMainWindow.CarouselImageButton.FindSingle <Text>("./text[2]").TextValue; string title2 = repo.DHSMainWindow.CarouselImageButtonTwo.FindSingle <Text>("./text[2]").TextValue; button = repo.DHSMainWindow.CarouselImageButtonTwo.FindSingle <Button>("./following-sibling::button[][" + i + "]"); button.Click(); Delay.Milliseconds(1000); // get the article title string title3 = repo.DHSMainWindow.CarouselImageButton.FindSingle <Text>("./text[2]").TextValue; string title4 = repo.DHSMainWindow.CarouselImageButtonTwo.FindSingle <Text>("./text[2]").TextValue; Button picbutton = repo.DHSMainWindow.CarouselImageButton; string title = title3; if (title1 == title3) { title = title4; picbutton = repo.DHSMainWindow.CarouselImageButtonTwo; } System.Console.WriteLine(title); picbutton.Click(); Delay.Milliseconds(1000); Dictionary <string, string> dict = GetArticleNameFromTitle(title); DHSCategory.CheckCategoryOnLeftMenu(dict["category"]); DHSArticle.CheckArticleOnContentPanel(dict["category"], dict["article"]); // back repo.DHSMainWindow.BackButton.Click(); } }