public void Test001_AddUser() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Add a new User'"); var manageUsersPage = new ManageUsersPage(_driver); manageUsersPage.OpenUsingControlPanel(_baseUrl); manageUsersPage.WaitForElement(By.XPath(ManageUsersPage.UsersTable)); int itemNumber = manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count; manageUsersPage.AddNewUser(_userName, _userDisplayName, "*****@*****.**", "wordPass30"); manageUsersPage.WaitForElement(By.XPath(ManageUsersPage.UsersTable)); 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"); }
public void Test002_DeleteUser() { Trace.WriteLine(BasePage.RunningTestKeyWord + "'Delete the User'"); var manageUsersPage = new ManageUsersPage(_driver); manageUsersPage.OpenUsingControlPanel(_baseUrl); manageUsersPage.WaitForElement(By.XPath(ManageUsersPage.UsersTable)); int itemNumber = manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count; manageUsersPage.DeleteUser(_userName); manageUsersPage.WaitForElement(By.XPath(ManageUsersPage.UsersTable)); Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT the number of elements in the list is not changed"); Assert.That(manageUsersPage.FindElements(By.XPath(ManageUsersPage.UsersList)).Count, Is.EqualTo(itemNumber), "The User is not deleted 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 deleted correctly"); }