Esempio n. 1
0
        public void BTA_513_MP_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_MP_LogPath = MemberPortalData.BTA_DEV_MP_LogPath;

            try
            {
                var MP_ForgotPassword    = new MemberPortal_ForgotPassword(DriverContext);
                var MPortal_LoginPage    = new MemberPortal_LoginPage(DriverContext);
                var CSP_LoginPage        = new CSPortal_LoginPage(DriverContext);
                var CSP_SearchPage       = new CSPortal_SearchPage(DriverContext);
                var CSP_HomePage         = new CSPortal_HomePage(DriverContext);
                var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext);
                var MP_Profile           = new MemberProfile(DriverContext);
                var member        = MP_Profile.GenerateMemberBasicInfo();
                var details       = MP_Profile.GenerateMemberDetails();
                var myAccountPage = new MemberPortal_MyAccountPage(driverContext);
                var myProfilePage = new MemberPortal_MyProfilePage(driverContext);

                #region Step1:Launch CSPortal
                stepName = "Launch Customer Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                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:Create new member user as per config file,if not existed
                stepName         = "Create new member user as per config file,if not existed";
                testStep         = TestStepHelper.StartTestStep(testStep);
                member.FirstName = MemberPortalData.ForgotPasswordTestMember;
                member.LastName  = MemberPortalData.ForgotPasswordTestMember;
                member.Username  = MemberPortalData.ForgotPasswordTestMember;
                member.Password  = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8);
                bool isMemberExists = CSP_SearchPage.VerifyMemberExists(member.Username, out stepOutput);
                testStep.SetOutput(stepOutput);
                if (!isMemberExists)
                {
                    CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.MemberRegistration, out stepOutput);
                    stepstatus = CSP_RegistrationPage.EnterBasicInfo_Details(member.FirstName, member.LastName, member.MiddleName, details.Gender, out stepOutput);
                    stepstatus = CSP_RegistrationPage.EnterContactInfo_Details(member.PrimaryEmailAddress, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, out stepOutput);
                    stepstatus = CSP_RegistrationPage.EnterLoginCredentials_Details(member.Username, member.Password, out stepOutput);
                    stepstatus = CSP_RegistrationPage.EnterOptIn_Out_Details("DirectMailOptIn", "EmailOptIn", "SmsOptIn", out stepOutput);
                    CSP_RegistrationPage.SaveRegistration();
                    testStep.SetOutput("Member created successfully with username: "******"WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Logout as Csadmin
                stepName = "Logout from CS Portal User:"******"WEB"));
                testStep.SetOutput("Logout is Successful as User: "******"Launch Member Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_LoginPage.LaunchMemberPortal(login.MemberPortal_url, out string Message);
                MP_ForgotPassword.GetInitialWordCountFromLogFile(BTA_DEV_MP_LogPath);
                testStep.SetOutput("Launch Member Portal URL is Successful");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Click on Forgot Password
                stepName   = "Click on Forgot Password";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MPortal_LoginPage.ClickForgotPassword();
                testStep.SetOutput("Clicked on Forgot Password Successfully");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Enter valid user name and click Submit button
                stepName = "Enter a valid user name and click Submit button";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_ForgotPassword.EnterUserName(member.Username);
                MP_ForgotPassword.ClickSubmitButton();
                testStep.SetOutput("Entered User name: " + member.Username + " and clicked on Submit button");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Select Email option to receive reset code
                stepName   = "Select Email option to receive reset code";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MP_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 Step9:Click on Send my reset code
                stepName   = "Click on Send my reset code";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MP_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 Step10: Select I already have a reset code option
                stepName   = "Select I already have a reset code option";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MP_ForgotPassword.SelectAlreadyHaveResetCode();
                testStep.SetOutput("Selected I already have a reset code option");
                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 = MP_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:Enter the reset code received in the Log
                stepName = "Enter the reset code received in the Log";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_ForgotPassword.EnterResetCodeFromLogFile(BTA_DEV_MP_LogPath, out stepOutput);
                testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step13:Click on Submit button
                stepName   = "Click on Submit button";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MP_ForgotPassword.ClickSubmitButton();
                testStep.SetOutput("Clicked on Submit button");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step14:Create new Password for Test User
                stepName        = "Create new Passwod for Test User";
                testStep        = TestStepHelper.StartTestStep(testStep);
                member.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8);
                stepstatus      = MP_ForgotPassword.CreateNewPassword(member.Username, member.Password, member.Password, out stepOutput);
                testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step15:Return back to login page
                stepName   = "Return back to login page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = MP_ForgotPassword.ReturnToLoginPage(out stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                testStep.SetOutput(stepOutput);
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step16:Login with the newly created Password
                stepName = "Login with User, User Name: " + member.FirstName + " with newly reset Password: "******"WEB")); testStep.SetOutput(stepName);
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step17:Verify successful navigation to Member Portal home page
                stepName = "Verify successful navigation to Member Portal home page";
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(MPortal_LoginPage.VerifyMemberPortalLoginSuccessfulForUser(member.FirstName, member.LastName));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step18:Navigate to My Profile page
                stepName = "Navigate to My Profile page";
                testStep = TestStepHelper.StartTestStep(testStep);
                myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyProfile, out var Step_Output); var strStatus = Step_Output;
                testStep.SetStatus(myProfilePage.VerifyMyProfilePage(MemberPortal_MyProfilePage.Sections.MyProfile.ToString(), out Step_Output)); strStatus = strStatus + ". " + Step_Output;
                testStep.SetOutput(strStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Stept19:Change Password  for Test Member to default
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Change Password  for Test Member to default";
                string agen_OldPassword      = member.Password;
                string agent_DefaultPassword = AgentValues.Agentpassword;
                myProfilePage.ChangePassword(agen_OldPassword, agent_DefaultPassword, agent_DefaultPassword);
                stepstatus = myProfilePage.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 Step20:Logout from Member portal
                stepName = "Logout from Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_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("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_508_MP_RequestCredit_Online_TransactionDate()
        {
            #region Objects
            ProjectBasePage basePages = new ProjectBasePage(driverContext);
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName               = "";
            bool   stepstatus             = true;
            var    Mp_RequestCredit       = new MemberPortal_RequestCredit(DriverContext);
            var    MP_LoginPage           = new MemberPortal_LoginPage(DriverContext);
            var    Mp_MyAccountPage       = new MemberPortal_MyAccountPage(DriverContext);
            var    CSPortal_RequestCredit = new CSPortal_RequestCredit(driverContext);
            var    MPAccountActivityPage  = new MemberPortal_AccountActivityPage(DriverContext);
            #endregion

            try
            {
                #region reading Data from dB
                List <string> TransactionList = new List <string>();
                stepName        = "Searching Transaction in the Transaction History Details Table";
                testStep        = TestStepHelper.StartTestStep(testStep);
                TransactionList = ProjectBasePage.GetTransactionDetailsFromTransationHistoryTableFromDB(out Step_Output);
                RequestCredit_Search_Criteria.TransactionNumber = TransactionList[0].ToString();
                RequestCredit_Search_Criteria.RegisterNumber    = TransactionList[1].ToString();
                RequestCredit_Search_Criteria.TxnAmount         = TransactionList[2].ToString();
                RequestCredit_Search_Criteria.TxnDate           = TransactionList[3].ToString();
                RequestCredit_Search_Criteria.StoreNumber       = TransactionList[4].ToString();
                if (RequestCredit_Search_Criteria.StoreNumber.Equals(""))
                {
                    throw new Exception("Store Number Not Avaialble for Transaction:" + RequestCredit_Search_Criteria.TransactionNumber);
                }
                DateTime Txn_dateformat  = DateTime.Parse(RequestCredit_Search_Criteria.TxnDate);
                string   transactionDate = Txn_dateformat.ToString("MM/dd/yyyy");
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, "");
                listOfTestSteps.Add(testStep);
                #endregion

                #region Precondition:Create Member One
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member member = basePages.CreateMemberThroughCDIS();
                testStep.SetOutput("LoyaltyNumber_One:" + basePages.GetLoyaltyNumber(member) + ",Name:" + member.FirstName + "Created Successfully");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step1:Launch MPPortal Portal
                stepName = "Launch Member Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_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 Step2:Login As Newely Created Member
                stepName = "Login As Newely Created Member ";
                testStep = TestStepHelper.StartTestStep(testStep);
                string userName = member.Username;
                login.Password = MemberPortalData.MP_password;
                MP_LoginPage.LoginMemberPortal(userName, login.Password, out Message);
                testStep.SetOutput(Message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Navigate to Request Credit
                stepName   = "Navigate to Request Credit Page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = Mp_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.RequestCredit, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Search With Transaction Date
                stepName   = "Select Online and Search With Transaction Date:" + RequestCredit_Search_Criteria.TxnDate;
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = Mp_RequestCredit.Search_BasedOnTransactionDate(RequestCredit_Search_Criteria.TransactionNumber, transactionDate, MemberPortal_RequestCredit.TransactionType.Online.ToString(), out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Get the data from DB
                stepName = "Searching Transaction in the Txn_Header Table";
                List <string> TransactionList_Header = new List <string>();
                testStep = TestStepHelper.StartTestStep(testStep);
                TransactionList_Header = ProjectBasePage.GetTransactionDetailsFromTransactionHeaderTableFromDB(RequestCredit_Search_Criteria.TransactionNumber, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Verify the Transactions
                stepName   = "Verifying Transaction in Txn_Header table";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = basePages.VerifyInputandOutputFromDB("Transaction Number", TransactionList_Header[0].ToString(), RequestCredit_Search_Criteria.TransactionNumber, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Navigate to Account Activity Page
                stepName   = "Navigate to Account ActivityPage";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = Mp_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.AccountActivity, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Search and Verify Sales Transactions With Specific Date Range
                stepName = "Search and Verify Sales Transactions";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPAccountActivityPage.SelectDate_RC(Txn_dateformat, Txn_dateformat.AddDays(1));
                MPAccountActivityPage.VerifySalesTransactionsSection("Header Id", RequestCredit_Search_Criteria.TransactionNumber, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: 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)
            {
                testStep.SetOutput(Step_Output);
                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);
            }
        }
Esempio n. 3
0
        public void BTA574_MP_Verify_SocialMediaForRewardsAndCoupon()
        {
            ProjectBasePage  basePages   = new ProjectBasePage(driverContext);
            NonAdminUserData WebsiteData = new NonAdminUserData(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";

            try
            {
                #region Object Initialization
                var userName                  = NavigatorUsers.NonAdminUser;
                var password                  = NavigatorUsers.NavigatorPassword;
                var navigator_LoginPage       = new Navigator_LoginPage(DriverContext);
                var navigator_UsersHomePage   = new Navigator_UsersHomePage(DriverContext);
                var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext);
                var websitePage               = new Navigator_Users_WebsitePage(DriverContext);
                var modulesPage               = new Navigator_Users_Website_ModulesPage(DriverContext);
                common = new Common(DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
                var MPortal_LoginPage     = new MemberPortal_LoginPage(DriverContext);
                var MPortal_MyWalletPage  = new MemberPortal_MyWalletPage(DriverContext);
                var MPortal_MyAccountPage = new MemberPortal_MyAccountPage(DriverContext);
                #endregion

                #region Part1: Navigator portal-Enable social media for rewards and coupons
                #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 with All roles User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = userName;
                login.Password = password;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3 : Select organization and environment on USER Home page"
                stepName = "Select organization and environment on USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Navigate to Website > Modules page
                stepName = "Navigate to Website > Modules page";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.website);
                websitePage.NavigateToWebsiteTab(Navigator_Users_WebsitePage.WebsiteTabs.Modules, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: Enable Social Media for Coupons
                stepName = "Enable Social Media for Coupons";
                testStep = TestStepHelper.StartTestStep(testStep);
                var webSiteName = WebsiteData.MemberPortal_WebSiteName;
                var moduleType  = EnumUtils.GetDescription(Navigator_Users_Website_ModulesPage.ModuleTypeList.CouponsListView);
                var configName  = Navigator_Users_Website_ModulesPage.ConfigNames.CFCoupons_Config.ToString();
                modulesPage.EnableSocialMedia(moduleType, webSiteName, configName, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Enable Social Media for Rewards
                stepName   = "Enable Social Media for Rewards";
                testStep   = TestStepHelper.StartTestStep(testStep);
                moduleType = EnumUtils.GetDescription(Navigator_Users_Website_ModulesPage.ModuleTypeList.RewardHistoryListView);
                configName = Navigator_Users_Website_ModulesPage.ConfigNames.CFRewardsHistory_Config.ToString();
                moduleType = "Reward History - List View";
                configName = "CFRewardsHistory_Config";
                websitePage.NavigateToWebsiteTab(Navigator_Users_WebsitePage.WebsiteTabs.Modules, out string msg);
                modulesPage.EnableSocialMedia(moduleType, webSiteName, configName, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Bounce the Member portal App pool
                stepName = "Bounce the Member Portal App pool";
                testStep = TestStepHelper.StartTestStep(testStep);
                var WebsiteManagement = new Navigator_Users_WebsiteManagementPage(DriverContext);
                WebsiteManagement.Navigator_Website_Select_WebsiteManagementTab();
                WebsiteManagement.BounceAppPool("MemberPortal");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8: 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
                #endregion

                #region Part2: Creating members using CDIS service and adding rewards and coupons
                #region Step9: Adding member with CDIS service
                cdis_Service_Method = new CDIS_Service_Methods(common);
                testStep            = TestStepHelper.StartTestStep(testStep);
                stepName            = "Adding member with CDIS service";
                Member output = basePages.CreateMemberThroughCDIS();
                testStep.SetOutput("Member UserName:"******"; Member First Name:" + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Getting Coupon Definitions from Service
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Getting Coupon Definitions from Service";
                GetCouponDefinitionsOut def = cdis_Service_Method.GetCouponDefinitions();
                testStep.SetOutput("First Coupon Name : " + def.CouponDefinition[1].Name);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11: Adding Coupon to  member from Service
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding Coupon to  member from Service";
                long memberCouponId = cdis_Service_Method.AddMemberCoupon(vc[0].LoyaltyIdNumber, def.CouponDefinition[0].Id);
                testStep.SetOutput("MemberCoupon Added to the user : "******"API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step12: 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(0, 0, 0);
                RewardCatalogSummaryStruct   reward        = new RewardCatalogSummaryStruct();
                foreach (RewardCatalogSummaryStruct r in rewardCatalog)
                {
                    if (r.CurrencyToEarn == 0)
                    {
                        reward = r;
                        break;
                    }
                }
                testStep.SetOutput("RewardID:" + reward.RewardID + " and the reward name is :" + reward.RewardName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step13: Add Members to Reward Catalog with CDIS service
                vc       = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Add Members to Reward Catalog with CDIS service";
                AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward);
                testStep.SetOutput("The reward with RewardID:" + memberRewardsOut.MemberRewardID + " has been added to the member with IPCODE: " + output.IpCode);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion
                #endregion

                #region Part3: Verifying the social media share options on Member Portal
                #region Step14:Launch Member Portal
                stepName = "Launch Member Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_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 Step15: Login As Member
                stepName       = "Login As Member User";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = output.Username;
                login.Password = "******";
                MPortal_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 Step16: Navigate to Mywallet page
                stepName = "Navigate to Mywallet page";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyWallet, out string message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step17: Verify My Reward Social media share options
                stepName = "Verify My Reward Social Media Share Options";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_MyWalletPage.VerifySociaMediaOptionsForRewardsAndCoupons("rewards", out var Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step18: Verify My Coupons Social media share options
                stepName = "Verify My Coupons Social Media Share Options";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyWallet, out message);
                var stepstatus = MPortal_MyWalletPage.VerifySociaMediaOptionsForRewardsAndCoupons("coupons", out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step19: Logout from member portal
                stepName = "Logout from Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                MPortal_LoginPage.LogoutMPPortal(); testStep.SetOutput("Logout from Member Portal is Successful");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion
                #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);
            }
        }
Esempio n. 4
0
        public void BTA141_MP_RegisterMemberAndVerifyPage()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";

            try
            {
                #region  Object Initialization
                Login                            login               = new Login();
                var                              MP_LoginPage        = new MemberPortal_LoginPage(driverContext);
                MP_Registration                  memberData          = new MP_Registration(driverContext);
                MemberPortal_LoginPage           loginPage           = new MemberPortal_LoginPage(driverContext);
                MemberPortal_MyAccountPage       myAccountPage       = new MemberPortal_MyAccountPage(driverContext);
                MemberPortal_MyProfilePage       myProfilePage       = new MemberPortal_MyProfilePage(driverContext);
                MemberPortal_MyWalletPage        myWalletPage        = new MemberPortal_MyWalletPage(driverContext);
                MemberPortal_AccountActivityPage accountActivityPage = new MemberPortal_AccountActivityPage(driverContext);
                #endregion

                #region Step1:Launch Member Service Portal URL
                stepName = "Launch Member Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_LoginPage.LaunchMemberPortal(login.MemberPortal_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:Navigate to Member Registration page
                stepName = "Navigate to Member Registration page ";
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(MP_LoginPage.NavigateToMemberRegistrationPage());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Create new member
                stepName = "Create new member";
                testStep = TestStepHelper.StartTestStep(testStep);
                var memberRegistrationPage = new MemberPortal_MemberRegistrationPage(DriverContext);
                memberRegistrationPage.CreateNewMember(memberData, out Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Verify successful navigation to Member Portal home page
                stepName    = "Verify successful navigation to Member Portal home page";
                testStep    = TestStepHelper.StartTestStep(testStep);
                Step_Output = loginPage.VerifyMemberPortalLoginSuccessfulForUser(memberData.FirstName, memberData.LastName);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Verify My Profile page
                stepName = "Verify My Profile page";
                testStep = TestStepHelper.StartTestStep(testStep);
                myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyProfile, out Step_Output); var strStatus = Step_Output;
                testStep.SetStatus(myProfilePage.VerifyMyProfilePage(MemberPortal_MyProfilePage.Sections.MyProfile.ToString(), out Step_Output)); strStatus = strStatus + ". " + Step_Output;
                testStep.SetOutput(strStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Verify My Wallet page
                stepName = "Verify My Wallet page";
                testStep = TestStepHelper.StartTestStep(testStep);
                myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyWallet, out Step_Output); strStatus = Step_Output;
                testStep.SetStatus(myWalletPage.VerifyMyWalletPage(out Step_Output)); strStatus = strStatus + ". " + Step_Output;
                testStep.SetOutput(strStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Verify Account Activity page
                stepName = "Verify Account Activity page";
                testStep = TestStepHelper.StartTestStep(testStep);
                myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.AccountActivity, out Step_Output); strStatus = Step_Output;
                testStep.SetStatus(accountActivityPage.VerifyAccountActivityPage(out Step_Output)); strStatus = strStatus + ". " + Step_Output;
                testStep.SetOutput(strStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Logout from member portal
                stepName = "Logout from Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                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("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 BTA142_MP_LoginUserCreatedFromCsPortalInMemberPortal()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";
            bool   stepstatus;
            string stepOutput = "";

            try
            {
                Common common = new Common(DriverContext);
                #region Generating Test Data to Create new user with loyalty card
                MemberProfile MP_Model     = new MemberProfile(DriverContext);
                Member        member       = MP_Model.GenerateMemberBasicInfo();
                MemberDetails details      = MP_Model.GenerateMemberDetails();
                VirtualCard   vc           = MP_Model.GenerateVirtualCard();
                var           MP_LoginPage = new MemberPortal_LoginPage(DriverContext);
                #endregion

                #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 = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Navigate to Member Registration
                stepName = "Navigate to Member Registration";
                var CSP_HomePage = new CSPortal_HomePage(DriverContext);
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.MemberRegistration, out stepOutput);
                testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Enter Basic Info
                stepName = "Enter Basic Info Details on Member Registration page";
                var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext);
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_RegistrationPage.EnterBasicInfo_Details(member.FirstName, member.LastName, member.MiddleName, details.Gender, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Enter Address
                stepName   = "Enter  Address Info Details on Member Registration page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_RegistrationPage.EnterAddress_Details(details.AddressLineOne, details.AddressLineTwo, details.Country, details.StateOrProvince, details.City, details.ZipOrPostalCode, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Enter ContactInfo
                stepName   = "Enter  Contact Info Details on Member Registration page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_RegistrationPage.EnterContactInfo_Details(member.PrimaryEmailAddress, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Enter login Credentials
                stepName   = "Enter  login Credentials Details on Member Registration page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_RegistrationPage.EnterLoginCredentials_Details(member.Username, member.Password, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Select All Opt In/Out Check boxes
                stepName   = "Select All Opt In/Out Check boxes";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_RegistrationPage.EnterOptIn_Out_Details("DirectMailOptIn", "EmailOptIn", "SmsOptIn", out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9:Save Registration
                stepName = "Save Registration";
                testStep = TestStepHelper.StartTestStep(testStep);
                CSP_RegistrationPage.SaveRegistration();
                testStep.SetOutput("Registration Completed Successfully");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Logout from CSPortal
                stepName = "Logout from CSPortal";
                testStep = TestStepHelper.StartTestStep(testStep);
                CSP_HomePage.LogoutCSPortal();
                testStep.SetOutput("Logout from CSPortal is Successful");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11:Launch Member Portal
                stepName = "Launch Member Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_LoginPage.LaunchMemberPortal(login.MemberPortal_url, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                # region Step12: Login with the user Created from CSPortal
                stepName = "Login with the user Created from CSPortal";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_LoginPage.LoginMemberPortal(member.Username, member.Password, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step13:Login to Member Portal should be successful
                stepName    = "Verify Login to Member Portal should be successful";
                testStep    = TestStepHelper.StartTestStep(testStep);
                Step_Output = MP_LoginPage.VerifyMemberPortalLoginSuccessfulForUser(member.FirstName, member.LastName);
                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);
            }
        public void BTA_511_MP_Member_Update()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";

            try
            {
                #region Object initialization
                MemberProfile MP_Model      = new MemberProfile(DriverContext);
                var           loginPage     = new MemberPortal_LoginPage(DriverContext);
                var           myAccountPage = new MemberPortal_MyAccountPage(driverContext);
                var           myProfilePage = new MemberPortal_MyProfilePage(driverContext);
                #endregion

                #region Step1: Adding member with CDIS service
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = basePages.CreateMemberThroughCDIS();
                testStep.SetOutput("Member UserName:"******"; First Name: " + output.FirstName + "; Last Name:" + output.LastName + "; Birth Date: " + output.BirthDate + "; Email Address:" + output.PrimaryEmailAddress + ": end");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Generating Test Data to Create new user with loyalty card
                Member        member  = MP_Model.GenerateMemberBasicInfo();
                MemberDetails details = MP_Model.GenerateMemberDetails();
                #endregion

                #region Step2:Launch Member Portal
                stepName = "Launch Member Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                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 Step3: 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());
                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 Step4:Navigate to My Profile page
                stepName = "Navigate to My Profile page";
                testStep = TestStepHelper.StartTestStep(testStep);
                myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyProfile, out var Step_Output); var strStatus = Step_Output;
                testStep.SetStatus(myProfilePage.VerifyMyProfilePage(MemberPortal_MyProfilePage.Sections.MyProfile.ToString(), out Step_Output)); strStatus = strStatus + ". " + Step_Output;
                testStep.SetOutput(strStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Update Basic Info
                stepName = "Update Basic Info Details on Member Update Profile page";
                testStep = TestStepHelper.StartTestStep(testStep);
                var stepstatus = myProfilePage.UpdateBasicInfo_Details(member.FirstName, member.LastName, details.Gender, out var stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Update Address
                stepName   = "Update  Address Info Details on Member Update Profile page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = myProfilePage.UpdateAddress_Details(details.AddressLineOne, details.AddressLineTwo, details.Country, details.StateOrProvince, details.City, details.ZipOrPostalCode, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Update ContactInfo
                stepName   = "Update  Contact Info Details on Member Update Profile page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = myProfilePage.UpdateContactInfo_Details(member.PrimaryEmailAddress, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Select All Opt In/Out Check boxes to Update
                stepName   = "Select All Opt In/Out Check boxes to Update";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = myProfilePage.CommunicationPreferences("DirectMailOptIn", "EmailOptIn", "SmsOptIn", out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10:Save Update profile and Verify update success
                stepName = "Save Update profile and Verify update success";
                testStep = TestStepHelper.StartTestStep(testStep);
                myProfilePage.SaveRegistrationAndUpdateSuccess(out stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11: Verify updated First Name and Last Name
                stepName = "Verify updated First Name and Last Name";
                testStep = TestStepHelper.StartTestStep(testStep);
                loginPage.VerifyMemberPortalLoginSuccessfulForUser(member.FirstName, member.LastName); testStep.SetOutput("Member update successful for First Name: " + member.FirstName + "; and Last Name: " + member.LastName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step12: Logout from member portal
                stepName = "Logout from Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                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("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 BTA347_MP_VerifyLoyaltyIDCardsAndViewOptions()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";

            try
            {
                #region  Object Initialization
                var MP_LoginPage = new MemberPortal_LoginPage(driverContext);
                MemberPortal_LoginPage     loginPage     = new MemberPortal_LoginPage(driverContext);
                MemberPortal_MyAccountPage myAccountPage = new MemberPortal_MyAccountPage(driverContext);
                MemberPortal_MyWalletPage  myWalletPage  = new MemberPortal_MyWalletPage(driverContext);
                #endregion

                #region Precondition:Create Member with Loyalty ID
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with Loyalty ID from CDIS service";
                Member output = basePages.CreateMemberThroughCDIS();
                Login  login  = new Login
                {
                    UserName = output.Username,
                    Password = MemberPortalData.MP_password
                };
                testStep.SetOutput("Loyalty ID:" + basePages.GetLoyaltyNumber(output) + ", Name:" + output.FirstName + " Created Successfully");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step1:Launch Member Service Portal URL
                stepName = "Launch Member Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                MP_LoginPage.LaunchMemberPortal(login.MemberPortal_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 to Member Portal
                stepName = "Login to Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                loginPage.LoginMemberPortal(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 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 Step4:Verify My Loyalty Cards Loyalty ID
                stepName = "Verify My Loyalty Cards > Loyalty ID Number";
                testStep = TestStepHelper.StartTestStep(testStep);
                myWalletPage.VerifyMyLoyaltyCardsLoyaltyID(basePages.GetLoyaltyNumber(output), out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Verify My Loyalty Cards sections
                stepName = "Verify My Loyalty Cards sections";
                testStep = TestStepHelper.StartTestStep(testStep);
                myWalletPage.VerifyLoyaltyCardsSection(out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Verify My Loyalty Cards buttons
                stepName = "Verify My Loyalty Cards buttons";
                testStep = TestStepHelper.StartTestStep(testStep);
                myWalletPage.VerifyLoyaltyCardsButtonOptions(out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Logout from member portal
                stepName = "Logout from Member Portal";
                testStep = TestStepHelper.StartTestStep(testStep);
                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 + 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 BTA_512_MP_Search_SalesTransactionsWithSpecificDateRange()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName   = "";
            bool   stepstatus = true;
            Common common     = new Common(DriverContext);

            try
            {
                #region  Object Initialization
                common = new Common(DriverContext);
                var      memberPortal_LoginPage           = new MemberPortal_LoginPage(DriverContext);
                var      memberPortal_MyAccountPage       = new MemberPortal_MyAccountPage(DriverContext);
                var      memberPortal_AccountActivityPage = new MemberPortal_AccountActivityPage(DriverContext);
                var      date     = DateTime.Now.AddDays(-1);
                DateTime FromDate = new DateTime(date.Year, date.Month, 1);
                DateTime ToDate   = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(2018, date.Month));
                #endregion

                #region Precondtion: Adding Members through CDIS
                stepName = "Adding member through CDIS service";
                testStep = TestStepHelper.StartTestStep(testStep);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
                Member   user   = basePages.CreateMemberThroughCDIS();
                Member[] member = cdis_Service_Method.GetCDISMemberByCardId(basePages.GetLoyaltyNumber(user));
                testStep.SetOutput(" Member Added with LoyaltyID: " + basePages.GetLoyaltyNumber(user));
                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 = user.Username;
                login.Password = "******";
                string MemberLoyaltyNumber = DatabaseUtility.GetLoyaltyID(user.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 Account Activity Page
                stepName = "Navigate to Account ActivityPage";
                testStep = TestStepHelper.StartTestStep(testStep);
                memberPortal_MyAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.AccountActivity, out string message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);;
                #endregion

                #region Step4A: Adding Transaction1 through CDIS
                stepName = "Adding Transaction1 through CDIS";
                testStep = TestStepHelper.StartTestStep(testStep);
                string HeaderId = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(member[0], date);
                testStep.SetOutput("Updated Transaction for the member LoyaltyID " + basePages.GetLoyaltyNumber(user) + " with Transaction number " + HeaderId);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4B:Transaction1 Search and Verify Sales Transactions With Specific Date Range
                stepName = "Transaction1 : Search and Verify Sales Transactions";
                testStep = TestStepHelper.StartTestStep(testStep);
                memberPortal_AccountActivityPage.SelectDate_RC(FromDate, ToDate);
                memberPortal_AccountActivityPage.VerifySalesTransactionsSection("Header Id", HeaderId, out message);
                testStep.SetOutput(message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5A: Adding Transaction2 through CDIS
                stepName = "Adding Transaction2 through CDIS";
                testStep = TestStepHelper.StartTestStep(testStep);
                string HeaderId1 = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(member[0], date);
                testStep.SetOutput("Updated Transaction for the member LoyaltyID " + basePages.GetLoyaltyNumber(user) + " with Transaction number " + HeaderId1);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5B:Transaction2 Search and Verify Sales Transactions With Specific Date Range
                stepName = "Transaction2 : Search and Verify Sales Transactions ";
                testStep = TestStepHelper.StartTestStep(testStep);
                memberPortal_AccountActivityPage.SelectDate_RC(FromDate, ToDate);
                memberPortal_AccountActivityPage.VerifySalesTransactionsSection("Header Id", HeaderId1, out message);
                testStep.SetOutput(message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6A: Adding Transaction3 through CDIS
                stepName = "Adding Transaction3 through CDIS";
                testStep = TestStepHelper.StartTestStep(testStep);
                string HeaderId2 = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(member[0], date);
                testStep.SetOutput("Updated Transaction for the member LoyaltyID " + basePages.GetLoyaltyNumber(user) + " with Transaction number " + HeaderId2);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6B:Transaction3 Search and Verify Sales Transactions With Specific Date Range
                stepName = "Transaction3 : Search and Verify Sales Transactions ";
                testStep = TestStepHelper.StartTestStep(testStep);
                memberPortal_AccountActivityPage.SelectDate_RC(FromDate, ToDate);
                memberPortal_AccountActivityPage.VerifySalesTransactionsSection("Header Id", HeaderId2, out message);
                testStep.SetOutput(message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: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.SetOutput(Step_Output);
                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);
            }
        }
Esempio n. 9
0
        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);
            }
        }
Esempio n. 10
0
        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);
            }
        }