Пример #1
0
		public void LoginToSite()
		{
			var doc = XDocument.Load(@"BVT\" + Settings.Default.BVTDataFile);

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

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

			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Security Roles BVT'");
			Trace.WriteLine(BasePage.PreconditionsKeyWord);

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

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

			ManageRolesPage manageRolesPage = new ManageRolesPage(_driver);
			manageRolesPage.OpenUsingControlPanel(_baseUrl);
			manageRolesPage.AddNewSecurityRole(_assignedRoleName);

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingControlPanel(_baseUrl);
			manageUsersPage.AddNewUser(_userName, _userDisplayName, _userEmail, _userPassword);
		}
Пример #2
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("adminExtensions");

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

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

			_adminExtensionToEdit = pageSettings.Attribute("adminExtensionToEdit").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");
			
			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingControlPanel(_baseUrl);
			manageUsersPage.AddNewUser("Admin", "Admin", "*****@*****.**", "dnnadmin");
			manageUsersPage.ManageRoles("Admin");
			manageUsersPage.AssignRoleToUser("Administrators");
			
			_loginPage.LoginUsingUrl(_baseUrl, "Admin", "dnnadmin");
		}
Пример #3
0
		public void Test001_AddUser()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new User'");

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);

			manageUsersPage.OpenUsingControlPanel(_baseUrl);

			int itemNumber = manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count;

			manageUsersPage.AddNewUser(_userName, _userDisplayName, _userEmail, _userPassword);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the list increased by 1");
			Assert.That(manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count, Is.EqualTo(itemNumber + 1),
						"The User is not added correctly");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the User is present in the list");
			Assert.IsTrue(manageUsersPage.ElementPresent(By.XPath("//tr/td[text() = '" + _userName + "']")),
						"The User is not added correctly");
		}
Пример #4
0
		public void Test006_DeleteUser()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Delete the User'");

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingControlPanel(_baseUrl);

			int itemNumber = manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count;

			manageUsersPage.DeleteUser(_userName);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the list is not changed");
			Assert.That(manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count, Is.EqualTo(itemNumber),
						"The User is not deleted correctly");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the User is present in the list");
			Assert.IsTrue(manageUsersPage.ElementPresent(By.XPath("//tr/td[text() = '" + _userName + "']")),
						"The User is not deleted correctly");
		}
Пример #5
0
		public void Test004_RegisterUser()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Register the User'");

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

			_loginPage.LetMeOut();

			_loginPage.DoRegisterUsingRegisterLink(_registeredUserName, _registeredUserDisplayName, _registeredUserEmail, _registeredUserPassword);

			_driver.Navigate().Refresh();

			_loginPage.WaitForElement(By.XPath("//*[@id='" + LoginPage.LoginLink + "' and not(contains(@href, 'Logoff'))]"), 20).WaitTillVisible(20).Click();

			_loginPage.DoLoginUsingLoginLink("host", "dnnhost");

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingUrl(_baseUrl);

			manageUsersPage.AuthorizeUser(_registeredUserName);

			manageUsersPage.OpenUsingControlPanel(_baseUrl);

			_loginPage.LoginUsingLoginLink(_registeredUserName, _registeredUserPassword);

			mainPage.OpenUsingUrl(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the User is present on the screen");
			Assert.That(mainPage.FindElement(By.Id(BasePage.RegisteredUserLink)).Text, Is.EqualTo(_registeredUserDisplayName),
					"The registered User is not logged in correctly");
		}
Пример #6
0
		public void Test003_RemoveDeletedUser()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Remove the User'");

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);

			manageUsersPage.OpenUsingControlPanel(_baseUrl);

			int itemNumber = manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count;

			manageUsersPage.RemoveDeletedUser(_userName);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the list decreased by 1");
			Assert.That(manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count, Is.EqualTo(itemNumber - 1),
						"The User is not removed correctly");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the User is not present in the list");
			Assert.IsFalse(manageUsersPage.ElementPresent(By.XPath("//tr[td[text() = '" + _userName + "']]")),
						"The User is not removed correctly");
		}
Пример #7
0
		public void Test004_AssignRoleToUser()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Assign the Role to User'");

			ManageUsersPage manageUsersPage = new ManageUsersPage(_driver);
			manageUsersPage.OpenUsingControlPanel(_baseUrl);

			manageUsersPage.ManageRoles(_userName);

			manageUsersPage.AssignRoleToUser(_assignedRoleName);

			ManageRolesPage manageRolesPage = new ManageRolesPage(_driver);

			manageRolesPage.OpenUsingControlPanel(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of Users assigned to the Role");
			Assert.That("1", Is.EqualTo(manageRolesPage.FindElement(By.XPath("//tr[td[text() = '" + _assignedRoleName + "']]/td[13]")).Text),
						"The role is not assigned correctly to User");
		}