public void Test002_EditDefaultHTMLModuleOnPage() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit Default HTML Module on the Page'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, _pageName); blankPage.SetPageToEditMode(); var module = new Modules(_driver); Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:"); string moduleNumber = module.WaitForElement(By.XPath(Modules.CommonModulesDescription["HtmlModule"].IdWhenOnPage + "/a")).GetAttribute("name"); module.AddContentToHTMLModule(moduleNumber, _pageContent); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module content is present on the screen"); Assert.That( blankPage.FindElement(By.XPath("//div[contains(@class, 'DNN_HTML DnnModule-')]//div[contains(@id, 'lblContent')]")). Text, Is.EqualTo(_pageContent)); }
public void DeleteModule(Dictionary<string, Modules.ModuleIDs> modulesDescription, string pageName, string moduleName, string location) { var module = new Modules(_driver); string moduleNameOnPage = modulesDescription[moduleName].IdWhenOnPage; string locationOnPage = Modules.LocationDescription[location].IdWhenOnPage; Trace.WriteLine(BasePage.RunningTestKeyWord + "'Delete the Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); blankPage.SetPageToEditMode(); string moduleNumber = module.WaitForElement(By.XPath(locationOnPage + moduleNameOnPage + "/a")).GetAttribute("name"); module.DeleteModule(moduleNumber); blankPage.OpenUsingUrl(_baseUrl, pageName); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the module " + moduleNumber + " deleted"); Assert.IsFalse(module.ElementPresent(By.XPath(locationOnPage + moduleNameOnPage + "/a[@name = '" + moduleNumber + "']")), "The Module is not deleted correctly"); }
public void EditContentOfExistingModuleWithCopy(string assyName, string moduleClassName, Dictionary<string, Modules.ModuleIDs> modulesDescription, string pageName, string moduleContent) { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit content to HTML Module'"); var module = new Modules(_driver); var mainPage = new MainPage(_driver); mainPage.OpenUsingUrl(_baseUrl); string moduleNameOnPage = modulesDescription["ContactUsModule"].IdWhenOnPage; string locationOnPage = Modules.LocationDescription["ContentPane"].IdWhenOnPage; Trace.WriteLine(BasePage.TraceLevelPage + "Find the original module number on 'Home' page"); string originalModuleNumber = mainPage.WaitForElement(By.XPath(Modules.LocationDescription["FooterRightPane"].IdWhenOnPage + "/div[last()]/a")).GetAttribute("name"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); blankPage.SetPageToEditMode(); Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:"); string moduleNumberOnNewPage = module.WaitForElement(By.XPath(locationOnPage + moduleNameOnPage + "/a")).GetAttribute("name"); GetHTMLModule(assyName, moduleClassName, moduleNumberOnNewPage, moduleContent); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the module Content is present on the page"); Assert.That(moduleContent, Is.EqualTo( module.FindElement( By.XPath("//div[contains(@class, 'DNN_HTML DnnModule-" + moduleNumberOnNewPage + "')]//div[contains(@id, 'lblContent')]")).Text)); mainPage.OpenUsingUrl(_baseUrl); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the module Content changed on 'Home' page"); Assert.That(moduleContent, Is.Not.EqualTo( module.WaitForElement( By.XPath("//div[contains(@class, 'DNN_HTML DnnModule-" + originalModuleNumber + "')]//div[contains(@id, 'lblContent')]")).Text)); }
public void DragAndDropModuleToLeftPane(Dictionary<string, Modules.ModuleIDs> modulesDescription, string pageName, string moduleName, string newLocation) { var module = new Modules(_driver); string moduleNameOnPage = modulesDescription[moduleName].IdWhenOnPage; string locationOnPage = Modules.LocationDescription[newLocation].IdWhenOnPage; Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag and drop a Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); blankPage.SetPageToEditMode(); string moduleNumber = blankPage.WaitForElement(By.XPath(moduleNameOnPage + "/a")).GetAttribute("name"); module.MoveModuleUsingDragAndDrop(moduleNumber, locationOnPage); blankPage.OpenUsingUrl(_baseUrl, pageName); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module new location: " + locationOnPage + moduleNameOnPage); Assert.IsTrue(blankPage.ElementPresent(By.XPath(locationOnPage + moduleNameOnPage)), "Module is not found"); }