private void ValidatePage(string Heading) { string pageHeading; Thread.Sleep(5000); myManager.ActiveBrowser.Window.SetFocus(); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); ObjStanderd standerdpage = new ObjStanderd(myManager); Element Headingverification = standerdpage.Headingverification; pageHeading = Headingverification.InnerText; Assert.AreEqual(pageHeading, Heading, "Headings dont match"); }
public void EditStanderPage(string Name, string TopContent) { //Click On the Edit Button Thread.Sleep(20000); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan EditButton = myManager.ActiveBrowser.Find.ByExpression("id=#dijit_form_ToggleButton_.", "title=All Properties").As <HtmlSpan>(); HtmlSpan EditButtonSpan = EditButton.Find.AllByTagName("span")[0].As <HtmlSpan>(); EditButtonSpan.ScrollToVisible(); EditButtonSpan.MouseHover(); EditButtonSpan.MouseClick(); Thread.Sleep(7000); //Click on the rightTogglebar to get blocks ObjEditMode editmode = new ObjEditMode(myManager); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan righttogglebar = editmode.RightPane.As <HtmlSpan>(); righttogglebar.MouseClick(); //click on the pin icon Thread.Sleep(5000); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan PagesTreePin = editmode.RightSideBLockPin.As <HtmlSpan>(); PagesTreePin.MouseClick(); //Search for the top block HtmlInputText Searchforblocks = editmode.RightPaneSearchText.As <HtmlInputText>(); Searchforblocks.Text = TopContent; Searchforblocks.MouseClick(); myManager.Desktop.Mouse.Click(MouseClickType.LeftClick, Searchforblocks.GetRectangle()); myManager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter); Thread.Sleep(5000); myManager.ActiveBrowser.RefreshDomTree(); //Selected dev HtmlDiv Kbanner = myManager.ActiveBrowser.Find.ById("dgrid_4-row-16206").As <HtmlDiv>(); HtmlDiv topcontentarea = editmode.topcontentarea.As <HtmlDiv>(); var des = new System.Drawing.Point(); des.X = topcontentarea.ScrollTop + 50; des.Y = topcontentarea.ScrollLeft + 50; Kbanner.DragTo(topcontentarea, ArtOfTest.Common.OffsetReference.TopCenter, des); //Add other details ObjStanderd standerdpage = new ObjStanderd(myManager); HtmlInputText Heading = standerdpage.Heading.As <HtmlInputText>(); HtmlTextArea Introduction = standerdpage.Introduction.As <HtmlTextArea>(); //adding just the heading wont add the text to the contorl Heading.ScrollToVisible(); Heading.MouseHover(); Heading.MouseClick(); Heading.Text = _Heading; Introduction.ScrollToVisible(); Introduction.MouseHover(); Introduction.MouseClick(); Introduction.Text = _Introduction; ArtOfTest.WebAii.Core.Browser t1_frame = myManager.ActiveBrowser.Frames[0]; Element TextEditor = t1_frame.Find.ByXPath("/html/body"); myManager.ActiveBrowser.Actions.SetText(TextEditor, _BodyText); //Publish //Click on publish HtmlSpan PublishButton = editmode.PublishDropdown.As <HtmlSpan>(); PublishButton.ScrollToVisible(); PublishButton.MouseHover(); PublishButton.MouseClick(); Thread.Sleep(2000); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan Publish = editmode.PublishButton.As <HtmlSpan>(); Publish.MouseHover(); Publish.MouseClick(); Thread.Sleep(10000); myManager.ActiveBrowser.Refresh(); //Click on options dropdown myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan OptionsButton = editmode.OptionsButton.As <HtmlSpan>(); OptionsButton.ScrollToVisible(); OptionsButton.MouseHover(); OptionsButton.MouseClick(); //Click on the URL Thread.Sleep(5000); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlDiv OptionsDropdown = editmode.OptionsDropdown.As <HtmlDiv>(); HtmlAnchor pagelink = OptionsDropdown.Find.AllByTagName <HtmlAnchor>("a")[0]; pagelink.MouseClick(); Thread.Sleep(2000); ValidatePage(_Heading); }
public void TestMethod_StanderdPage() { ReadData(); //Login //Login to the system myManager.ActiveBrowser.NavigateTo(_Url); CommonFunctions.HandleSpashScreen(myManager, myManager.ActiveBrowser); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); CommonFunctions.Login(myManager, myManager.ActiveBrowser, _Uname, _Password); Thread.Sleep(7000); //Navigate to customer myManager.ActiveBrowser.NavigateTo(_Url + "/customer/"); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); Thread.Sleep(5000); ObjEditMode editmode = new ObjEditMode(myManager); Thread.Sleep(5000); myManager.ActiveBrowser.RefreshDomTree(); //Click On episerverButton HtmlUnorderedList Epilink = editmode.Episerverlink.As <HtmlUnorderedList>(); Epilink.MouseClick(); //it takes more than 15seconds to load the edit mode Thread.Sleep(30000); myManager.ActiveBrowser.Refresh(); Thread.Sleep(25000); //Click on left sub tree myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan PagesTree = editmode.PagesTree.As <HtmlSpan>(); PagesTree.MouseClick(); //Click on leftmenu anchor Thread.Sleep(5000); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan PagesTreeAnchor = editmode.PagesTreePin.As <HtmlSpan>(); PagesTreeAnchor.MouseClick(); //------------------------------------------------------------------------------------------------------------------------------------- //CLick on customer Branch to create a new file Thread.Sleep(5000); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlSpan NewpageDropDown = editmode.CustomerNewDropdown.As <HtmlSpan>(); NewpageDropDown.MouseClick(); //Click On New Page Thread.Sleep(3000); myManager.ActiveBrowser.WaitUntilReady(); myManager.ActiveBrowser.RefreshDomTree(); HtmlTableCell newPage = editmode.CustomerNewPage.As <HtmlTableCell>();; newPage.MouseClick(); //Add a name to the page Thread.Sleep(3000); myManager.ActiveBrowser.RefreshDomTree(); ObjStanderd standerd = new ObjStanderd(myManager); HtmlInputText PageName = standerd.PageName.As <HtmlInputText>(); PageName.ScrollToVisible(); PageName.MouseHover(); PageName.MouseClick(); PageName.Text = _Name; //Find The Community List Thread.Sleep(5000); myManager.ActiveBrowser.RefreshDomTree(); HtmlDiv CommunityArea = myManager.ActiveBrowser.Find.ById("dijit__KeyNavContainer_1").As <HtmlDiv>(); HtmlUnorderedList CommunityPages = CommunityArea.Find.AllByTagName("ul")[0].As <HtmlUnorderedList>(); System.Collections.ObjectModel.ReadOnlyCollection <HtmlListItem> CommunityItems = CommunityPages.Find.AllByTagName <HtmlListItem>("li"); foreach (HtmlListItem item in CommunityItems) { if (item.InnerText.Contains("[Community] Standard Page")) { item.MouseClick(); Thread.Sleep(2000); myManager.ActiveBrowser.RefreshDomTree(); EditStanderPage(_Name, _TopContent); Thread.Sleep(20000); //ValidateStanderPag(_Heading); break; } } }