Exemplo n.º 1
0
		public void LoginToSite()
		{
			var doc = XDocument.Load(@"P1\" + Settings.Default.P1DataFile);

			XElement settings = doc.Document.Element("Tests").Element("settings");
			XElement pageSettings = doc.Document.Element("Tests").Element("page");

			string testName = pageSettings.Attribute("name").Value;

			_driver = StartBrowser(settings.Attribute("browser").Value);
			_baseUrl = settings.Attribute("baseURL").Value;

			Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'");
			Trace.WriteLine(BasePage.PreconditionsKeyWord);

			MainPage mainPage = new MainPage(_driver);
			mainPage.OpenUsingUrl(_baseUrl);

			_loginPage = new LoginPage(_driver);
			_loginPage.OpenUsingUrl(_baseUrl);
			_loginPage.DoLoginUsingUrl("host", "dnnhost");

			//Preconditions for
			AdminPageManagementPage adminPageManagementPage = new AdminPageManagementPage(_driver);
			adminPageManagementPage.OpenUsingButtons(_baseUrl);
			adminPageManagementPage.AddPagesInBulk("Page", 73, "Web", "Home");

			BlankPage blankPage = new BlankPage(_driver);

			Modules module = new Modules(_driver);
			
			int pageNumber = 1;
			while (pageNumber < 74)
			{
				blankPage.OpenUsingUrl(_baseUrl, "Home/Page" + pageNumber);
				blankPage.SetPageToEditMode("Home/Page" + pageNumber);
				string moduleNumber = module.WaitForElement(By.XPath(Modules.ContentPaneID + Modules.HtmlProModuleOnPage + "/a")).GetAttribute("name");
				module.DeleteModule(moduleNumber);
				pageNumber++;
			}

			blankPage.OpenUsingUrl(_baseUrl, "Home/Page61");
			module.OpenModulePanelUsingControlPanel();
			int i = 1;
			while (i < 5)
			{
				module.AddNewModuleUsingMenu(Modules.HtmlProModule, Modules.HtmlProModuleOnPage, Modules.ContentPaneOption, Modules.ContentPaneID);
				i++;
			}
			
		}
Exemplo n.º 2
0
		public void Test002_AddModule()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Module'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			Modules 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.HtmlProModuleOnPage);
			Assert.IsTrue(blankPage.ElementPresent(By.XPath(Modules.LeftPaneID + Modules.HtmlProModuleOnPage)), "Module is not found");
		}
Exemplo n.º 3
0
		public void Test002_EditDefaultHTMLModuleOnPage()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit Default HTML Module on the Page'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);
			blankPage.SetPageToEditMode(_pageName);

			Modules module = new Modules(_driver);
			Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:");
			string moduleNumber = module.WaitForElement(By.XPath(Modules.HtmlProModuleOnPage + "/a")).GetAttribute("name");

			module.AddContentToHTMLProModule(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));
		}
Exemplo n.º 4
0
		public void Test006_DeleteModule()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Delete the Module'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			Modules module = new Modules(_driver);
			Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:");
			string moduleNumber = module.WaitForElement(By.XPath(Modules.LeftPaneID + Modules.HtmlProModuleOnPage + "/a")).GetAttribute("name");
			module.DeleteModule(moduleNumber);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the module " + moduleNumber + " deleted");
			Assert.IsFalse(module.ElementPresent(By.XPath("//div[contains(@class, 'DNN_HTML DnnModule-" + moduleNumber + "')]")),
					"The Module is not deleted correctly");
		}
Exemplo n.º 5
0
		public void Test005_EditModuleSettings()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit Module settings'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			Modules module = new Modules(_driver);

			Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:");
			string moduleNumber = module.WaitForElement(By.XPath(Modules.LeftPaneID + Modules.HtmlProModuleOnPage + "/a")).GetAttribute("name");
			module.EditModuleSettings(moduleNumber, _moduleTitle);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT a new Module Title is present on the page");
			StringAssert.Contains(_moduleTitle.ToUpper(), blankPage.WaitForElement(By.XPath("//div[contains(@class, 'DNN_HTML DnnModule-" + moduleNumber + "')]//span[contains(@id, '" + BasePage.PageTitle + "')]")).Text.ToUpper(),
						"The  new Module Title is not saved correctly");
		}
