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); }
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"); }
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(); 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 CreateAdminAndLoginAsAdmin(string userName, string displayName, string email, string password) { ManageUsersPage manageUsersPage = new ManageUsersPage(_driver); manageUsersPage.OpenUsingControlPanel(_baseUrl); manageUsersPage.AddNewUser(userName, displayName, email, password); manageUsersPage.ManageRoles(userName); manageUsersPage.AssignRoleToUser("Administrators"); MainPage mainPage = new MainPage(_driver); mainPage.OpenUsingUrl(_baseUrl); LoginPage loginPage = new LoginPage(_driver); loginPage.LoginUsingLoginLink(userName, password); }
public void Test005_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, "User Display Name", "*****@*****.**", "pAssWrd90"); 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"); }