Example #1
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 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);
            }
        }
        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);
            }
        }