public void BTA270_CSP_Change_Password() { ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; bool stepstatus; string StepOutput; try { var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); AgentRegistration agent = new AgentRegistration(); #region Step1:Launch CSPortal Portal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput("Login As csadmin User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigate to User Administration stepName = "Navigate to UserAdministration Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Navigate to Agent Page stepName = "Navigate to Agent Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("Navigate to Agent Page is Successful"); listOfTestSteps.Add(testStep); #endregion #region Step5:Create new TestAgent user as per config file,if not existed testStep = TestStepHelper.StartTestStep(testStep); agent.FistName = AgentValues.ChangePasswordTestAgent; agent.LastName = AgentValues.ChangePasswordTestAgent; agent.Role = RoleValue.Admin.ToString(); agent.Status = AgentRegistration.AgentStatus.Active.ToString(); agent.UserName = AgentValues.ChangePasswordTestAgent; stepName = "Create New Agent if user is not existed"; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Change Password for Test Agent testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Agent"; stepstatus = CSPortal_UserAdministrationAgentPage.ChangeAgentPassword(agent.UserName, agent.Password, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Logout As Test User stepName = "Logout from CS Portal"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("LogOut is Successful as csadmin"); listOfTestSteps.Add(testStep); #endregion #region Step8:Login As Test User stepName = "Login As User, User Name:" + agent.UserName; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LoginCSPortal(agent.UserName, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepName); listOfTestSteps.Add(testStep); #endregion #region Step9:Verify First Name and Last Name stepName = "Verify First Name and Last Name"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(CSP_HomePage.VerifyFirstNameAndLastName(agent.FistName, agent.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Navigate to Change Password testStep = TestStepHelper.StartTestStep(testStep); stepName = "Navigate to Change Password"; stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.ChangePassword, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Stept11: Change Password testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Agent"; var cSP_ChangePassword = new CSPortal_ChangePassword(DriverContext); string agen_OldPassword = agent.Password; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); cSP_ChangePassword.EnterPasswordDetails(agen_OldPassword, agent.Password, agent.Password, out string ValidationMessage); cSP_ChangePassword.SavePassword(); stepstatus = cSP_ChangePassword.VerifySuccessMessage(agen_OldPassword, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Logout As Test User stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("LogOut is Successful as User:"******"Login As User, User Name:" + agent.UserName; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LoginCSPortal(agent.UserName, agent.Password, out StepOutput); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepName); #endregion #region Step14:Verify First Name and Last Name stepName = "Verify First Name and Last Name"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(CSP_HomePage.VerifyFirstNameAndLastName(agent.FistName, agent.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15:Logout As Test User stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("LogOut is Successful as User:"******"WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testStep.SetOutput(e.Message); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA11_CSP_ForgotPasswordNegativeScenario() { #region TestData login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; AgentRegistration agent = new AgentRegistration(); agent.FistName = AgentValues.ForgotPasswordTestAgent; agent.LastName = AgentValues.ForgotPasswordTestAgent; agent.Role = RoleValue.Admin.ToString(); agent.UserName = AgentValues.ForgotPasswordTestAgent; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); string ResetCode = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(4); string ExpectedErrorMessage = "The reset code you entered is invalid."; #endregion #region Object Initialization ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); var CSP_ForgotPassword = new CSPortal_ForgotPassword(DriverContext); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); #endregion try { CSP_LoginPage.LaunchCSPortal(login.Csp_url, listOfTestSteps); CSP_LoginPage.LoginCSPortal(login, listOfTestSteps); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, listOfTestSteps); CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents, listOfTestSteps); CSPortal_UserAdministrationAgentPage.CreateAgent(agent, listOfTestSteps); CSP_HomePage.LogoutCSPortal(listOfTestSteps); CSP_LoginPage.LaunchCSPortal(login.Csp_url, listOfTestSteps); CSP_LoginPage.ClickForgotPassword(listOfTestSteps); CSP_ForgotPassword.EnterUserNameandClickOnSubmit(agent.UserName, listOfTestSteps); CSP_ForgotPassword.SelectEmailOption(listOfTestSteps); CSP_ForgotPassword.ClickSendResetCodeButton(listOfTestSteps); CSP_ForgotPassword.SelectAlreadyHaveResetCode(listOfTestSteps); CSP_ForgotPassword.ClickSendResetCodeButton(listOfTestSteps); CSP_ForgotPassword.EnterResetCodeAnd_ClickOnSubmit(ResetCode, listOfTestSteps); CSP_ForgotPassword.VerifyInvalidResetCodeError(ExpectedErrorMessage, listOfTestSteps); testCase.SetStatus(true); } catch (Exception e) { testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA266_CSP_VerifyActiveandInActiveStatusofAgents() { ProjectBasePage basePages = new ProjectBasePage(driverContext); AgentRegistration agent_admin = new AgentRegistration(); AgentRegistration agent_Sradmin = new AgentRegistration(); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; try { #region var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var agentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); var userAdministration = new CSPortal_UserAdministration(DriverContext); #endregion #region Step1:Launch CSPortal Portal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Edit AdminAgent status Active to Inactive stepName = "Edit AdminAgent status Active to Inactive"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out string output); userAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); agent_admin.FistName = "AdminFirstName"; agent_admin.LastName = "AdminLastName"; agent_admin.Role = RoleValue.Admin.ToString(); agent_admin.UserName = AgentValues.AdminAgent; agent_admin.Password = AgentValues.Agentpassword; agent_admin.Status = AgentRegistration.AgentStatus.Active.ToString(); var status = agentPage.EditAgentStatus(agent_admin, AgentRegistration.AgentStatus.InActive.ToString(), out string result); testStep.SetOutput(result); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Edit SrAdminAgent status Active to Inactive stepName = "Edit SrAdminAgent status Active to Inactive"; testStep = TestStepHelper.StartTestStep(testStep); agent_Sradmin.FistName = "SrFirstName"; agent_Sradmin.LastName = "SrLastName"; agent_Sradmin.Role = RoleValue.SrAdmin.ToString(); agent_Sradmin.UserName = AgentValues.SrAdminAgent; agent_Sradmin.Password = AgentValues.Agentpassword; agent_Sradmin.Status = AgentRegistration.AgentStatus.Active.ToString(); status = agentPage.EditAgentStatus(agent_Sradmin, AgentRegistration.AgentStatus.InActive.ToString(), out result); testStep.SetOutput(result); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Logout As csadmin stepName = "Logout As csadmin"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Verify AdminAgent login in inactive state. stepName = "Verify AdminAgent login in Inactive state"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = AgentValues.AdminAgent; login.Password = AgentValues.Agentpassword; var testResult = agentPage.VerifyLogin(login, AgentRegistration.AgentStatus.InActive.ToString(), out output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, testResult, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Verify SrAdminAgent login in inactive state. stepName = "Verify SrAdminAgent login in Inactive state"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = AgentValues.SrAdminAgent; login.Password = AgentValues.Agentpassword; testResult = agentPage.VerifyLogin(login, AgentRegistration.AgentStatus.InActive.ToString(), out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, testResult, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Edit AdminAgent status Inactive to Active stepName = "Edit AdminAgent status Inactive to Active"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out output); userAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); status = agentPage.EditAgentStatus(agent_admin, AgentRegistration.AgentStatus.Active.ToString(), out result); testStep.SetOutput(result); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Edit SrAdminAgent status Inactive to Active stepName = "Edit SrAdminAgent status Inactive to Active"; testStep = TestStepHelper.StartTestStep(testStep); agent_Sradmin.Status = AgentRegistration.AgentStatus.Active.ToString(); status = agentPage.EditAgentStatus(agent_Sradmin, AgentRegistration.AgentStatus.Active.ToString(), out result); testStep.SetOutput(result); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Logout As csadmin stepName = "Logout As csadmin"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Verify AdminAgent login in active state. stepName = "Verify AdminAgent login in active state"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = AgentValues.AdminAgent; login.Password = AgentValues.Agentpassword; testResult = agentPage.VerifyLogin(login, AgentRegistration.AgentStatus.Active.ToString(), out result); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, testResult, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13:Verify SrAdminAgent login in active state. stepName = "Verify SrAdminAgent login in active state"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = AgentValues.SrAdminAgent; login.Password = AgentValues.Agentpassword; testResult = agentPage.VerifyLogin(login, AgentRegistration.AgentStatus.Active.ToString(), out output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, testResult, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step14:Logout stepName = "Logout"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA123_CSPCreateDifferentAgent() { ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); bool stepstatus; string stepName = ""; #region Object Declaration var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); AgentRegistration agent = new AgentRegistration(); #endregion try { #region Step1:Launch CSPortal Portal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); var CSP_LoginPage = new CSPortal_LoginPage(this.DriverContext); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigate to User Administration testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Create AdminAgent if it does not exists testStep = TestStepHelper.StartTestStep(testStep); stepName = "Create AdminAgent if it does not exists"; stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); agent.FistName = "AdminFirstName"; agent.LastName = "AdminLastName"; agent.Role = RoleValue.Admin.ToString(); agent.UserName = AgentValues.AdminAgent; agent.Password = AgentValues.Agentpassword; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Verify Login As Admin Agent Verify Dashboard Links and Logout testStep = TestStepHelper.StartTestStep(testStep); stepName = "Login As AdminAgent Verify Dashboard Links and Logout"; CSP_HomePage.LogoutCSPortal(); CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName)); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Create SrAdminAgent if it does not exists testStep = TestStepHelper.StartTestStep(testStep); agent.FistName = "SrFirstName"; agent.LastName = "SrLastName"; agent.Role = RoleValue.SrAdmin.ToString(); agent.UserName = AgentValues.SrAdminAgent; agent.Password = AgentValues.Agentpassword; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName); stepName = "Create SrAdminAgent if it does not exists"; stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Verify Login As Sr.Admin Agent Verify Dashboard Links and Logout testStep = TestStepHelper.StartTestStep(testStep); stepName = "Login As SrAdmin Verify Dashboard Links and Logout"; CSP_HomePage.LogoutCSPortal(); CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName)); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Create JrAdminAgent if it does not exists testStep = TestStepHelper.StartTestStep(testStep); agent.FistName = "JrFirstName"; agent.LastName = "JrLastName"; agent.Role = RoleValue.JrAdmin.ToString(); agent.UserName = AgentValues.JrAdminAgent; agent.Password = AgentValues.Agentpassword; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName); stepName = "Create JrAdminAgent if it does not exists"; stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Verify Login As Jr Admin Agent Verify Dashboard Links and Logout testStep = TestStepHelper.StartTestStep(testStep); stepName = "Login As JrAdminAgent Verify Dashboard Links and Logout"; CSP_HomePage.LogoutCSPortal(); CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName)); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA271__CSP_ForgotPassword() { ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; string stepOutput = ""; bool stepstatus = false; string BTA_DEV_CS_LogPath = CsPortalData.BTA_DEV_CS_LogPath; try { var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); var CSP_ForgotPassword = new CSPortal_ForgotPassword(DriverContext); AgentRegistration agent = new AgentRegistration(); #region Step1:Launch CSPortal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigate to User Administration stepName = "Navigate to UserAdministration Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Navigate to Agent Page stepName = "Navigate to Agent Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("Navigate to Agent Page is Successful"); listOfTestSteps.Add(testStep); #endregion #region Step5:Create new TestAgent user as per config file,if not existed testStep = TestStepHelper.StartTestStep(testStep); agent.FistName = AgentValues.ForgotPasswordTestAgent; agent.LastName = AgentValues.ForgotPasswordTestAgent; agent.Role = RoleValue.Admin.ToString(); agent.UserName = AgentValues.ForgotPasswordTestAgent; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); stepName = "Create New Agent if user is not existed"; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Logout As Test User stepName = "Logout from CS Portal"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("Logout is Successful as csadmin"); listOfTestSteps.Add(testStep); #endregion #region Step7:Launch CSPortal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep);; CSP_LoginPage.LaunchCSPortal(login.Csp_url, out stepOutput); testStep.SetOutput(stepOutput); CSP_ForgotPassword.GetInitialWordCountFromLogFile(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8: Click on Forgot Password stepName = "Click on Forgot Password"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_LoginPage.ClickForgotPassword(); testStep.SetOutput("Clicked on Forgot Password Successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9: Enter valid user name and click Submit button stepName = "Enter a valid user name and click Submit button"; testStep = TestStepHelper.StartTestStep(testStep); CSP_ForgotPassword.EnterUserName(agent.UserName); CSP_ForgotPassword.ClickSubmitButton(); testStep.SetOutput("Entered User name: " + agent.UserName + " and clicked on Submit button"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10: Select Email option to receive reset code stepName = "Select Email option to receive reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.SelectEmailOption(); testStep.SetOutput("Selected Email Option to receive reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11: Click on Send my reset code stepName = "Click on Send my reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.ClickSendResetCodeButton(); testStep.SetOutput("Clicked on Send my reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12: Select I already have a reset code option stepName = "Select I already have a reset code option"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.SelectAlreadyHaveResetCode(); testStep.SetOutput("Selected I already have a rest code option"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13: Click on Send my reset code stepName = "Click on Send my reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.ClickSendResetCodeButton(); testStep.SetOutput("Clicked on Send my reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step14: Enter the reset code received in the Email/Log stepName = "Enter the reset code received in the Email/Log"; testStep = TestStepHelper.StartTestStep(testStep); CSP_ForgotPassword.EnterResetCodeFromLogFile(BTA_DEV_CS_LogPath, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15: Click on Submit button stepName = "Click on Submit button"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.ClickSubmitButton(); testStep.SetOutput("Clicked on Submit button"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step16: Create new Password for Test User testStep = TestStepHelper.StartTestStep(testStep); stepName = "Create new Passwod for Test User"; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); stepstatus = CSP_ForgotPassword.CreateNewPassword(agent.UserName, agent.Password, agent.Password, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step17: Return back to login page stepName = "Return back to login page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_ForgotPassword.ReturnToLoginPage(out stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepOutput); listOfTestSteps.Add(testStep); #endregion #region Step18: Login with the newly created Password stepName = "Login with User, User Name:" + agent.UserName + "with newly reset Password:"******"WEB")); testStep.SetOutput(stepName); listOfTestSteps.Add(testStep); #endregion #region Step19: Verify First Name and Last Name stepName = "Verify First Name and Last Name"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(CSP_HomePage.VerifyFirstNameAndLastName(agent.FistName, agent.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step20: Navigate to Change Password testStep = TestStepHelper.StartTestStep(testStep); stepName = "Navigate to Change Password"; stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.ChangePassword, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Stept21: Change Password for Test Agent to default testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Agent to default"; var cSP_ChangePassword = new CSPortal_ChangePassword(DriverContext); string agen_OldPassword = agent.Password; string agent_DefaultPassword = AgentValues.Agentpassword; cSP_ChangePassword.EnterPasswordDetails(agen_OldPassword, agent_DefaultPassword, agent_DefaultPassword, out string ValidationMessage); cSP_ChangePassword.SavePassword(); stepstatus = cSP_ChangePassword.VerifySuccessMessage(agen_OldPassword, agent_DefaultPassword, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step22: Logout As Test User stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("Logout is Successful as User:"******"WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA122_CSP_CreateDifferentRoles() { ProjectBasePage basePages = new ProjectBasePage(this.driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); bool stepstatus; string stepName = ""; #region Object Initialization var homePage = new CSPortal_HomePage(DriverContext); var userAdministrationPage = new CSPortal_UserAdministration(DriverContext); var loginPage = new CSPortal_LoginPage(DriverContext); var rolePage = new CSPortal_UserAdministration_RolePage(DriverContext); #endregion try { #region Step1:Launch CSPortal Portal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); loginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; loginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3 : Navigate to User Administration testStep = TestStepHelper.StartTestStep(testStep); stepstatus = homePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4 : Navigate to Roles stepName = "Navigate to Roles"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = userAdministrationPage.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Roles); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5 : Create AdminRole if it does not exists stepName = "Create AdminRole if it does not exists"; testStep = TestStepHelper.StartTestStep(testStep); var role = RoleValue.Admin; var pointAwardLimit = RoleValue.AdminRole_PointAwardLimit; stepstatus = rolePage.CreateNewRole(role, pointAwardLimit, out string stat); testStep.SetOutput(stat); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6 : Create SrAdminRole if it does not exists stepName = "Create SrAdminRole if it does not exists"; testStep = TestStepHelper.StartTestStep(testStep); role = RoleValue.SrAdmin; pointAwardLimit = RoleValue.SrAdminRole_PointAwardLimit; stepstatus = rolePage.CreateNewRole(role, pointAwardLimit, out stat); testStep.SetOutput(stat); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7 : Create JrAdminRole if it does not exists stepName = "Create JrAdminRole if it does not exists"; testStep = TestStepHelper.StartTestStep(testStep); role = RoleValue.JrAdmin; pointAwardLimit = RoleValue.JrAdminRole_PointAwardLimit; stepstatus = rolePage.CreateNewRole(role, pointAwardLimit, out stat); testStep.SetOutput(stat); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8 : Logout As csadmin stepName = "Logout As csadmin"; testStep = TestStepHelper.StartTestStep(testStep); homePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }