コード例 #1
0
		public void Test001_AddSecurityRoleGroup()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Security Role Group'");

			var manageRolesPage = new ManageRolesPage(_driver);

			manageRolesPage.OpenUsingControlPanel(_baseUrl);

			int itemNumber = manageRolesPage.FindElements(By.XPath(ManageRolesPage.FilterByGroupDropdownList)).Count;

			manageRolesPage.AddNewSecurityRoleGroup(_roleGroupName);

			manageRolesPage.OpenUsingControlPanel(_baseUrl);

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the drop-down increased by 1");
			Assert.That(itemNumber + 1,
			            Is.EqualTo(manageRolesPage.FindElements(By.XPath(ManageRolesPage.FilterByGroupDropdownList)).Count),
			            "The security role is not added correctly");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Security role group is present in the list");
			Assert.IsTrue(
				manageRolesPage.ElementPresent(
					By.XPath(ManageRolesPage.FilterByGroupDropdownList + "[text() = '" + _roleGroupName + "']")),
				"The Security role is not added correctly");
		}
コード例 #2
0
		public void LoginToSite()
		{
			XDocument doc = XDocument.Load(DataFileLocation);

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

			string testName = testSettings.Attribute("name").Value;
			_roleGroupName = testSettings.Attribute("roleGroupName").Value;
			_roleGroupDescription = testSettings.Attribute("roleGroupDescription").Value;
			_roleName = testSettings.Attribute("roleName").Value;
			_assignedRoleGroupName = testSettings.Attribute("assignedRoleGroupName").Value;

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

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

			OpenMainPageAndLoginAsHost();

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

			manageRolesPage.OpenUsingControlPanel(_baseUrl);
			manageRolesPage.AddNewSecurityRoleGroup(_assignedRoleGroupName);
		}