Exemplo n.º 6
0
		public void Test004_EditModule()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add content to HTML Module'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			Modules module = new Modules(_driver);
			Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:");
			string moduleNumber = module.WaitForElement(By.XPath(Modules.LeftPaneID + Modules.HtmlModuleOnPage + "/a")).GetAttribute("name");

			module.AddContentToHTMLModule(moduleNumber, _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-" + moduleNumber + "')]//div[contains(@id, 'lblContent')]")).Text));
		}
Exemplo n.º 7
0
		public void Test0014_EditContentOfExistingModule(string pageName, string moduleContent)
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit content to HTML Module'");

			Modules module = new Modules(_driver);

			MainPage mainPage = new MainPage(_driver);
			mainPage.OpenUsingUrl(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "Find the original module number on 'Home' page");
			string originalModuleNumber = mainPage.WaitForElement(By.XPath(Modules.FooterRightPaneID + "/div[last()]/a")).GetAttribute("name");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, pageName);
			blankPage.SetPageToEditMode(pageName);

			Trace.WriteLine(BasePage.TraceLevelElement + "Find the Module number:");
			string moduleNumberOnNewPage = module.WaitForElement(By.XPath(Modules.ContentPaneID + Modules.HtmlProModuleOnPage + "/a")).GetAttribute("name");

			module.AddContentToHTMLProModule(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));
		}
Exemplo n.º 8
0
		public void Test0013_AddExistingModuleWithCopy(string pageName)
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add Existing Module, Make a Copy'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, pageName);

			Modules module = new Modules(_driver);
			module.OpenExistingModulePanelUsingControlPanel();

			blankPage.LoadableSelectByValue(By.XPath(Modules.PageDropDownId), "Home");
			blankPage.WaitForElement(By.XPath(Modules.List + "[1]"));
			blankPage.CheckBoxCheck(By.XPath(Modules.MakeACopyCheckbox));

			module.AddNewModuleUsingMenu(Modules.ContactUsModule, Modules.HtmlProModuleOnPage, Modules.ContentPaneOption, Modules.ContentPaneID);
			string moduleNumber = blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[last()]/a")).GetAttribute("name");

			blankPage.OpenUsingUrl(_baseUrl, pageName);
			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + Modules.ContentPaneID + Modules.ContactUsModule);
			Assert.IsTrue(blankPage.ElementPresent(By.XPath(Modules.ContentPaneID + Modules.HtmlProModuleOnPage + "/a[@name='" + moduleNumber + "']")), "Module is not found");
		}
Exemplo n.º 9
0
		public void Test0010_DragAngDropHTMLModulesToAllPanesOnPage(string pageName, string moduleName, string moduleNameOnPage, string locationID)
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag & Drop HTML Module'");

			Modules module = new Modules(_driver);

			var fiModuleName = module.GetType().GetField(moduleName);
			moduleName = (string)fiModuleName.GetValue(null);

			var fiModuleNameOnPage = module.GetType().GetField(moduleNameOnPage);
			moduleNameOnPage = (string)fiModuleNameOnPage.GetValue(null);

			var fiLocationID = module.GetType().GetField(locationID);
			locationID = (string)fiLocationID.GetValue(null);

			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag And Drop a new Module'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, pageName);

			module.OpenModulePanelUsingControlPanel();
			module.AddNewModuleUsingDragAndDrop(moduleName, moduleNameOnPage, locationID);
			string moduleNumber = blankPage.WaitForElement(By.XPath(locationID + "/div[last()]/a")).GetAttribute("name");

			blankPage.OpenUsingUrl(_baseUrl, pageName);
			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module location: " + locationID + moduleNameOnPage);
			Assert.IsTrue(blankPage.ElementPresent(By.XPath(locationID + moduleNameOnPage + "/a[@name='" + moduleNumber + "']")), "Module is not found");
		}
