public void BTA_70_LN_ProductCount_AfterAppeasements() { #region Object Declaration testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); Common common = new Common(DriverContext); CategoryFields product = new CategoryFields(); ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData data = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var rewardCatlog_productImagePage = new Navigator_Users_Program_RewardCatalog_ProductImagesPage(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var navigator_CreateProduct_Category = new Navigator_Users_Program_Components_CategoriesPage(DriverContext); var navigator_CreateBonus = new Navigator_Users_Program_eCollateral_BonusesPage(DriverContext); var RewardCatalog_ProductsPage = new Navigator_Users_Program_RewardCatalog_ProductsPage(DriverContext); var Program_RewardCatalogPage = new Navigator_Users_Program_RewardCatalogPage(DriverContext); var RewardCatalog_RewardsPage = new Navigator_Users_Program_RewardCatalog_RewardsPage(DriverContext); var RewardCatalog_ProductVariantsPage = new Navigator_Users_Program_RewardCatalog_ProductVariantsPage(DriverContext); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSPSearchPage = new CSPortal_SearchPage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext); var MPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); var MP_MyAccountPage = new MemberPortal_MyAccountPage(DriverContext); var myAccountPage = new MemberPortal_MyAccountPage(driverContext); var myWalletPage = new MemberPortal_MyWalletPage(driverContext); var Mp_LoginPage = new MemberPortal_LoginPage(DriverContext); CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common); string stepName = ""; #endregion try { #region Object Initialization var attName = data.AttributeAllContentType; product.SetType = "Product Name"; Member output = cdis_Service_Method.GetCDISMemberGeneral(); IList <VirtualCard> vc = output.GetLoyaltyCards(); #endregion #region Step1: Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2: Login As User Admin stepName = "Login As User Admin and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Verify the existence of category and create category if doesn't exist stepName = "Verify the existence of category and create category if doesn't exist"; product.CategoryTypeValue = CategoryFields.CategoryType.Product.ToString(); product.CategoryName = data.ProductCategoryName; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components); Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Categories); testStep.SetOutput(navigator_CreateProduct_Category.CreateCategory(product)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Create a new Product with quantity as 3 and search the newly created product var contentType = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Product; product.Name = data.ProductName + RandomDataHelper.RandomString(4); product.AttributeName = attName + contentType.ToString(); product.ValueToSetInAttribute = "ValueGivenForAttributeSetProduct"; stepName = "Create New Product with Qunatity as " + product.Name + ""; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog); Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Products); testStep.SetOutput(RewardCatalog_ProductsPage.CreateProductWithQuantity(product, product.ProductQuantity)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Verify LW_product table to see if quantity is showing up as 3 stepName = "Verify LW_product table to see if quantity is showing up as 5"; List <string> TransactionList_Header = new List <string>(); testStep = TestStepHelper.StartTestStep(testStep); var Name = ProjectBasePage.GetProductDetailsFromProductTableFromDB(product.Name, product.Quantity, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Create new reward and Verify CategoryFields reward = new CategoryFields(); reward.Name = data.RewardName + RandomDataHelper.RandomString(5); reward.BalanceNeeded = "0"; reward.CategoryTypeValue = product.Name; reward.SetType = "Reward Name"; var date = DateTime.Now; reward.StartDate = date.ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); reward.ExpiryDate = date.AddYears(10).ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); stepName = "Create new reward for product as " + reward.Name + ""; testStep = TestStepHelper.StartTestStep(testStep); reward.ValueToSetInAttribute = "ValueGivenForAttributeSetReward"; contentType = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Reward; reward.AttributeName = attName + contentType.ToString(); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog); Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Rewards); testStep.SetOutput(RewardCatalog_RewardsPage.CreateReward_With_Product(reward)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7: Make Reward Customer Appeasement stepName = "Make Reward Customer Appeasement "; RewardCatalogSummaryStruct rewarddata = new RewardCatalogSummaryStruct(); rewarddata.RewardName = reward.Name; rewarddata.TypeCode = RandomDataHelper.RandomString(5); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Appease Rewards to Members using SOAP Services"; RewardCatalog_RewardsPage.RewardCustomerAppeasement(product.ProductQuantity, vc[0].LoyaltyIdNumber, rewarddata); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8: Verify LW_product table to see if quantity is showing up as 3 stepName = "Verify LW_product table to see if quantity is showing up as 5"; testStep = TestStepHelper.StartTestStep(testStep); var result = RewardCatalog_RewardsPage.VerifyProductQuantityAfterRewardCustomerAppeasement(product); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, result, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); 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); } }
public void BTA267_CSP_Issue_Points_By_Admin_Agent() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); var ProjectBase = new ProjectBasePage(DriverContext); try { #region Objects var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSPSearchPage = new CSPortal_SearchPage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext); #endregion #region Step1:Adding member with CDIS service stepName = "Adding member with CDIS service"; testStep = TestStepHelper.StartTestStep(testStep); Member user = ProjectBase.CreateMemberThroughCDIS(); testStep.SetOutput("Created Member With LoyaltyId " + ProjectBase.GetLoyaltyNumber(user)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step2: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 Step3:Login As AdminAgent stepName = "Login As AdminAgent User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = AgentValues.AdminAgent; login.Password = AgentValues.Agentpassword; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput("Login As AdminAgent User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Search Based on Loyalty ID stepName = "Search Based on Loyalty ID"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(ProjectBase.GetLoyaltyNumber(user), out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Adding points to member beyond range stepName = "Adding points to member beyond range"; testStep = TestStepHelper.StartTestStep(testStep); var userName = user.FirstName; var maxPoints = 200; var points = new System.Random().Next(201, 500).ToString();; CSPSearchPage.Select(userName); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out string result); testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddingPointsToMember(points, maxPoints)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Adding Points To Member stepName = "Adding Points To Member"; testStep = TestStepHelper.StartTestStep(testStep); userName = user.FirstName; points = new System.Random().Next(1, 200).ToString();; CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out result); testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddingPointsToMember(points, maxPoints)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Verify Points in Accountactivity Page stepName = "Verify Points in Accountactivity Page"; testStep = TestStepHelper.StartTestStep(testStep); userName = user.FirstName; CSPSearchPage.Select(userName); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.AccountActivity, out result); cSPortal_CustomerAppeasementsPage.VerifyPointsInAccountActivityPage(points); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Logout As AdminAgent stepName = "Logout As AdminAgent"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep.SetOutput("Logout is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { stepstatus = false; testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, stepstatus, 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 BTA_510_CSP_CustomerAppeasement_RewardAppeasement() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); Common common = new Common(DriverContext); ProjectBasePage basePages = new ProjectBasePage(DriverContext); string stepName = ""; try { #region var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSPSearchPage = new CSPortal_SearchPage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common); var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext); var MPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); var MP_MyAccountPage = new MemberPortal_MyAccountPage(DriverContext); var myAccountPage = new MemberPortal_MyAccountPage(driverContext); var myWalletPage = new MemberPortal_MyWalletPage(driverContext); var Mp_LoginPage = new MemberPortal_LoginPage(DriverContext); #endregion #region Step1:Adding member with CDIS service stepName = "Adding member with CDIS service"; testStep = TestStepHelper.StartTestStep(testStep); Member output = basePages.CreateMemberThroughCDIS(); testStep.SetOutput("Created Member With LoyaltyId " + basePages.GetLoyaltyNumber(output)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step2: Get Recent Reward Catalog with CDIS service testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Recent Reward Catalog with CDIS service"; RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRecentRewardCatalog(cdis_Service_Method.GetActiveRewardCatalogCount() - 5, 10, 100); testStep.SetOutput("RewardName:" + rewardCatalog[0].RewardName); Logger.Info("RewardName:" + rewardCatalog[0].RewardName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step3: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.SetOutput("Launch Customer Service Portal URL is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Login As csadmin stepName = "Login As csadmin"; 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 AdminAgent User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Search Based on Loyalty ID stepName = "Search Based on Loyalty ID"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(basePages.GetLoyaltyNumber(output), out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Verify Member details displayed on Account Summary page stepName = "Verify Member details displayed on Account Summary page"; testStep = TestStepHelper.StartTestStep(testStep); var userName = output.FirstName; CSPSearchPage.Select(userName); testStep.SetOutput("Member details displayed in Account Summary page"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Navigate to CustomerAppeasements page stepName = "Navigate to CustomerAppeasements page"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out string result); testStep.SetOutput(result); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Adding Reward Appeasement stepName = "Adding Reward Appeasement"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddRewardAppeasement(rewardCatalog[0].RewardName, out string message)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Logout As csadmin stepName = "Logout As csadmin"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep.SetOutput("Logout is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { stepstatus = false; testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, 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 BTA344_Verify_Member_Rewards() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; try { #region var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSPSearchPage = new CSPortal_SearchPage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var common = new Common(DriverContext); var cdis_Service_Method = new CDIS_Service_Methods(common); var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext); var MPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); var MP_MyAccountPage = new MemberPortal_MyAccountPage(DriverContext); var myAccountPage = new MemberPortal_MyAccountPage(driverContext); var myWalletPage = new MemberPortal_MyWalletPage(driverContext); var Mp_LoginPage = new MemberPortal_LoginPage(DriverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); #endregion #region Step1:Adding member with CDIS service stepName = "Adding member through CDIS service"; testStep = TestStepHelper.StartTestStep(testStep); Member member = basePages.CreateMemberThroughCDIS(); testStep.SetOutput("Member Added with LoyaltyID " + basePages.GetLoyaltyNumber(member)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step2:Get Recent Reward Catalog with CDIS service testStep = TestStepHelper.StartTestStep(testStep); stepName = "Get Recent Reward Catalog with CDIS service"; RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRecentRewardCatalog(cdis_Service_Method.GetActiveRewardCatalogCount() - 5, 10, 100); testStep.SetOutput("RewardName:" + rewardCatalog[0].RewardName); Logger.Info("RewardName:" + rewardCatalog[0].RewardName); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step3: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.SetOutput("Launch Customer Service Portal URL is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Login As csadmin stepName = "Login As csadmin"; 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 AdminAgent User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Search Based on Loyalty ID stepName = "Search Based on Loyalty ID"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(basePages.GetLoyaltyNumber(member), out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Adding Points To Member stepName = "Adding Points To Member"; testStep = TestStepHelper.StartTestStep(testStep); var userName = member.FirstName; var maxPoints = 10000; var points = new System.Random().Next(100, 500).ToString(); CSPSearchPage.Select(userName); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out string result); testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddingPointsToMember(points, maxPoints)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Adding rewards to member stepName = "Adding rewards to member"; testStep = TestStepHelper.StartTestStep(testStep); userName = member.FirstName; var rewardName = MemberPortalData.RewardName; CSPSearchPage.Select(userName); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out result); testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddRewardAppeasement(rewardName, out string message)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Logout As csadmin stepName = "Logout As csadmin"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep.SetOutput("Logout is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Launch MPPortal Portal stepName = "Launch Member Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); MPortal_LoginPage.LaunchMemberPortal(login.MemberPortal_url, out string Message); testStep.SetOutput("Launch Member Portal URL is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Login As Newely Created Member stepName = "Login As Newely Created Member "; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = member.Username; login.Password = MemberPortalData.MP_password; MPortal_LoginPage.LoginMemberPortal(login.UserName, login.Password, out Message); testStep.SetOutput("Login As " + login.UserName + " User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Navigate to My Wallet page stepName = "Verify successful navigation to My Wallet page"; testStep = TestStepHelper.StartTestStep(testStep); myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyWallet, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Verify My Reward sections stepName = "Verify My Reward sections"; testStep = TestStepHelper.StartTestStep(testStep); var date = DateTime.Now; date = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date, TimeZoneInfo.Local.Id, "Central Standard Time"); var FromDate = date.ToString("MM/dd/yyyy", new CultureInfo("en-US")); var ToDate = date.AddYears(10).ToString("MM/dd/yyyy", new CultureInfo("en-US")); myWalletPage.VerifyMyRewardSection(rewardName, FromDate, ToDate, MemberPortal_MyWalletPage.RewardStatus.Active.ToString(), out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13:Verify My Reward buttons stepName = "Verify My Reward buttons"; testStep = TestStepHelper.StartTestStep(testStep); myWalletPage.VerifyMyRewardButtonOptions(out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step14:Logout from member portal stepName = "Logout from Member Portal"; testStep = TestStepHelper.StartTestStep(testStep); Mp_LoginPage.LogoutMPPortal(); testStep.SetOutput("Logout from Member Portal is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { stepstatus = false; testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, stepstatus, 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 BTA346_MPVerifyCouponsBasedOnDifferentDatesSearchOnMyWalletPage() { testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; bool stepstatus; try { #region Object Initialization var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSPSearchPage = new CSPortal_SearchPage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); common = new Common(DriverContext); CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common); var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext); var MPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); var memberPortal_MyWalletPage = new MemberPortal_MyWalletPage(DriverContext); var memberPortal_MyAccountPage = new MemberPortal_MyAccountPage(DriverContext); #endregion #region Precondtion:Create Member cdis_Service_Method = new CDIS_Service_Methods(common); testStep = TestStepHelper.StartTestStep(testStep); stepName = "Adding member with CDIS service and Adding Coupon to the Member"; Member output = basePages.CreateMemberThroughCDIS(); GetCouponDefinitionsOut def = cdis_Service_Method.GetCouponDefinitions(); long memberCouponId = cdis_Service_Method.AddMemberCoupon(basePages.GetLoyaltyNumber(output), def.CouponDefinition[0].Id); testStep.SetOutput("Member UserName: "******" Added Successfully with Coupon : " + def.CouponDefinition[0].Name); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API")); listOfTestSteps.Add(testStep); #endregion #region Step1:Launch Member Portal stepName = "Launch Member Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); var MemberPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); MemberPortal_LoginPage.LaunchMemberPortal(login.MemberPortal_url, out string Output); testStep.SetOutput(Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As Member stepName = "Login As Member User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = output.Username; login.Password = "******"; string MemberLoyaltyNumber = DatabaseUtility.GetLoyaltyID(output.IpCode.ToString()); MemberPortal_LoginPage.LoginMemberPortal(login.UserName, login.Password, out string Message); testStep.SetOutput(Message); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigate to Mywallet page stepName = "Navigate to Mywallet page"; testStep = TestStepHelper.StartTestStep(testStep); memberPortal_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyWallet, out string message); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Verify My Coupons section stepName = "Verify My Coupons section"; testStep = TestStepHelper.StartTestStep(testStep); memberPortal_MyWalletPage.VerifyMyCouponSection(def.CouponDefinition[0].Name, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Verify My Coupons VIEW,Send To My Wallet,PRINT,DONE and Share Button Options stepName = "Verify My Coupons VIEW,Send To My Wallet,PRINT,DONE and Share Button Options"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = memberPortal_MyWalletPage.VerifyMyCouponsButtonOptions(out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Logout from member portal stepName = "Logout from Member Portal"; testStep = TestStepHelper.StartTestStep(testStep); MemberPortal_LoginPage.LogoutMPPortal(); testStep.SetOutput("Logout from Member Portal is Successful"); 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("API")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); Assert.Fail(e.Message); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }