public void LoginToSite() { XDocument doc = XDocument.Load(DataFileLocation); XElement settings = doc.Document.Element("Tests").Element("settings"); XElement testSettings = doc.Document.Element("Tests").Element("securityRoles"); _driver = StartBrowser(settings.Attribute("browser").Value); _baseUrl = settings.Attribute("baseURL").Value; string testName = testSettings.Attribute("name").Value; _roleName = testSettings.Attribute("roleName").Value; _roleDescription = testSettings.Attribute("roleDescription").Value; _assignedRoleName = testSettings.Attribute("assignedRoleName").Value; _userName = testSettings.Attribute("userName").Value; _userDisplayName = testSettings.Attribute("userDisplayName").Value; Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'"); Trace.WriteLine(BasePage.PreconditionsKeyWord); OpenMainPageAndLoginAsHost(); _logContent = LogContent(); var manageRolesPage = new ManageRolesPage(_driver); manageRolesPage.OpenUsingControlPanel(_baseUrl); manageRolesPage.AddNewSecurityRole(_assignedRoleName); var manageUsersPage = new ManageUsersPage(_driver); manageUsersPage.OpenUsingControlPanel(_baseUrl); manageUsersPage.AddNewUser(_userName, _userDisplayName, "*****@*****.**", "pAssword10"); }
public void Test001_AddSecurityRole() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Security Role'"); var manageRolesPage = new ManageRolesPage(_driver); manageRolesPage.OpenUsingControlPanel(_baseUrl); manageRolesPage.WaitForElement(By.XPath(ManageRolesPage.SecurityRolesTable)); int itemNumber = manageRolesPage.FindElements(By.XPath(ManageRolesPage.SecurityRolesList)).Count; manageRolesPage.AddNewSecurityRole(_roleName); manageRolesPage.OpenUsingControlPanel(_baseUrl); manageRolesPage.WaitForElement(By.XPath(ManageRolesPage.SecurityRolesTable)); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the list increased by 1"); Assert.That(itemNumber + 1, Is.EqualTo(manageRolesPage.FindElements(By.XPath(ManageRolesPage.SecurityRolesList)).Count), "The security role is not added correctly"); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the Security role is present in the list"); Assert.IsTrue(manageRolesPage.ElementPresent(By.XPath("//tr[td[text() = '" + _roleName + "']]")), "The Security role is not added correctly"); }