Exemplo n.º 10
0
		public void Test008_DragAndDropModuleToLeftPane(string pageName, string moduleNameOnPage, string newLocationID)
		{
			Modules module = new Modules(_driver);

			var fiModuleNameOnPage = module.GetType().GetField(moduleNameOnPage);
			moduleNameOnPage = (string)fiModuleNameOnPage.GetValue(null);

			var fiNewLocationID = module.GetType().GetField(newLocationID);
			newLocationID = (string)fiNewLocationID.GetValue(null);

			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Drag and drop a Module'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, pageName);

			blankPage.SetPageToEditMode(pageName);
			string moduleNumber = blankPage.WaitForElement(By.XPath(moduleNameOnPage + "/a")).GetAttribute("name");
			module.MoveModuleUsingDragAndDrop(moduleNumber, moduleNameOnPage, newLocationID);

			blankPage.OpenUsingUrl(_baseUrl, pageName);
			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Module new location: " + newLocationID + moduleNameOnPage);
			Assert.IsTrue(blankPage.ElementPresent(By.XPath(newLocationID + moduleNameOnPage)), "Module is not found");
		}
Exemplo n.º 11
0
		public void Test0064_MoveHTMLModuleWithinContentPaneDown(string pageName)
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Move a HTML Module DOWN'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, pageName);

			Modules module = new Modules(_driver);
			module.SetPageToEditMode(pageName);
			string moduleNumber1 = blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[2]/a")).GetAttribute("name");
			string moduleNumber2 = blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[3]/a")).GetAttribute("name");
			string moduleNumber3 = blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[4]/a")).GetAttribute("name");
			string moduleNumber4 = blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[5]/a")).GetAttribute("name");

			module.MoveModuleUsingMenu(moduleNumber2, Modules.HtmlProModuleOnPage, Modules.DownOption);

			Assert.That(blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[2]/a")).GetAttribute("name"), Is.EqualTo(moduleNumber1), "Module is not found");
			Assert.That(blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[3]/a")).GetAttribute("name"), Is.EqualTo(moduleNumber3), "Module is not found");
			Assert.That(blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[4]/a")).GetAttribute("name"), Is.EqualTo(moduleNumber2), "Module is not found");
			Assert.That(blankPage.WaitForElement(By.XPath(Modules.ContentPaneID + "/div[5]/a")).GetAttribute("name"), Is.EqualTo(moduleNumber4), "Module is not found");
		}
Exemplo n.º 12
0
		public void Test004_DeletePage()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Delete a Page'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);

			blankPage.DeletePage(_pageName);

			AdminPageManagementPage adminPageManagementPage = new AdminPageManagementPage(_driver);
			adminPageManagementPage.OpenUsingButtons(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the page: " + _pageName + "is NOT present in the list");
			Assert.IsFalse(adminPageManagementPage.ElementPresent(By.XPath("//div[contains(@id, 'Tabs_ctlPages')]//li[@class= 'rtLI']//span[contains(text(), '" + _pageName + "')]")),
				"The page is present in the list");

			AdminRecycleBinPage adminRecycleBinPage = new AdminRecycleBinPage(_driver);
			adminRecycleBinPage.OpenUsingButtons(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the page: " + _pageName + "is present in Recycle Bin");
			Assert.IsTrue(adminRecycleBinPage.ElementPresent(By.XPath(AdminRecycleBinPage.RecycleBinPageContainerOption + "[contains(text(), '" + _pageName + "')]")));
		}
Exemplo n.º 13
0
		public void Test008_EditHostPage()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit a Host Page'");

			AdminPageManagementPage adminPageManagementPage = new AdminPageManagementPage(_driver);
			adminPageManagementPage.OpenUsingButtons(_baseUrl);

			adminPageManagementPage.AddDescriptionToPage(_pageName, _pageDescription, "Host");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, "Host/" + _addHostAfter + "/" + _pageName);
			blankPage.SelectMenuOption(BasePage.ControlPanelEditPageOption, BasePage.PageSettingsOption);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the page description: " + _pageName1 + "is saved correctly");
			Assert.That(_pageDescription, Is.EqualTo(blankPage.WaitForElement(By.XPath(BlankPage.PageDescriptionTextBox)).Text),
							"The page description is not added correctly");
		}
Exemplo n.º 14
0
		public void Test004_EditPageSettings()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Edit the Page Settings'");

			BlankPage blankPage = new BlankPage(_driver);
			blankPage.OpenUsingUrl(_baseUrl, _pageName);
			blankPage.SelectMenuOption(BasePage.ControlPanelEditPageOption, BasePage.PageSettingsOption);

			blankPage.EditPageTitle(_pageTitle);

			Trace.WriteLine("Verify Page title: '" + _pageTitle + "'");
			StringAssert.Contains(_pageTitle, blankPage.CurrentWindowTitle(), "The Page title is not correct");
		}