public void LoginToSite() { XDocument doc = XDocument.Load(DataFileLocation); XElement settings = doc.Document.Element("Tests").Element("settings"); XElement testSettings = doc.Document.Element("Tests").Element("modules"); string testName = testSettings.Attribute("name").Value; _driver = StartBrowser(settings.Attribute("browser").Value); _baseUrl = settings.Attribute("baseURL").Value; Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'"); Trace.WriteLine(BasePage.PreconditionsKeyWord); OpenMainPageAndLoginAsHost(); //Create a Page var blankPage = new BlankPage(_driver); blankPage.OpenAddNewPageFrameUsingControlPanel(_baseUrl); blankPage.AddNewPage("page"); //Delete Default HTML Module on page blankPage.OpenUsingUrl(_baseUrl,"page"); var module = new Modules(_driver); Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:"); string moduleNumber = module.WaitForElement(By.XPath(Modules.LocationDescription["ContentPane"].IdWhenOnPage + Modules.CommonModulesDescription["HtmlModule"].IdWhenOnPage + "/a")).GetAttribute("name"); module.DeleteModule(moduleNumber); //Export new page as Default var pageExportPage = new PageExportPage(_driver); pageExportPage.OpenUsingControlPanel(_baseUrl + "/page"); pageExportPage.ExportPage("Default", "NewDefault"); //Create set of pages with New Default var adminPageManagementPage = new AdminPageManagementPage(_driver); adminPageManagementPage.OpenUsingButtons(_baseUrl); adminPageManagementPage.AddPagesInBulk(">" + "Page", "P1Modules", 65, AdminPageManagementPage.PageType.Web, "Home"); //Create set of pages for Drag&Drop tests with New Default adminPageManagementPage.OpenUsingButtons(_baseUrl); adminPageManagementPage.AddPagesInBulk(">" + "Page", "P1ModulesDragDrop", 65, AdminPageManagementPage.PageType.Web, "Home"); //Create a page with 4 HtmlModuleDictionary Modules on page blankPage.OpenUsingUrl(_baseUrl, "Home/P1Modules/Page61"); module.OpenModulePanelUsingControlPanel(); int i = 1; while (i < 5) { module.AddNewModuleUsingMenu(HtmlModuleDictionary.IdWhenOnBanner, HtmlModuleDictionary.IdWhenOnPage, "ContentPane"); i++; } _logContent = LogContent(); }
public void Test001_CountAvailableModules() { var mainPage = new MainPage(_driver); mainPage.OpenUsingUrl(_baseUrl); var modules = new Modules(_driver); modules.OpenModulePanelUsingControlPanel(); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of available Modules: " + Modules.NumberOfAvailableModules); Assert.That(modules.FindElements(By.XPath(Modules.List)).Count, Is.EqualTo(Modules.NumberOfAvailableModules), "The number of available Modules is not correct"); }
public void Test001_AddModule() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, _pageName); var module = new Modules(_driver); module.OpenModulePanelUsingControlPanel(); module.AddNewModuleUsingDragAndDrop(Modules.HtmlModule, Modules.HtmlModuleOnPage, Modules.LeftPaneID); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + Modules.LeftPaneID + Modules.HtmlModuleOnPage); Assert.IsTrue(blankPage.ElementPresent(By.XPath(Modules.LeftPaneID + Modules.HtmlModuleOnPage)), "Module is not found"); }
public void Test001_AddModule() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, _pageName); var module = new Modules(_driver); module.OpenModulePanelUsingControlPanel(); module.AddNewModuleUsingMenu(Modules.CommonModulesDescription["HtmlModule"].IdWhenOnBanner, Modules.CommonModulesDescription["HtmlModule"].IdWhenOnPage, "LeftPane"); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + Modules.LocationDescription["LeftPane"].IdWhenOnPage + Modules.CommonModulesDescription["HtmlModule"].IdWhenOnPage); Assert.IsTrue(blankPage.ElementPresent(By.XPath(Modules.LocationDescription["LeftPane"].IdWhenOnPage + Modules.CommonModulesDescription["HtmlModule"].IdWhenOnPage)), "Module is not found"); }
public void AddModuleToContentPaneOnNewPage(Dictionary<string, Modules.ModuleIDs> modulesDescription, string pageName, string moduleName, string location) { var module = new Modules(_driver); string moduleNameOnPage = modulesDescription[moduleName].IdWhenOnPage; string moduleNameOnBanner = modulesDescription[moduleName].IdWhenOnBanner; string locationOnPage = Modules.LocationDescription[location].IdWhenOnPage; Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); module.OpenModulePanelUsingControlPanel(); module.AddNewModuleUsingMenu(moduleNameOnBanner, moduleNameOnPage, location); string moduleNumber = blankPage.WaitForElement(By.XPath(locationOnPage + "/div[last()]/a")).GetAttribute("name"); blankPage.CloseEditMode(); blankPage.OpenUsingUrl(_baseUrl, pageName); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + location + moduleName); Assert.IsTrue( blankPage.ElementPresent(By.XPath(locationOnPage + moduleNameOnPage + "/a[@name='" + moduleNumber + "']")), "Module is not found"); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Edit Mode is closed: "); Assert.IsFalse( blankPage.ElementPresent(By.XPath(ControlPanelIDs.PageInEditMode)), "The Edit Mode is not closed"); }
public void DragAngDropHTMLModulesToAllPanesOnPage(Dictionary<string, Modules.ModuleIDs> modulesDescription, string pageName, string moduleName, string location) { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag & Drop HTML Module'"); var module = new Modules(_driver); string moduleNameOnPage = modulesDescription[moduleName].IdWhenOnPage; string moduleNameOnBanner = modulesDescription[moduleName].IdWhenOnBanner; string locationOnPage = Modules.LocationDescription[location].IdWhenOnPage; Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag And Drop a new Module'"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); module.OpenModulePanelUsingControlPanel(); module.AddNewModuleUsingDragAndDrop(moduleNameOnBanner, location); string moduleNumber = blankPage.WaitForElement(By.XPath(locationOnPage + "/div[last()]/a")).GetAttribute("name"); blankPage.OpenUsingUrl(_baseUrl, pageName); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + locationOnPage + moduleNameOnPage); Assert.IsTrue( blankPage.ElementPresent(By.XPath(locationOnPage + moduleNameOnPage + "/a[@name='" + moduleNumber + "']")), "Module is not found"); }
public void AddModule(string pageName, Dictionary<string, Modules.ModuleIDs> modulesDescription, string moduleName, string pane) { Trace.WriteLine(BasePage.TraceLevelComposite + "Add a new Module to Page: '"); var blankPage = new BlankPage(_driver); blankPage.OpenUsingUrl(_baseUrl, pageName); var module = new Modules(_driver); string moduleNameOnPage = modulesDescription[moduleName].IdWhenOnPage; string moduleNameOnBanner = modulesDescription[moduleName].IdWhenOnBanner; module.OpenModulePanelUsingControlPanel(); module.AddNewModuleUsingMenu(moduleNameOnBanner, moduleNameOnPage, pane); blankPage.CloseEditMode(); }