public void Test_1() { Browser.GoTo(TestData.url); LoginPage loginPg = new LoginPage(Browser); Menu menu = loginPg.Login(TestData.adminName, TestData.adminPass); Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.successfullLoginUrl), string.Format("Login failed for cridentials: name: {0}, pass: {1}", TestData.adminName, TestData.adminPass)); SystemUsers users = menu.Switch2AdminUserManagementUsers(); Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.systemUsersUrl), string.Format("Failed to open AdminUserManagementUsers page")); AddUserForm form = users.ClickAddUser(); Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.addUsersUrl), "Failed to open AddUserForm"); error = form.AddUser(UserRole.ESS, TestData.empName, TestData.userName, Status.Enabled, TestData.userPass); Assert.AreEqual("Success", error, error); Assert.AreEqual(string.Concat(TestData.url, TestData.systemUsersUrl), Browser.Url, string.Format("Failed to add user, user data: name: {0}, pass: {1}", TestData.userName, TestData.userPass)); Browser.GoTo(string.Concat(TestData.url, TestData.logoutUrl)); menu = loginPg.Login(TestData.userName, TestData.userPass); Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.successfullLoginUrl), string.Format("Login failed for cridentials: name: {0}, pass: {1}", TestData.userName, TestData.userPass)); }
static void Main(string[] args) { Browser brw = new Browser(BrowserType.Chrome); brw.GoTo("http://opensource.demo.orangehrmlive.com/"); LoginPage loginPg = new LoginPage(brw); Menu menu = loginPg.Login("Admin", "admin"); SystemUsers users = menu.Switch2AdminUserManagementUsers(); AddUserForm form = users.ClickAddUser(); string error = form.AddUser(UserRole.ESS, "John Smith", "test.task", Status.Disabled, "12345"); }