Esempio n. 1
0
		public void Test004_AssignRoleToRoleGroup()
		{
			Trace.WriteLine(BasePage.RunningTestKeyWord + "'Assign the Role to Role Group'");

			var manageRolesPage = new ManageRolesPage(_driver);

			manageRolesPage.OpenUsingControlPanel(_baseUrl);
			manageRolesPage.SlidingSelectByValue(By.XPath("//a[contains(@id, '" + ManageRolesPage.FilterByGroupArrow + "')]"),
			                                     By.XPath(ManageRolesPage.FilterByGroupDropdown), _assignedRoleGroupName);

			int itemNumber = manageRolesPage.FindElements(By.XPath("//table/tbody/tr[contains(@id, 'Roles_grdRoles')]")).Count;

			manageRolesPage.OpenUsingControlPanel(_baseUrl);
			manageRolesPage.AssignSecurityRoleToGroup(_roleName, _assignedRoleGroupName);

			manageRolesPage.OpenUsingControlPanel(_baseUrl);
			manageRolesPage.SlidingSelectByValue(By.XPath("//a[contains(@id, '" + ManageRolesPage.FilterByGroupArrow + "')]"),
			                                     By.XPath(ManageRolesPage.FilterByGroupDropdown), _assignedRoleGroupName);
			manageRolesPage.WaitForElement(By.XPath("//table[contains(@id, 'Roles_grdRoles')]/tbody/tr[last()]"));

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of Security roles assigned to the Group");
			Assert.That(itemNumber + 1,
			            Is.EqualTo(
				            manageRolesPage.FindElements(By.XPath("//table/tbody/tr[contains(@id, 'Roles_grdRoles')]")).Count),
			            "The role is not assigned correctly to Group");

			Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Security role is present in the Group list");
			Assert.IsTrue(manageRolesPage.ElementPresent(By.XPath("//tr[td[text() = '" + _roleName + "']]")),
			              "The Role is not assigned correctly to Group");
		}