//[TestCaseSource(typeof(SSLoginTestData), "TestCases")] public void DeleteUser() { try { LoginPageFlow loginPage = new LoginPageFlow().NavigateToLogin(); ThreadWait.WaitUntilElementAppears(LoginPage.UserNameElement()); HomePageFlow homePage = loginPage.LoginAsSucess("admin", "admin@123"); ThreadWait.WaitUntilElementAppears(HomePage.LogoutElement()); Assert.IsTrue(Driver.PageSource.Contains("Welcome admin"), "Failed User Login" + "userName"); homePage.SelectAdminMenu(); homePage.SelectUserDashboardMenu(); UserDashboardPageFlow userdashboard = new UserDashboardPageFlow(); ThreadWait.WaitUntilElementAppears(UserDashboardPage.GridTable()); userdashboard.DeleteUser("john123"); Thread.Sleep(3000); Driver.SwitchTo().Alert().Accept(); Thread.Sleep(3000); ThreadWait.WaitUntilElementAppears(HomePage.LogoutElement()); homePage.UserLogout(); LogEvent("User dashbaord - Delete user_Successful() - Passed"); } catch (Exception e) { new ScreenShotImage().CaptureScreenShot("DashboardDeleteUser"); LogEvent("Userdashboard -Delete User Failed\n\r" + e.Message + Environment.NewLine + e.StackTrace, EventTypes.Error); throw; } }
public void ContactUploader() { try { LoginPageFlow loginPage = new LoginPageFlow(); Thread.Sleep(3000); loginPage.NavigateToLogin(); HomePageFlow homePage = loginPage.LoginAsAdminSucess(); ThreadWait.WaitUntilElementAppears(HomePage.LogoutElement()); Assert.IsTrue(Driver.PageSource.Contains("Welcome admin"), "Failed User Login admin"); homePage.SelectContactMenu(); ContactPageFlow contacts = new ContactPageFlow(); contacts.UploadFile(Configuration.TestDataUploadDirectory + "\\SeShellDemo1.txt"); Thread.Sleep(3000); Driver.SwitchTo().Alert().Accept(); } catch (Exception e) { new ScreenShotImage().CaptureScreenShot("Upload"); LogEvent("Upload -Upload Failed\n\r" + e.Message + Environment.NewLine + e.StackTrace, EventTypes.Error); throw; } }
public void CreateUser() { try { LoginPageFlow loginPage = new LoginPageFlow().NavigateToLogin(); ThreadWait.WaitUntilElementAppears(LoginPage.LoginElement()); HomePageFlow homePage = loginPage.LoginAsSucess("admin", "admin@123"); ThreadWait.WaitUntilElementAppears(HomePage.LogoutElement()); Assert.IsTrue(Driver.PageSource.Contains("Welcome admin"), "Failed User Login" + "userName"); if (WebBrws == WebBrowsers.FireFox) { Driver.Navigate().GoToUrl("http://localhost:57081/CrystalRunner/AdminPages/CreateUser.aspx"); } else { homePage.SelectAdminMenu(); Thread.Sleep(3000); homePage.SelectCreateUserMenu(); } CreateUserPageFlow createUser = new CreateUserPageFlow(); createUser.RegisterInformation("tom", "Tom", "Larry", "10/11/1990", "Sri Lanka"); String parentWindowHandle = Driver.CurrentWindowHandle; ReadOnlyCollection <string> handles = Driver.WindowHandles; createUser.SaveUserInformation(); foreach (string handle in handles) { } Driver.SwitchTo().Alert().Accept(); Thread.Sleep(3000); homePage.UserLogout(); LogEvent("Create User - CreateUser Successful() - Passed"); } catch (Exception e) { new ScreenShotImage().CaptureScreenShot("CreateUserError"); LogEvent("CreateUser -CreateUser() Failed\n\r" + e.Message + Environment.NewLine + e.StackTrace, EventTypes.Error); throw; } }
public void LoginSuccessful(LoginTestData data) { try { LoginPageFlow loginPage = NavigateToLogin(); Thread.Sleep(3000); HomePageFlow homePage = LoginAsSucess(data.UserName, data.Password); ThreadWait.WaitUntilElementAppears(HomePage.LogoutElement()); Assert.IsTrue(Driver.PageSource.Contains(data.ExpectedResult), "Failed User Login" + data.UserName); homePage.UserLogout(); LogEvent("LoginTest -Login_Successful() - Passed"); } catch (Exception e) { new ScreenShotImage().CaptureScreenShot(data.ErrImage); LogEvent("LoginTest -Login Failed\n\r" + e.Message + Environment.NewLine + e.StackTrace, EventTypes.Error); throw; } }