Esempio n. 1
0
        public void BTA_280_CSP_RequestCredit_Online_TransactionAmount()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName                     = "";
            bool   stepstatus                   = true;
            var    CSPortal_RequestCredit       = new CSPortal_RequestCredit(DriverContext);
            var    CSPMemberAccountActivityPage = new CSPortal_MemberAccountActivityPage(DriverContext);
            var    CSP_HomePage                 = new CSPortal_HomePage(DriverContext);
            var    CSPAccountSummaryPage        = new CSPortal_MemberAccountSummaryPage(DriverContext);
            var    CSP_LoginPage                = new CSPortal_LoginPage(DriverContext);

            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);
                var CSPSearchPage = new CSPortal_SearchPage(DriverContext);
                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();
                DateTime Txn_dateformat = DateTime.Parse(RequestCredit_Search_Criteria.TxnDate);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

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

                #region Step1:Launch CSPortal Portal
                stepName = "Launch Customer Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);;
                CSP_LoginPage.LaunchCSPortal(login.Csp_url, out 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:Search Based on Loyalty ID
                stepName   = "Search Based on Loyalty ID";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(LoyaltyNumber_One, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Select and Verify Loyalty ID
                stepName = "Select and Verify Loyalty ID";
                testStep = TestStepHelper.StartTestStep(testStep);
                CSPSearchPage.Select(LoyaltyNumber_One_Firstname);
                stepstatus = CSPAccountSummaryPage.VerifyLoyaltyId(LoyaltyNumber_One, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Navigate to Request Credit
                stepName   = "Navigate to Request Credit Page";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.RequestCredit, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Search With Transaction Amount
                stepName = "Select Online and Search With Transaction Amount:" + RequestCredit_Search_Criteria.TxnAmount;
                testStep = TestStepHelper.StartTestStep(testStep);
                CSPortal_RequestCredit.Select_Online();
                stepstatus = CSPortal_RequestCredit.Search_Online_BasedOnTransactionAmount(RequestCredit_Search_Criteria.TransactionNumber, RequestCredit_Search_Criteria.TxnAmount, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: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 Step8: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 Step9:Navigate to Account Activity Page
                stepName   = "Navigate to Account ActivityPage";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.AccountActivity, out Step_Output);
                testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10:Search and Verify Purchase History of First Transaction With Specific Date Range
                stepName = "Search and Verify Purchase History ";
                testStep = TestStepHelper.StartTestStep(testStep);
                Txn_dateformat.ToString("MMddyyyy");
                CSPMemberAccountActivityPage.SelectDate_RC(Txn_dateformat, Txn_dateformat);
                testStep.SetOutput(CSPMemberAccountActivityPage.VerifyPurchaseHistoryBasedonHeader(RequestCredit_Search_Criteria.TransactionNumber));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11:Logout As csadmin
                stepName = "Logout As csadmin";
                testStep = TestStepHelper.StartTestStep(testStep);
                CSP_HomePage.LogoutCSPortal(); testStep.SetOutput("Logout As csadmin 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_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);
            }
        }