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 groupSettings = doc.Document.Element("Tests").Element("securityRoleGroup"); string testName = groupSettings.Attribute("name").Value; _roleGroupName = groupSettings.Attribute("roleGroupName").Value; _roleGroupDescription = groupSettings.Attribute("roleGroupDescription").Value; _roleName = groupSettings.Attribute("roleName").Value; _assignedRoleGroupName = groupSettings.Attribute("assignedRoleGroupName").Value; _driver = StartBrowser(settings.Attribute("browser").Value); _baseUrl = settings.Attribute("baseURL").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"); ManageRolesPage manageRolesPage = new ManageRolesPage(_driver); manageRolesPage.OpenUsingControlPanel(_baseUrl); manageRolesPage.AddNewSecurityRole(_roleName); manageRolesPage.OpenUsingControlPanel(_baseUrl); manageRolesPage.AddNewSecurityRoleGroup(_assignedRoleGroupName); }
public void Test001_AddSecurityRole() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new Security Role'"); ManageRolesPage manageRolesPage = new ManageRolesPage(_driver); manageRolesPage.OpenUsingControlPanel(_baseUrl); int itemNumber = manageRolesPage.FindElements(By.XPath(ManageRolesPage.SecurityRolesList)).Count; manageRolesPage.AddNewSecurityRole(_roleName); manageRolesPage.OpenUsingControlPanel(_baseUrl); 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"); }