public void BTA151_ST966_SOAP_LockDown_NonMember_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberNonMember();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName + " and the member status is: " + output.MemberStatus);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate Memberstatus in DB as Non Member";
                string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "MemberStatus", string.Empty);
                // string dbMemberStatus = DatabaseUtility.GetFromSoapDB("LW_LoyaltyMember", "IPCODE", output.IpCode.ToString(), "NewStatus", string.Empty);
                Assert.AreEqual(Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)), output.MemberStatus.ToString(), "Expected value is" + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + "Actual value is" + output.MemberStatus.ToString());
                testStep.SetOutput("The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString());
                Logger.Info("TestStep: " + stepName + " ##Passed## The Memberstatus from DB is: " + Enum.GetName(typeof(Member_Status), Convert.ToInt32(dbMemberStatus)) + " and the memberstatus from AddMember method response is: " + output.MemberStatus.ToString());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing Loyalty Id of a member whose status is Non Member";
                //string error = (string)cdis_Service_Method.LockDownMemberNegative(vc[0].LoyaltyIdNumber);
                string error = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.UtcNow, "CDIS Automation", string.Empty, out elapsedTime);
                testStep.SetOutput("Throws an expection with the " + error);
                string[] errors      = error.Split(';');
                string[] errorssplit = errors[0].Split('=');
                string[] errorsnew   = errors[1].Split('=');
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the response for Error Code as 3393";
                Assert.AreEqual("3393", errorssplit[1], "Expected value is" + "3393" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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);
            }
        }
Beispiel #2
0
        public void BTA555_REST_GetMemberRewardsByFMS_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject response;

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Fetching member rewards through rest service using Invalid First Name";
                response = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.FirstName, common.RandomString(15));
                if (response.Value <string>("isError") == "True")
                {
                    testStep.SetOutput("The response code from GetMemberRewardsByFMS service for a member with " +
                                       "invalid First Name is: " + response.Value <int>("responseCode") + "");
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep); testStep = TestStepHelper.StartTestStep(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate the developer message for the above response code from the Service";
                    if (response.Value <int>("responseCode") == 10504)
                    {
                        testStep.SetOutput("developerMessage from response is: " + response.Value <string>("developerMessage"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        Logger.Info("test passed");
                        testCase.SetStatus(true);
                    }
                    else
                    {
                        Logger.Info("test failed");
                        testStep.SetOutput("response message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                        testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                        listOfTestSteps.Add(testStep);
                        throw new Exception("response message is" + response.Value <string>("developerMessage") + "and response code is" + response.Value <int>("responseCode"));
                    }
                }
                else
                {
                    Logger.Info("test failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, 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);
            }
        }
Beispiel #3
0
        public void BTA_27_Navigator_LN_DeleteUser()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";

            try
            {
                #region Object initialization
                var    navigator_LoginPage       = new Navigator_LoginPage(DriverContext);
                var    application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext);
                var    adminPage   = new Navigator_Admin_UsersPage(driverContext);
                string DbauserName = adminPage.GetUserName(NavigatorUsers.DBAUser, Users.AdminRole.DBA.ToString());

                DbauserName = ProjectBasePage.GetUserInfo("RegressionUser", "username");
                string adminUserName = adminPage.GetUserName(NavigatorUsers.AdminUser, Users.AdminRole.LWADM.ToString());
                #endregion

                #region Step1:Open Navigator URL
                stepName = "Open 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 to Navigator using LWAdminUser
                stepName       = "Login to Navigator using LWAdminUser";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = adminUserName;
                login.Password = password;
                navigator_LoginPage.Login(login, Users.AdminRole.LWADM.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Create DBAAdmin user and assign role
                stepName = "Create DBAAdmin user and assign role";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.users);
                var user = adminPage.UserDetails(DbauserName, password);
                testStep.SetOutput(adminPage.Create_AdminUsers(user, Users.AdminRole.DBA.ToString()));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Delete Newely Created User
                stepName = "Delete Newely Created User";
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(adminPage.Delete_AdminUsers(user));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Logout from LWAdminUser
                stepName = "Logout from LWAdminUser";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Login to Navigator using Deleted User and Verify
                stepName       = "Login to Navigator using Deleted User and Verify";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = DbauserName;
                login.Password = password;
                navigator_LoginPage.Login(login, Users.AdminRole.DBA.ToString(), out stroutput); testStep.SetOutput(stroutput);
                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);
            }
        }
Beispiel #4
0
        public void BTA_227_LN_JobCreationValidationsInSchedulePage()
        {
            #region Object Initialization
            CategoryFields   coupon    = new CategoryFields();
            ProjectBasePage  basePages = new ProjectBasePage(driverContext);
            NonAdminUserData data      = new NonAdminUserData(driverContext);
            var            application_Nav_Util_Page      = new Application_Nav_Util_Page(DriverContext);
            var            navigator_Users_ProgramPage    = new Navigator_Users_ProgramPage(DriverContext);
            var            Program_RewardCatalogPage      = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var            RewardCatalog_ExchangeRatePage = new Navigator_Users_Program_RewardCatalog_ExchangeRatesPage(DriverContext);
            CategoryFields rate = new CategoryFields();
            CategoryFields job  = new CategoryFields();
            job.Name = data.JobName + RandomDataHelper.RandomString(5);
            job.FrequencyDropDown = CategoryFields.FrequencyType.Hourly.ToString();
            job.Hour = job.RunEveryHour;
            var date = DateTime.Now;
            job.StartDate   = DateHelper.GetDate("Current");
            job.ExpiryDate  = DateHelper.GetDate("Future");
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";
            #endregion

            try
            {
                #region Step1: Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage);
                testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2: Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput);
                testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3: Verify that Job Name is a required value for creating a new Job
                stepName = "Verify that Job Name is a required value for creating a new Job ";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ExchangeRates);
                RewardCatalog_ExchangeRatePage.NavigateToExchangeRatesTab(Navigator_Users_Program_RewardCatalog_ExchangeRatesPage.ExchangeTabs.Schedule);
                RewardCatalog_ExchangeRatePage.VerifyJobNameIsRequiredValueForCreatingNewJob("Job Name is a required value.", out string status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Verify that Frequency is a required value for creating a new Job
                stepName = "Verify that Frequency  is a required value for creating a new Job";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.VerifyThatFrequencyValueIsRequiredValueForCreatingNewJob(job, "A frequency value must be seleted.", out status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: Verify that Start Date is a required value for creating a new Job
                stepName = "Verify that Start Date is a required value for creating a new Job";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.VerifyThatStartDateIsRequiredValueForCreatingNewJob(job, "Start date is a required value.", out status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: Verify that End Date is a required value for creating a new Job
                stepName = "Verify that End Date is a required value for creating a new Job";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.VerifyThatEndDateIsRequiredValueForCreatingNewJob(job, "End date is a required value.", out status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8: Verify that the 'Run At' field does not disappear when you click save button with no 'Run At' value provided for 'One time
                stepName = " Verify that the 'Run At' field does not disappear when you click save button with no 'Run At' value provided for 'One time";
                testStep = TestStepHelper.StartTestStep(testStep);
                job.FrequencyDropDown = CategoryFields.FrequencyType.OneTime.ToString();
                RewardCatalog_ExchangeRatePage.VerifyRunFieldIsRequiredForCreatingNewJobBySelectingOneTimeFrequency(job, "Please enter a date and time or run the job.", out status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: Logout
                stepName = "Logout from USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + 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);
            }
        }
        public void BTA_77_LN_RegularRewardCreationValidations()
        {
            #region Object Declaration
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            CategoryFields   product   = new CategoryFields();
            ProjectBasePage  basePages = new ProjectBasePage(driverContext);
            NonAdminUserData data      = new NonAdminUserData(driverContext);
            var            application_Nav_Util_Page         = new Application_Nav_Util_Page(DriverContext);
            var            navigator_Users_ProgramPage       = new Navigator_Users_ProgramPage(DriverContext);
            var            Program_ComponentsPage            = new Navigator_Users_Program_ComponentsPage(DriverContext);
            var            navigator_CreateBonus_Category    = new Navigator_Users_Program_Components_CategoriesPage(DriverContext);
            var            navigator_CreateBonus             = new Navigator_Users_Program_eCollateral_BonusesPage(DriverContext);
            var            RewardCatalog_ProductsPage        = new Navigator_Users_Program_RewardCatalog_ProductsPage(DriverContext);
            var            Program_RewardCatalogPage         = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var            RewardCatalog_RewardsPage         = new Navigator_Users_Program_RewardCatalog_RewardsPage(DriverContext);
            var            RewardCatalog_ProductVariantsPage = new Navigator_Users_Program_RewardCatalog_ProductVariantsPage(DriverContext);
            var            navigator_LoginPage = new Navigator_LoginPage(DriverContext);
            CategoryFields reward   = new CategoryFields();
            string         stepName = "";
            #endregion

            try
            {
                #region Object Initialization
                var attName = data.AttributeAllContentType;
                product.SetType = "Product Name";
                #endregion

                #region Step1:Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Create New Category with Product and Verify
                product.CategoryTypeValue = CategoryFields.CategoryType.Product.ToString();
                product.CategoryName      = data.ProductCategoryName;
                stepName = "Create new Category as " + product.CategoryName;
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components);
                Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Categories);
                testStep.SetOutput(navigator_CreateBonus_Category.CreateCategory(product));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Create new product and Verify
                var contentType = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Product;
                product.Name                  = data.ProductName + RandomDataHelper.RandomString(4);
                product.AttributeName         = attName + contentType.ToString();
                product.ValueToSetInAttribute = "ValueGivenForAttributeSetProduct";
                stepName = "Create New Product with Category as " + product.Name + "";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Products);
                testStep.SetOutput(RewardCatalog_ProductsPage.CreateProduct_With_ProductCategory(product));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Verify that error message: "Please provide a reward name." is displayed while creating Reward
                stepName = "Verify that error message: 'Please provide a reward name.' is displayed while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.BalanceNeeded     = reward.RewardBalanceNeeded;
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Rewards);
                RewardCatalog_RewardsPage.CreateRewardWithoutNameAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: Verify that error message: The error message: "Name cannot be more than 300 characters." while creating Reward
                stepName = "Verify that error message: The error message: 'Name cannot be more than 300 characters.' while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.Name          = RandomDataHelper.RandomString(301);
                reward.BalanceNeeded = reward.RewardBalanceNeeded;
                testStep             = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_RewardsPage.CreateRewardWithMoreThanThreeHundredCharactersAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Verify that the error message: "Enter a non-negative value." is displayed when entered Alpha Charaters in BalanceNeeded while creating Reward
                stepName = "Verify that the error message: 'Enter a non - negative value.' is displayed when entered Alpha Charaters in BalanceNeeded while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.Name          = RandomDataHelper.RandomString(5);
                reward.BalanceNeeded = RandomDataHelper.RandomString(4);
                testStep             = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_RewardsPage.CreateRewardByEnteringOtherThanNumericInBalanceNeededAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: Verify that the error message: "Enter a non-negative value." is displayed when entered Special Characters in BalanceNeeded while creating Reward
                stepName = "Verify that the error message: 'Enter a non - negative value.' is displayed when entered Special Characters in BalanceNeeded while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.Name          = RandomDataHelper.RandomString(5);
                reward.BalanceNeeded = "!@#%^&*";
                testStep             = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_RewardsPage.CreateRewardByEnteringOtherThanNumericInBalanceNeededAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8: Verify that the error message: "Please provide a valid numeric value for balance needed." is displayed without BalanceNeeded while creating Reward
                stepName = "Verify that the error message: 'Please provide a valid numeric value for balance needed.' is displayed without BalanceNeeded while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.Name = RandomDataHelper.RandomString(5);
                testStep    = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_RewardsPage.CreateRewardWithoutBalanceNeededAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: Verify that the error message: "CertificateTypeCode cannot be more than 50 characters." is displayed while creating Reward
                stepName = "Verify that the error message: 'CertificateTypeCode cannot be more than 50 characters.' is displayed while creating Reward";
                reward.CategoryTypeValue = product.Name;
                reward.Name = RandomDataHelper.RandomString(5);
                reward.CertificateTypeCode = RandomDataHelper.RandomString(51);
                reward.BalanceNeeded       = reward.RewardBalanceNeeded;
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_RewardsPage.CreateRewardWithFiftyCharsCertificateTypeCodeAndVerifyErrorMessage(reward);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Verify text box labled "Redemption Time Limit (Minutes)"
                stepName = "Verify text box labled 'Redemption Time Limit(Minutes)'";
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(RewardCatalog_RewardsPage.VerifyRedemptionTimeLimitLabel());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11: Logout
                stepName = "Logout from Rewards page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                Assert.Fail();
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #7
0
        public void BTA_226_LN_UpdatedDefaultCurrencyInConfigFile_And_VerifySearchFunctionalityForDifferentValuesInExchangeRates()
        {
            #region Object Initialization
            CategoryFields  coupon    = new CategoryFields();
            Migration       Migration = new Migration(driverContext);
            ProjectBasePage basePages = new ProjectBasePage(driverContext);
            var             application_Nav_Util_Page      = new Application_Nav_Util_Page(DriverContext);
            var             navigator_Users_ProgramPage    = new Navigator_Users_ProgramPage(DriverContext);
            var             Program_RewardCatalogPage      = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var             RewardCatalog_ExchangeRatePage = new Navigator_Users_Program_RewardCatalog_ExchangeRatesPage(DriverContext);
            var             manageOrganizationPage         = new Navigator_Orgnizations_FrameworkConfigurationPage(DriverContext);
            var             organizationPage = new Navigator_Admin_OrganizationsPage(driverContext);
            string          configPath       = BnPBaseFramework.Web.Helpers.FilesHelper.GetFolder(BaseConfiguration.DownloadFolder, Directory.GetCurrentDirectory());
            string          FrameworkCfgFile = basePages.ConfigDownloadPath + @"\Framework.cfg";
            basePages.DeleteExistedFile(FrameworkCfgFile);
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string         stepName = "";
            CategoryFields rate     = new CategoryFields();
            #endregion

            try
            {
                #region Step1: Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage);
                testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2: Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput);
                testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3: Navigate to organization page
                stepName = "Navigate to organization page";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.organization);
                testStep.SetOutput("Successfully navigated to Organization page");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Navigate to Framework Configuration tab
                stepName = "Select Organization and Environment";
                testStep = TestStepHelper.StartTestStep(testStep);
                organizationPage.NavigateToOrganizationsTabs(Navigator_Admin_OrganizationsPage.OrganizationsTabs.FrameworkConfiguration, out string Message);
                testStep.SetOutput(Message + ";" + Message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: Set a value to the Default Currency in the framework configuration
                stepName = "Set a value to the Default Currency in the framework configuration";
                testStep = TestStepHelper.StartTestStep(testStep);
                manageOrganizationPage.EditDefaultCurrencyValueInFrameworkConfiguration(FrameworkCfgFile, rate.ExchangeRateValue, out string Status);
                testStep.SetOutput(Status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Verify that the Program Based Currency is displayed in the Rates page
                stepName = "Verify ProgramBaseCurrency Value in Exchange Rates Page is displaying Updated Currency Value " + rate.ExchangeRateValue;
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ExchangeRates);
                RewardCatalog_ExchangeRatePage.VerifyProgramBaseCurrencyValueIsDisplayingUpdatedCurrencyValue(rate.ExchangeRateValue, out Status);
                testStep.SetOutput(Status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: Verify that the search functionality works for To Currency Name
                stepName = "Verify that the search functionality works for To Currency Name";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.SearchExchangeRateBasedOnEqualToPredicateValue(CategoryFields.ExchangeRatePropertyType.ToCurrencyName.ToString(), CategoryFields.Predicates.Eq.ToString(), rate.ToCurrencyName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8: Verify that the search functionality works for To Currency
                stepName = "Verify that the search functionality works for To Currency";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.SearchExchangeRateBasedOnEqualToPredicateValue(CategoryFields.ExchangeRatePropertyType.ToCurrency.ToString(), CategoryFields.Predicates.Eq.ToString(), rate.ExchangeRateValue);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: Verify that the search functionality works for From Currency Name
                stepName = "Verify that the search functionality works for From Currency Name";
                testStep = TestStepHelper.StartTestStep(testStep);
                RewardCatalog_ExchangeRatePage.SearchExchangeRateBasedOnEqualToPredicateValue(CategoryFields.ExchangeRatePropertyType.FromCurrencyName.ToString(), CategoryFields.Predicates.Eq.ToString(), rate.FromCurrencyName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Verify that the search functionality works for From Currency
                stepName = "Verify that the search functionality works for From Currency";
                testStep = TestStepHelper.StartTestStep(testStep);
                var result = RewardCatalog_ExchangeRatePage.SearchExchangeRateBasedOnEqualToPredicateValue(CategoryFields.ExchangeRatePropertyType.FromCurrency.ToString(), CategoryFields.Predicates.Eq.ToString(), rate.ExchangeRateValue);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, result, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11: Navigate to Framework Configuration tab
                stepName = "Select Organization and Environment";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.organization);
                organizationPage.NavigateToOrganizationsTabs(Navigator_Admin_OrganizationsPage.OrganizationsTabs.FrameworkConfiguration, out Message); testStep.SetOutput(Message + ";" + Message);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step12: Revert the customized changes done for Default Currency in the framework configuration and verify the updated value
                stepName = "Revert the customized changes done for Default Currency in the framework configuration and verify the updated value as " + rate.DefaultCurrencyValue;
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(manageOrganizationPage.EditDefaultCurrencyValueInFrameworkConfiguration(FrameworkCfgFile, rate.DefaultCurrencyValue, out Status));
                testStep.SetOutput(Status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step13: Verify that the Program Based Currency is updated to default Currency Value in the Rates page
                stepName = "Verify ProgramBaseCurrency Value in Exchange Rates Page is displaying Updated Currency Value " + rate.ExchangeRateValue;
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ExchangeRates);
                RewardCatalog_ExchangeRatePage.VerifyProgramBaseCurrencyValueIsDisplayingUpdatedCurrencyValue(rate.DefaultCurrencyValue, out Status);
                testStep.SetOutput(Status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Logout
                stepName = "Logout from USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + 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);
            }
        }
Beispiel #8
0
        public void BTA1228_ST1351_SOAP_CreateCsNote_ExistingMember()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
            long value;

            try
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Create CS Note for an Existing member";
                IList <VirtualCard> vc = output.GetLoyaltyCards();
                value = cdis_Service_Method.CreateCsNote(vc[0].LoyaltyIdNumber, "The customer password was reset", out elapsedTime);
                testStep.SetOutput("Created CS Note successfully for the member with member identity: " + vc[0].LoyaltyIdNumber + " and the CSNOTE is: The customer password was reset");
                Logger.Info("Created CS Note successfully for an existing member with member identity: " + vc[0].LoyaltyIdNumber + " and the CSNOTE is: The customer password was reset");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate CSNOTE with the DB value for the numericalID received from the response";
                string note = DatabaseUtility.GetFromSoapDB("Lw_Csnote", "Id", value.ToString(), "NOTE", string.Empty);
                testStep.SetOutput("Created CS Note successfully for the member with member identity: " + vc[0].LoyaltyIdNumber + " and the CSNOTE is: The customer password was reset");
                Assert.AreEqual("The customer password was reset", note, "The Expected value is : <The customer password was reset> and the Actual value is: " + note);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the elapsed time is greater than Zero";
                if (elapsedTime > 0)
                {
                    testStep.SetOutput("Elapsed time is greater than zero and the elapsed time is " + elapsedTime);
                }
                else
                {
                    throw new Exception("Elapsed time is not greater than Zero");
                }
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #9
0
        public void BTA_506_MP_RequestCredit_Online_TransactionNumber()
        {
            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);

            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 TransactionNumber
                stepName   = "Select Online and Search With TransactionNumber:" + RequestCredit_Search_Criteria.TransactionNumber;
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = Mp_RequestCredit.Search_BasedOnTransactionNumber(RequestCredit_Search_Criteria.TransactionNumber, 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);
            }
        }
Beispiel #10
0
        public void BTA267_CSP_Issue_Points_By_Admin_Agent()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            var ProjectBase = new ProjectBasePage(DriverContext);

            try
            {
                #region Objects
                var CSP_LoginPage        = new CSPortal_LoginPage(DriverContext);
                var CSPSearchPage        = new CSPortal_SearchPage(DriverContext);
                var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext);
                var CSP_HomePage         = new CSPortal_HomePage(DriverContext);
                var cSPortal_CustomerAppeasementsPage = new CSPortal_CustomerAppeasementsPage(DriverContext);
                #endregion

                #region Step1:Adding member with CDIS service
                stepName = "Adding member with CDIS service";
                testStep = TestStepHelper.StartTestStep(testStep);
                Member user = ProjectBase.CreateMemberThroughCDIS();
                testStep.SetOutput("Created Member With LoyaltyId  " + ProjectBase.GetLoyaltyNumber(user));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Launch CSPortal Portal
                stepName = "Launch Customer Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Login As AdminAgent
                stepName       = "Login As AdminAgent User";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = AgentValues.AdminAgent;
                login.Password = AgentValues.Agentpassword;
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep.SetOutput("Login As AdminAgent User is Successful");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Search Based on Loyalty ID
                stepName   = "Search Based on Loyalty ID";
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPSearchPage.Search_BasedOnLoyaltyID(ProjectBase.GetLoyaltyNumber(user), out stepOutput); testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Adding points to member beyond range
                stepName = "Adding points to member beyond range";
                testStep = TestStepHelper.StartTestStep(testStep);
                var userName  = user.FirstName;
                var maxPoints = 200;
                var points    = new System.Random().Next(201, 500).ToString();;
                CSPSearchPage.Select(userName);
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out string result);
                testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddingPointsToMember(points, maxPoints));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Adding Points To Member
                stepName = "Adding Points To Member";
                testStep = TestStepHelper.StartTestStep(testStep);
                userName = user.FirstName;
                points   = new System.Random().Next(1, 200).ToString();;
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.CustomerAppeasements, out result);
                testStep.SetOutput(cSPortal_CustomerAppeasementsPage.AddingPointsToMember(points, maxPoints));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Verify Points in Accountactivity Page
                stepName = "Verify Points in Accountactivity Page";
                testStep = TestStepHelper.StartTestStep(testStep);
                userName = user.FirstName;
                CSPSearchPage.Select(userName);
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.AccountActivity, out result);
                cSPortal_CustomerAppeasementsPage.VerifyPointsInAccountActivityPage(points);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

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

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                stepstatus = false;
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                Assert.Fail();
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #11
0
        public void BTA144_REST_PT_AddTransactionToMember_WithAllFields_UsingVCKEY_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);
            JObject       response;
            List <string> ats_txnheader = new List <string>();

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE=" + member["data"].Value <int>("id") + "; Name=" + member["data"].Value <string>("firstName") + "; VC_KEY=" + member["data"]["cards"][0].Value <string>("id"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                }
                else
                {
                    testStep.SetOutput(member.Value <string>("responseCode") + member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info(member.Value <string>("responseCode") + member.Value <string>("developerMessage"));
                    Logger.Info("Test  failed");
                    throw new Exception(member.Value <string>("developerMessage"));
                }

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding transaction through rest service to a member with all fields by providing the VCKEY";
                response = (JObject)rest_Service_Method.PostTransactionWithVCKeyWithAllFields(member["data"]["cards"][0].Value <string>("id"));
                if (response.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("Transaction Rowkey: " + response["data"]["transactions"].Value <string>("id") + "; TransactionID: " + response["data"]["transactions"].Value <string>("transactionId") + "; TransactionAmount: " + response["data"]["transactions"].Value <string>("amount"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep      = TestStepHelper.StartTestStep(testStep);
                    stepName      = "Validate data from DB";
                    ats_txnheader = DatabaseUtility.GetVCkeyfromDBUsingROWKEYREST(response["data"]["transactions"].Value <string>("id"));
                    testStep.SetOutput("The Following details are verified in DB:" +
                                       "; VCKEY is: " + ats_txnheader[0] +
                                       "; TransactionID is: " + ats_txnheader[1] +
                                       "; Transaction Amt is: " + ats_txnheader[2]);
                    Assert.AreEqual(member["data"]["cards"][0].Value <string>("id"), ats_txnheader[0], "Expected value is " + member["data"]["cards"][0].Value <string>("id") + " and actual value is " + ats_txnheader[0]);
                    Assert.AreEqual(response["data"]["transactions"].Value <string>("transactionId"), ats_txnheader[1], "Expected value is " + response["data"]["transactions"].Value <string>("transactionId") + " and actual value is " + ats_txnheader[1]);
                    Assert.AreEqual(response["data"]["transactions"].Value <string>("amount"), ats_txnheader[2], "Expected value is " + response["data"]["transactions"].Value <string>("amount") + " and actual value is " + ats_txnheader[2]);
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(response.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(response.Value <string>("developerMessage"));
                }
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, 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);
            }
        }
        public void BTA_274_CSP_RequestCredit_Store_TransactionDate()
        {
            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 Date
                stepName   = "Search With Transaction Date:" + RequestCredit_Search_Criteria.TxnDate;
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSPortal_RequestCredit.Search_Store_BasedOnTransactionDate(RequestCredit_Search_Criteria.TransactionNumber, RequestCredit_Search_Criteria.TxnDate, 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 BTA151_ST961_SOAP_LockDown_Already_LockedMember_POSITIVE()

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

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing Loyalty Id of a member whose status is Active";
                //cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber);
                string message = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", string.Empty, out elapsedTime);
                Assert.AreEqual("pass", message, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member's : IPCODE: " + vc[0].IpCode + " member status is: " + getAccountSummary.MemberStatus + " and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);

                //testStep = TestStepHelper.StartTestStep(testStep);
                //stepName = "validating the card status for lock down member from database";
                //String dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                //String value = (Member_Status)Int32.Parse(dbresponse) + "";
                //Assert.AreEqual(Member_Status.Locked.ToString(), value, "Expected value is" + Member_Status.Locked.ToString() + "Actual value is" + value);
                //testStep.SetOutput("The card status from database for lockdown member is : \"" + dbresponse + "\" and the member status: " + (Member_Status)Int32.Parse(dbresponse));
                //testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                //listOfTestSteps.Add(testStep);
                //testCase.SetStatus(true);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing Loyalty Id of a member whose status is Locked";
                //cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber);
                string message_Locked = cdis_Service_Method.LockDownMember(vc[0].LoyaltyIdNumber, DateTime.Now, "SOAP_Automation", string.Empty, out elapsedTime);
                Assert.AreEqual("pass", message_Locked, "Member with loyalty id: " + vc[0].LoyaltyIdNumber + " has not been locked");
                var getAccountSummaryLD = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("Member's details of locked down member : IPCODE: " + vc[0].IpCode + " member status is: " + getAccountSummaryLD.MemberStatus + " and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                //  testStep.SetOutput("Member status remains the same and the loyalty Id is : " + vc[0].LoyaltyIdNumber);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the card status for lock down member from database";
                string dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                string value      = (Member_Status)Int32.Parse(dbresponse) + "";
                Assert.AreEqual(getAccountSummaryLD.MemberStatus, value, "Expected value is" + getAccountSummaryLD.MemberStatus + "Actual value is" + value);
                testStep.SetOutput("The cardstatus Code from database for lockdown member is : \"" + dbresponse + "\" and the member status: " + (Member_Status)Int32.Parse(dbresponse));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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);
            }
        }
        public void BTA151_ST969_SOAP_LockDown_MergedMember_NEGATIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding first member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                vc = output.GetLoyaltyCards();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc1 = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding second member using AddMember method";
                Member outputnew = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + outputnew.IpCode + ", Name: " + outputnew.FirstName);
                Logger.Info("IpCode: " + outputnew.IpCode + ", Name: " + outputnew.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc2 = outputnew.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Merging Members through MergeMember method";
                Member member            = cdis_Service_Method.MergeMembers(vc1[0].LoyaltyIdNumber, vc2[0].LoyaltyIdNumber);
                var    getAccountSummary = cdis_Service_Method.GetAccountSummary(vc1[0].LoyaltyIdNumber);
                testStep.SetOutput("1st Member details : IPCODE: " + vc1[0].IpCode + " and member status is:" + getAccountSummary.MemberStatus);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vcmerge = member.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the Member status for Merged member from database";
                string dbresponse = DatabaseUtility.GetMemberStatusfromDbSOAP(output.IpCode + "");
                string value      = (Member_Status)Int32.Parse(dbresponse) + "";
                Assert.AreEqual(Member_Status.Merged.ToString(), value, "Expected value is" + Member_Status.Merged.ToString() + "Actual value is" + value);
                testStep.SetOutput("The cardstatus Code from database for merged member is : \"" + dbresponse + "\" and the member status: " + (Member_Status)Int32.Parse(dbresponse));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(true);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Locking down the member by passing Loyalty Id of a member whose status is Merged";
                //string error = (string)cdis_Service_Method.LockDownMemberNegative(vc1[0].LoyaltyIdNumber);
                string error = cdis_Service_Method.LockDownMember(vc1[0].LoyaltyIdNumber, DateTime.UtcNow, "CDIS Automation", string.Empty, out elapsedTime);
                testStep.SetOutput("Throws an expection with the " + error);
                string[] errors      = error.Split(';');
                string[] errorssplit = errors[0].Split('=');
                string[] errorsnew   = errors[1].Split('=');
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the response for Error Code as 3392";
                Assert.AreEqual("3392", errorssplit[1], "Expected value is" + "3392" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errorsnew[1]);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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);
            }
        }
        public void BTA227_CDIS_GetMemberPromotionCount_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            int    index    = 0;

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " ,Name: " + output.FirstName);
                Logger.Info("IpCode:" + output.IpCode + ",Name:" + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Getting Promotion Definitions from Service";
                if (cdis_Service_Method.GetActivePromotionsDefinitionsCount() < 15)
                {
                    index = 0;
                }
                else
                {
                    index = cdis_Service_Method.GetActivePromotionsDefinitionsCount() - 10;
                }

                PromotionDefinitionStruct[] def    = cdis_Service_Method.GetPromotionDefinitionsRecent(index);
                PromotionDefinitionStruct   promot = new PromotionDefinitionStruct();
                foreach (PromotionDefinitionStruct pd in def)
                {
                    if (pd.Targeted)
                    {
                        promot = pd;
                        break;
                    }
                }
                testStep.SetOutput("The Targerted Promotion: " + promot.Name + " will be added to the member; Name: " + output.FirstName);
                Logger.Info("Promotion to be added " + promot.Name);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding Promotion to a member from Service";
                MemberPromotionStruct promotionCode = cdis_Service_Method.AddMemberPromotion(vc[0].LoyaltyIdNumber, promot.Code);
                testStep.SetOutput("The Targerted Promotion: " + promot.Name + " with Promotion ID : " + promotionCode.Id + " has been added to member: " + output.FirstName);
                Logger.Info("MemberPromotion Code : " + promotionCode.Id);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get PromotionCount for a Member from Service";
                int PromotionMemberCount = cdis_Service_Method.GetPromotionMembersCount(vc[0].LoyaltyIdNumber);
                testStep.SetOutput("The MemberPromotion Count for the above member from the response of GetPromotionMemberCount method: " + PromotionMemberCount);
                Logger.Info("MemberPromotion Count : " + PromotionMemberCount);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the Member promotion count from database";
                string dbresponse = DatabaseUtility.GetMemberPromotionsCountUsingIdFromDBSOAP(output.IpCode + "");
                Assert.AreEqual(PromotionMemberCount + "", dbresponse, "Expected value is" + PromotionMemberCount + "Actual value is" + dbresponse);
                testStep.SetOutput("Member Promotion Count from database:" + dbresponse);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                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);
            }
        }
        public void BTA235_SOAP_IsMemberRewardRedeemed()

        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            double time     = 0;

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get Recent Reward Catalog with GetRewardCatalog 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("The RewardID from the response of GetRewardCatalog method is : " + reward.RewardID);
                Logger.Info("RewardID:" + reward.RewardID);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Add Reward to Member using AddMemberRewards service";
                AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward);
                testStep.SetOutput("The membersRewardID is: " + memberRewardsOut.MemberRewardID);
                Logger.Info("RewardID:" + memberRewardsOut.MemberRewardID);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Verify whether member reward is redeemed using IsMemberRewardRedeemed method";
                bool Value = cdis_Service_Method.IsMemberRewardRedeemed(memberRewardsOut.MemberRewardID + "", out time);
                testStep.SetOutput("The response from the IsMemberRewardRedeemed method is [" + Value + "] which means memberRewardID : " + memberRewardsOut.MemberRewardID + " has not been redeemed");
                Logger.Info("Member Reward Redeemed: " + Value);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the redeemed status";
                Assert.AreEqual("False", Value.ToString(), "Expected Value is :False and Actual Value is : " + Value);
                testStep.SetOutput("IsMemberRewardRedeemed method returns : [" + Value + "]");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA_82_LN_Program_RewardCatalog_Reward_CloneReward()
        {
            #region Object Declaration
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            CategoryFields   product                 = new CategoryFields();
            ProjectBasePage  basePages               = new ProjectBasePage(driverContext);
            NonAdminUserData data                    = new NonAdminUserData(driverContext);
            var    application_Nav_Util_Page         = new Application_Nav_Util_Page(DriverContext);
            var    navigator_Users_ProgramPage       = new Navigator_Users_ProgramPage(DriverContext);
            var    Program_ComponentsPage            = new Navigator_Users_Program_ComponentsPage(DriverContext);
            var    navigator_CreateBonus_Category    = new Navigator_Users_Program_Components_CategoriesPage(DriverContext);
            var    navigator_CreateBonus             = new Navigator_Users_Program_eCollateral_BonusesPage(DriverContext);
            var    RewardCatalog_ProductsPage        = new Navigator_Users_Program_RewardCatalog_ProductsPage(DriverContext);
            var    Program_RewardCatalogPage         = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var    RewardCatalog_RewardsPage         = new Navigator_Users_Program_RewardCatalog_RewardsPage(DriverContext);
            var    RewardCatalog_ProductVariantsPage = new Navigator_Users_Program_RewardCatalog_ProductVariantsPage(DriverContext);
            var    navigator_LoginPage               = new Navigator_LoginPage(DriverContext);
            string stepName = "";
            #endregion
            try
            {
                #region Object Initialization
                var attName = data.AttributeAllContentType;
                product.SetType = "Product Name";
                #endregion

                #region Step1:Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Create New Category with Product and Verify
                product.CategoryTypeValue = CategoryFields.CategoryType.Product.ToString();
                product.CategoryName      = data.ProductCategoryName;
                stepName = "Create new Category as " + product.CategoryName;
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components);
                Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Categories);
                testStep.SetOutput(navigator_CreateBonus_Category.CreateCategory(product));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4: Create new product and Verify
                var contentType = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Product;
                product.Name                  = data.ProductName + RandomDataHelper.RandomString(4);
                product.AttributeName         = attName + contentType.ToString();
                product.ValueToSetInAttribute = "ValueGivenForAttributeSetProduct";
                stepName = "Create New Product with Category as " + product.Name + "";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Products);
                testStep.SetOutput(RewardCatalog_ProductsPage.CreateProduct_With_ProductCategory(product));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: Create new reward and Verify
                CategoryFields reward = new CategoryFields
                {
                    Name              = data.RewardName + RandomDataHelper.RandomString(5),
                    BalanceNeeded     = "100",
                    CategoryTypeValue = product.Name,
                    SetType           = "Reward Name"
                };
                var date = DateTime.Now;
                reward.StartDate             = DateHelper.GetDate("Current");
                reward.ExpiryDate            = DateHelper.GetDate("Future");
                stepName                     = "Create new reward for product as " + reward.Name + "";
                testStep                     = TestStepHelper.StartTestStep(testStep);
                reward.ValueToSetInAttribute = "ValueGivenForAttributeSetReward";
                contentType                  = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Reward;
                reward.AttributeName         = attName + contentType.ToString();
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Rewards);
                testStep.SetOutput(RewardCatalog_RewardsPage.CreateReward_With_Product(reward));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Search and Clone Reward
                stepName = "Search and Clone Reward";
                testStep = TestStepHelper.StartTestStep(testStep);
                testStep.SetOutput(RewardCatalog_RewardsPage.CloneAndVerifyReward(reward.SetType, reward.Name, reward.CategoryTypeValue));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Logout
                stepName = "Logout from USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                Assert.Fail();
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA1243_ST1354_SOAP_IsMemberRewardRedeemed_PassInvalidRewardId_Negative()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";

            try
            {
                Logger.Info("Test Method Started");
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);


                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get Recent Reward Catalog with GetRewardCatalog 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("The RewardID from the response of GetRewardCatalog method is : " + reward.RewardID);
                Logger.Info("RewardID:" + reward.RewardID);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                IList <VirtualCard> vc = output.GetLoyaltyCards();
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Add Reward to Member using AddMemberRewards service";
                AddMemberRewardsOut memberRewardsOut = (AddMemberRewardsOut)cdis_Service_Method.AddMemberRewards(vc[0].LoyaltyIdNumber, vc[0].LoyaltyIdNumber, reward);
                testStep.SetOutput("The membersRewardID is: " + memberRewardsOut.MemberRewardID);
                Logger.Info("RewardID:" + memberRewardsOut.MemberRewardID);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Verify whether the member reward is redeemed or not by passing Invalid RewardID";
                string error = (string)cdis_Service_Method.IsMemberRewardRedeemedIDNegative();
                testStep.SetOutput("Throws an expection with the " + error);
                string[] errors      = error.Split(';');
                string[] errorssplit = errors[0].Split('=');
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating the response for Error Code as 3347";
                Assert.AreEqual("3347", errorssplit[1], "Expected value is" + "3347" + "Actual value is" + errorssplit[1]);
                testStep.SetOutput("The ErrorMessage from Service is: " + errors[1]);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
        public void BTA230_CDIS_GetRewardCatalogItem_PositiveCase()

        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Dictionary <string, string> productListVerify = new Dictionary <string, string>();

            try
            {
                Common common = new Common(this.DriverContext);
                CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
                IList <JToken>       JsonData            = ProjectBasePage.GetJSONData("CommonSqlStatements");
                string sqlstmt = (string)JsonData.FirstOrDefault()["Get_Reward_With_PartNumber"];

                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get a valid certificateNumber from LW_MemberCoupon table";
                string validRewardIDWithPartNumber = DatabaseUtility.GetFromSoapDB(string.Empty, string.Empty, string.Empty, "ID", sqlstmt);



                //Logger.Info("Test Method Started");
                //testStep = TestStepHelper.StartTestStep(testStep);
                //stepName = "Get Reward using GetRewardCatalog CDIS service";
                //RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRewardCatalog();
                //testStep.SetOutput("The RewardID is : " + rewardCatalog[0].RewardID + " and the reward name is :" + rewardCatalog[0].RewardName);
                //Logger.Info("RewardID:" + rewardCatalog[0].RewardID);
                //testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                //listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Get Reward Catalog Item for the above reward with CDIS service";
                // RewardCatalogSummaryStruct[] rewardCatalog = cdis_Service_Method.GetRewardCatalog();
                RewardCatalogItemStruct rewardCatalogItem = cdis_Service_Method.GetRewardCatalogItem(long.Parse(validRewardIDWithPartNumber));
                testStep.SetOutput("The Product details for the above reward from response are ; ProductName: " + rewardCatalogItem.Product.ProductName +
                                   "; Product ID: " + rewardCatalogItem.Product.ProductID);
                //"; ProductVariantID: " + rewardCatalogItem.Product.ProductVariant[0].ProductVariantID +
                //"; ProductVariant_Description: " + rewardCatalogItem.Product.ProductVariant[0].Description +
                //"; ProductVariant_PartNumber: " + rewardCatalogItem.Product.ProductVariant[0].PartNumber +
                //"; ProductVariant_Quantity: " + rewardCatalogItem.Product.ProductVariant[0].Quantity +
                //"; ProductVariant_VariantOrder: " + rewardCatalogItem.Product.ProductVariant[0].VariantOrder);

                Logger.Info("ProductName: " + rewardCatalogItem.Product.ProductName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validating reward details from DB";
                //            productListVerify = DatabaseUtility.GetRewardCatalogitemfromDBUsingIdSOAP(rewardCatalogItem.Product.ProductID + "");
                string id   = DatabaseUtility.GetFromSoapDB("lw_product", "ID", rewardCatalogItem.Product.ProductID.ToString(), "ID", string.Empty);
                string name = DatabaseUtility.GetFromSoapDB("lw_product", "NAME", rewardCatalogItem.Product.ProductName.ToString(), "NAME", string.Empty);
                //               Assert.AreEqual(rewardCatalogItem.Product.ProductVariant[0].Description, productListVerify["ProductvariantDescription"], "Expected Value is " + rewardCatalogItem.Product.ProductVariant[0].Description + " Actual Value is " + productListVerify["ProductvariantDescription"]);
                Assert.AreEqual(rewardCatalogItem.Product.ProductName, name, "Expected Value is " + rewardCatalogItem.Product.ProductName + " Actual Value is " + name);
                Assert.AreEqual(rewardCatalogItem.Product.ProductID.ToString(), id, "Expected Value is " + rewardCatalogItem.Product.ProductID + " Actual Value is " + id);
                //Assert.AreEqual(rewardCatalogItem.Product.ProductVariant[0].ProductVariantID.ToString(), productListVerify["ProductvariantID"], "Expected Value is " + rewardCatalogItem.Product.ProductVariant[0].ProductVariantID + " Actual Value is " + productListVerify["ProductvariantID"]);
                //Assert.AreEqual(rewardCatalogItem.Product.ProductVariant[0].PartNumber, productListVerify["ProductvariantPartNumber"], "Expected Value is " + rewardCatalogItem.Product.ProductVariant[0].PartNumber + " Actual Value is " + productListVerify["ProductvariantPartNumber"]);
                //Assert.AreEqual(rewardCatalogItem.Product.ProductVariant[0].Quantity.ToString(), productListVerify["ProductvariantQuantity"], "Expected Value is " + rewardCatalogItem.Product.ProductVariant[0].Quantity + " Actual Value is " + productListVerify["ProductvariantQuantity"]);
                //Assert.AreEqual(rewardCatalogItem.Product.ProductVariant[0].VariantOrder.ToString(), productListVerify["ProductvariantOrder"], "Expected Value is " + rewardCatalogItem.Product.ProductVariant[0].VariantOrder + " Actual Value is " + productListVerify["ProductvariantOrder"]);

                testStep.SetOutput("The Product details from DB are ; ProductName: " + name +
                                   "; Product ID: " + id);
                //"; ProductVariantID: " + productListVerify["ProductvariantID"] +
                //"; ProductVariant_Description: " + productListVerify["ProductvariantDescription"] +
                //"; ProductVariant_PartNumber: " + productListVerify["ProductvariantPartNumber"] +
                //"; ProductVariant_Quantity: " + productListVerify["ProductvariantQuantity"] +
                //"; ProductVariant_VariantOrder: " + productListVerify["ProductvariantOrder"]);

                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                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.ToString());
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #20
0
        public void BTA1230_ST1513_SOAP_AwardLoyaltyCurrency_BlankCurrencyAmount()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
            List <string>        CategoryID          = new List <string>();
            List <string>        DBCategoryID        = new List <string>();

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                decimal? amount          = null;
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Award LoyaltyCurrency to a member using AwardLoyaltyCurrency method with blank currency amount";
                AwardLoyaltyCurrencyOut awardLoyaltyCurrency = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "CDISService");
                testStep.SetOutput("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString());
                Logger.Info("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the LoyaltyCurrency balance with the currency balance returned by GetAccountSummary method";
                var getAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                Assert.AreEqual(getAccountSummary.CurrencyBalance, awardLoyaltyCurrency.CurrencyBalance, "Expected value is" + getAccountSummary.CurrencyBalance + "Actual value is" + awardLoyaltyCurrency.CurrencyBalance);
                testStep.SetOutput("The LoyaltyCurrencyBalance from GetAccountSummary method is: " + getAccountSummary.CurrencyBalance + "" +
                                   " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance);
                Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance from GetAccountSummary method is: " + getAccountSummary.CurrencyBalance +
                            " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Validate the LoyaltyCurrency balance with DB";
                string dbresponse = DatabaseUtility.GetLoyaltyCurrencyBalancesfromDBUsingIdSOAP(vc[0].VcKey + "");
                Assert.AreEqual(dbresponse, awardLoyaltyCurrency.CurrencyBalance.ToString(), "Expected value is" + dbresponse + "Actual value is" + awardLoyaltyCurrency.CurrencyBalance.ToString());
                testStep.SetOutput("The LoyaltyCurrencyBalance from DB is: " + dbresponse + "" +
                                   " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance);
                Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance from DB is: " + dbresponse +
                            " and the LoyaltyCurrencyBalance from AwardLoyaltyCurrency method is: " + awardLoyaltyCurrency.CurrencyBalance);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                Logger.Info("###Test Execution Ends### Test Passed: " + testCase.GetTestCaseName());
                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #21
0
        public void BTA_128_LN_Program_RewardCatalog_SearchWithPredicatesInExchangeRates()
        {
            #region Object Initialization
            CategoryFields  coupon    = new CategoryFields();
            Migration       Migration = new Migration(driverContext);
            ProjectBasePage basePages = new ProjectBasePage(driverContext);
            var             application_Nav_Util_Page      = new Application_Nav_Util_Page(DriverContext);
            var             navigator_Users_ProgramPage    = new Navigator_Users_ProgramPage(DriverContext);
            var             Program_RewardCatalogPage      = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var             RewardCatalog_ExchangeRatePage = new Navigator_Users_Program_RewardCatalog_ExchangeRatesPage(DriverContext);
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string         stepName = "";
            CategoryFields rate     = new CategoryFields();

            #endregion

            try
            {
                #region Step1: Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage);
                testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2: Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput);
                testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3: Verify that "!=" predicate works for Exchange Rates search functionalily
                stepName = "Verify that selected predicate works for Exchange Rates search functionalily";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ExchangeRates);
                RewardCatalog_ExchangeRatePage.SearchExchangeRateBasedOnNotEqualToPredicateValue(CategoryFields.ExchangeRatePropertyType.ToCurrency.ToString(), CategoryFields.Predicates.Ne.ToString(), rate.ExchangeRateValue, out String status);
                testStep.SetOutput(status);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6: Logout
                stepName = "Logout from USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + 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);
            }
        }
Beispiel #22
0
        public void BTA79_Navigator_CreateAdminUser_And_Login_With_AdminUser()
        {
            List <TestStep> listOfTestSteps = new List <TestStep>();
            MethodBase      method          = MethodBase.GetCurrentMethod();
            string          methodName      = method.Name;

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

            try
            {
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "");
                #region Object initialization
                var    navigator_LoginPage       = new Navigator_LoginPage(DriverContext);
                var    application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext);
                var    adminPage     = new Navigator_Admin_UsersPage(driverContext);
                string adminUserName = adminPage.GetUserName(NavigatorUsers.AdminUser, Users.AdminRole.LWADM.ToString());
                string adminPassword = adminPage.GetUserName(NavigatorUsers.AdminUser_Password, Users.AdminRole.LWADM.ToString());
                #endregion

                #region Step1:Open Navigator URL
                stepName = "Open 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 to Navigator using bpadmin
                stepName       = "Login to Navigator using bpadmin";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.bpAdminUser;
                login.Password = NavigatorUsers.bpAdminUser_Password;
                navigator_LoginPage.Login(login, Users.AdminRole.LWADM.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Create LWadmin user and assign role
                stepName = "Create LWadmin user and assign role";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.users);
                var user = adminPage.UserDetails(adminUserName, password);
                testStep.SetOutput(adminPage.Create_AdminUsers(user, Users.AdminRole.LWADM.ToString()));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Logout from bpadmin
                stepName = "Logout from bpadmin";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Login to Navigator using BTAADMIN
                stepName       = "Login to Navigator using BTAADMIN";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = adminUserName;
                login.Password = adminPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.LWADM.ToString(), out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Logout from BTAADMIN
                stepName = "Logout from BTAADMIN";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Passed");
            }
            catch (Exception e)
            {
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Failed");
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                if (!OrderTest_Status.Contains("true"))
                {
                    Assert.Fail();
                    testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                }
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #23
0
        public void BTA_228_LN_CreateNewJobInSchedulePage()
        {
            #region Object Initialization
            CategoryFields   coupon    = new CategoryFields();
            ProjectBasePage  basePages = new ProjectBasePage(driverContext);
            NonAdminUserData data      = new NonAdminUserData(driverContext);
            var            application_Nav_Util_Page      = new Application_Nav_Util_Page(DriverContext);
            var            navigator_Users_ProgramPage    = new Navigator_Users_ProgramPage(DriverContext);
            var            Program_RewardCatalogPage      = new Navigator_Users_Program_RewardCatalogPage(DriverContext);
            var            RewardCatalog_ExchangeRatePage = new Navigator_Users_Program_RewardCatalog_ExchangeRatesPage(DriverContext);
            CategoryFields rate = new CategoryFields();
            CategoryFields job  = new CategoryFields();
            job.Name = data.JobName;
            job.FrequencyDropDown = CategoryFields.FrequencyType.Hourly.ToString();
            job.Hour = job.RunEveryHour;
            var date = DateTime.Now;
            job.StartDate   = DateHelper.GetDate("Current");
            job.ExpiryDate  = DateHelper.GetDate("Future");
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName = "";
            #endregion

            try
            {
                #region Step1: Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage);
                testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2: Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput);
                testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: Create New Job and verify the Job is created successfully
                stepName = "Create New Job and verify the Job is created successfully";
                testStep = TestStepHelper.StartTestStep(testStep);
                application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program);
                navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog);
                Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ExchangeRates);
                RewardCatalog_ExchangeRatePage.NavigateToExchangeRatesTab(Navigator_Users_Program_RewardCatalog_ExchangeRatesPage.ExchangeTabs.Schedule);
                RewardCatalog_ExchangeRatePage.CreateJobAndVerifyCreatedJobInSchedulePage(job);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10: Logout
                stepName = "Logout from USER page";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + 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);
            }
        }
Beispiel #24
0
        public void BTA123_CSPCreateDifferentAgent()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

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

            #region Object Declaration
            var CSP_HomePage = new CSPortal_HomePage(DriverContext);
            var CSPortal_UserAdministration          = new CSPortal_UserAdministration(DriverContext);
            var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext);
            AgentRegistration agent = new AgentRegistration();
            #endregion

            try
            {
                #region Step1:Launch CSPortal Portal
                stepName = "Launch Customer Service Portal URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var CSP_LoginPage = new CSPortal_LoginPage(this.DriverContext);
                CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As csadmin
                stepName       = "Login As csadmin User";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = CsPortalData.csadmin;
                login.Password = CsPortalData.csadmin_password;
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Navigate to User Administration
                testStep   = TestStepHelper.StartTestStep(testStep);
                stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Create AdminAgent if it does not exists
                testStep       = TestStepHelper.StartTestStep(testStep);
                stepName       = "Create AdminAgent if it does not exists";
                stepstatus     = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents);
                agent.FistName = "AdminFirstName";
                agent.LastName = "AdminLastName";
                agent.Role     = RoleValue.Admin.ToString();
                agent.UserName = AgentValues.AdminAgent;
                agent.Password = AgentValues.Agentpassword;
                agent.Status   = AgentRegistration.AgentStatus.Active.ToString();
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Verify Login As Admin Agent Verify Dashboard Links and Logout
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Login As AdminAgent Verify Dashboard Links and Logout";
                CSP_HomePage.LogoutCSPortal();
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName));
                CSP_HomePage.LogoutCSPortal();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Create SrAdminAgent if it does not exists
                testStep       = TestStepHelper.StartTestStep(testStep);
                agent.FistName = "SrFirstName";
                agent.LastName = "SrLastName";
                agent.Role     = RoleValue.SrAdmin.ToString();
                agent.UserName = AgentValues.SrAdminAgent;
                agent.Password = AgentValues.Agentpassword;
                agent.Status   = AgentRegistration.AgentStatus.Active.ToString();
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName);
                stepName   = "Create SrAdminAgent if it does not exists";
                stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents);
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Verify Login As Sr.Admin Agent Verify Dashboard Links and Logout
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Login As SrAdmin Verify Dashboard Links and Logout";
                CSP_HomePage.LogoutCSPortal();
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName));
                CSP_HomePage.LogoutCSPortal();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Create JrAdminAgent if it does not exists
                testStep       = TestStepHelper.StartTestStep(testStep);
                agent.FistName = "JrFirstName";
                agent.LastName = "JrLastName";
                agent.Role     = RoleValue.JrAdmin.ToString();
                agent.UserName = AgentValues.JrAdminAgent;
                agent.Password = AgentValues.Agentpassword;
                agent.Status   = AgentRegistration.AgentStatus.Active.ToString();
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out stepName);
                stepName   = "Create JrAdminAgent if it does not exists";
                stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents);
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status));
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9:Verify Login As Jr Admin Agent Verify Dashboard Links and Logout
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Login As JrAdminAgent Verify Dashboard Links and Logout";
                CSP_HomePage.LogoutCSPortal();
                CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output);
                testStep.SetOutput(CSPortal_UserAdministrationAgentPage.VerifyDashboard_Links(agent.UserName));
                CSP_HomePage.LogoutCSPortal();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }

            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                Assert.Fail();
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #25
0
        public void BTA237_CDIS_GetAccountActivitySummary_Positive()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);

            try
            {
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + " , Name: " + output.FirstName);
                Logger.Info("IpCode: " + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Post transacation to a Member using UpdateMember method";
                DateTime date        = DateTime.Now.AddDays(-5);
                string   txnHeaderId = cdis_Service_Method.UpdateMember_AddTransactionRequiredDate(output, date);
                testStep.SetOutput("The txnHeaderID of the transaction is  " + txnHeaderId);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "GetAccountActivitySummary of the above member and verify transaction details";
                GetAccountActivitySummaryOut AccountActivitySummaryOut = cdis_Service_Method.GetAccountActivitySummary(vc[0].LoyaltyIdNumber);
                Assert.AreEqual(txnHeaderId, AccountActivitySummaryOut.AccountActivitySummary[0].TxnHeaderId, "Expected value is" + txnHeaderId + "Actual value is" + AccountActivitySummaryOut.AccountActivitySummary[0].TxnHeaderId);
                testStep.SetOutput("The following are details from the response, " +
                                   ";The txnAmount is: " + AccountActivitySummaryOut.AccountActivitySummary[0].TxnAmount +
                                   ";and txnHeader is: " + AccountActivitySummaryOut.AccountActivitySummary[0].TxnHeaderId);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "validating txnAmount from the DB";
                string dbresponse = DatabaseUtility.GetTxnAmountusingVCKeyDBSoap(txnHeaderId);
                Assert.AreEqual(AccountActivitySummaryOut.AccountActivitySummary[0].TxnAmount + "", dbresponse, "Expected value is" + AccountActivitySummaryOut.AccountActivitySummary[0].TxnAmount + "Actual value is" + dbresponse);
                testStep.SetOutput("The txnAmount from the db is: " + dbresponse + " and the txnAmount from service is: " + AccountActivitySummaryOut.AccountActivitySummary[0].TxnAmount);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                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);
            }
        }
        public void BTA573_Navigator_GenerateAssembly()
        {
            ProjectBasePage basePages  = new ProjectBasePage(driverContext);
            MethodBase      method     = MethodBase.GetCurrentMethod();
            string          methodName = method.Name;

            testCase        = new TestCase(methodName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName  = "";
            string stroutput = "";

            try
            {
                #region Pre-Conditions
                Application_Nav_Util_Page  Model = new Application_Nav_Util_Page(DriverContext);
                Navigator_GenerateAssembly nav_GenerateAssembly = new Navigator_GenerateAssembly(DriverContext);
                string assemblyDev    = basePages.ConfigDownloadPath + @"\" + ProjectBasePage.Orgnization_value + ".zip";
                string assemblyXsd    = basePages.ConfigDownloadPath + @"\XSD.zip";
                string assemblyJava   = basePages.ConfigDownloadPath + @"\LWIntgr-Java.zip";
                string assemblyDotnet = basePages.ConfigDownloadPath + @"\LWIntgr-DotNet.zip";
                basePages.DeleteExistedFile(assemblyDev);
                basePages.DeleteExistedFile(assemblyXsd);
                basePages.DeleteExistedFile(assemblyJava);
                basePages.DeleteExistedFile(assemblyDotnet);
                #endregion

                #region Step1:Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As User Admin User
                stepName       = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment";
                testStep       = TestStepHelper.StartTestStep(testStep);
                login.UserName = NavigatorUsers.NonAdminUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out stroutput); testStep.SetOutput(stroutput);
                var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext);
                navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Generate Assembly
                stepName = "Generate Assembly in Navigator";
                testStep = TestStepHelper.StartTestStep(testStep);
                Model.OpenApplication(NavigatorEnums.ApplicationName.model);
                nav_GenerateAssembly.GenerateAssembly(out stroutput);
                testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Generate dot net client Assembly
                stepName = "Generate dot net client Assembly in Navigator";
                testStep = TestStepHelper.StartTestStep(testStep);
                Model.OpenApplication(NavigatorEnums.ApplicationName.model);
                nav_GenerateAssembly.GenerateDotNetClientAssembly(out stroutput);
                testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Generate java client Assembly
                stepName = "Generate java client Assembly in Navigator";
                testStep = TestStepHelper.StartTestStep(testStep);
                Model.OpenApplication(NavigatorEnums.ApplicationName.model);
                nav_GenerateAssembly.GenerateJavaClientAssembly(out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Generate XSD client Assembly
                stepName = "Generate XSD client Assembly in Navigator";
                testStep = TestStepHelper.StartTestStep(testStep);
                Model.OpenApplication(NavigatorEnums.ApplicationName.model);
                nav_GenerateAssembly.GenerateXSDClientAssembly(out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7:Verify Assembly downloaded
                stepName = "Verify Dev Assembly downloaded";
                testStep = TestStepHelper.StartTestStep(testStep);
                Thread.Sleep(3000);//This is exclusive to wait for the download time
                basePages.VerifyExistedorDownloadedFile(assemblyDev, "BTADEV File downloaded Successfully to config path:" + basePages.ConfigDownloadPath, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8:Verify DotNet Assembly downloaded
                stepName = "Verify DotNet Assembly downloaded";
                testStep = TestStepHelper.StartTestStep(testStep);
                basePages.VerifyExistedorDownloadedFile(assemblyDotnet, "DotNet File downloaded Successfully to config path:" + basePages.ConfigDownloadPath, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9:Verify Java Assembly downloaded
                stepName = "Verify Java Assembly downloaded";
                testStep = TestStepHelper.StartTestStep(testStep);
                basePages.VerifyExistedorDownloadedFile(assemblyJava, "Java File downloaded Successfully to config path:" + basePages.ConfigDownloadPath, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step10:Verify XSD Assembly downloaded
                stepName = "Verify XSD Assembly downloaded";
                testStep = TestStepHelper.StartTestStep(testStep);
                Thread.Sleep(10000);
                basePages.VerifyExistedorDownloadedFile(assemblyXsd, "XSD File downloaded Successfully to config path:" + basePages.ConfigDownloadPath, out stroutput); testStep.SetOutput(stroutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step11: LogOut
                stepName = "Logout as USER Admin With All roles";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Passed");
            }

            catch (Exception e)
            {
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Failed");
                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());
                if (!OrderTest_Status.Contains("true"))
                {
                    Assert.Fail(); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                }
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #27
0
        public void BTA555_REST_GetMemberRewardsByFMS_POSITIVE()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            REST_Service_Methods rest_Service_Method = new REST_Service_Methods(common);

            try
            {
                Logger.Info("Test Method Started");
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member through rest service";
                JObject member = (JObject)rest_Service_Method.PostMembergeneral();
                var     k      = member.Value <string>("isError");
                Logger.Info(k.GetType());
                Logger.Info(member.Value <string>("isError"));
                if (member.Value <string>("isError") == "False")
                {
                    testStep.SetOutput("IPCODE= " + member["data"].Value <int>("id") + "; Name= " + member["data"].Value <string>("firstName"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using First Name";
                    JObject firstNameResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.FirstName, member["data"].Value <string>("firstName") + "");
                    testStep.SetOutput("The member with IPCODE = " + firstNameResponse["data"][0].Value <int>("memberId") +
                                       " and; first name: " + member["data"].Value <string>("firstName") +
                                       " has the reward with; rewardID = " + firstNameResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using email";
                    JObject emailResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.EmailAddress, member["data"].Value <string>("email") + "");
                    testStep.SetOutput("The member with IPCODE = " + emailResponse["data"][0].Value <int>("memberId") +
                                       " and; email: " + member["data"].Value <string>("email") +
                                       " has the reward with; rewardID = " + emailResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    string CardID = member["data"]["cards"][0].Value <string>("cardNumber");
                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Fetching member rewards through rest service using CARD ID";
                    JObject cardIDResponse = (JObject)rest_Service_Method.GetMemberRewardsByFMS(MemberSearchIdentity.CardID, CardID);
                    testStep.SetOutput("The member with IPCODE = " + cardIDResponse["data"][0].Value <int>("memberId") +
                                       " and; CardID: " + CardID +
                                       " has the reward with; rewardID = " + cardIDResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);

                    testStep = TestStepHelper.StartTestStep(testStep);
                    stepName = "Validate the rewardid got from response in db";
                    string dbresponse = DatabaseUtility.GetRewardIDfromDBUsingIPCODEREST(firstNameResponse["data"][0].Value <int>("memberId") + "");
                    Assert.AreEqual(firstNameResponse["data"][0].Value <int>("rewardId") + "", dbresponse, "Expected value is " + firstNameResponse["data"][0].Value <int>("rewardId") + " and actual value is " + dbresponse);
                    testStep.SetOutput("RewardID returned from db is " + dbresponse + " which matches with the rewardID from the response: " + firstNameResponse["data"][0].Value <int>("rewardId"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    Logger.Info("test passed");

                    testCase.SetStatus(true);
                }
                else
                {
                    Logger.Info("test  failed");
                    testStep.SetOutput(member.Value <string>("developerMessage"));
                    testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                    listOfTestSteps.Add(testStep);
                    throw new Exception(member.Value <string>("developerMessage"));
                }
            }
            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);
            }
        }
        public void BTA81_Navigator_GenerateKeys()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

            testStep = new TestStep();
            MethodBase method     = MethodBase.GetCurrentMethod();
            string     methodName = method.Name;

            testCase = new TestCase(methodName);

            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            string stepName   = "";
            string stepOutput = "";

            try
            {
                #region :OrderExection Requirement
                string Prereq_testCase = "BTA79_Navigator_CreateKEYAdminUser_And_Login_With_KEYAdminUser";
                ProjectBasePage.VerifyOrderTest(OrderTest_Status, Prereq_testCase, methodName, testStep);
                #endregion

                #region Step1:Verify Key Files Existed ,If Existed Delete Existed Files
                stepName = "Delete Existed Keystore.dat Files  and SymmetricKeystore.dat from :" + basePages.ConfigDownloadPath;
                testStep = TestStepHelper.StartTestStep(testStep);

                string keyStorefile      = basePages.ConfigDownloadPath + @"\Keystore.dat";
                string symmetricKeystore = basePages.ConfigDownloadPath + @"\SymmetricKeystore.dat";
                basePages.DeleteExistedFile(keyStorefile);
                basePages.DeleteExistedFile(symmetricKeystore);
                stepOutput = "Existed Keystore.dat Files  and SymmetricKeystore.dat from :" + basePages.ConfigDownloadPath + " Deleted Successfully"; testStep.SetOutput(stepOutput);
                testStep   = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);

                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Login As Key Admin User
                stepName = "Login As Key Admin User and Navigate to Keys Page";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_KeyUser_HomePage = new Navigator_KeysHomePage(DriverContext);
                var navigator_MangeKeysPage    = new Navigator_ManageKeysPage(DriverContext);
                login.UserName = NavigatorUsers.KEYUser;
                login.Password = NavigatorUsers.KEYUser_Password;
                navigator_LoginPage.Login(login, Users.AdminRole.KEY.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                navigator_KeyUser_HomePage.NavigatetoMangeKeys_Page(out stepName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:Select Organization and Environment
                stepName = "Select Organization and Environment";
                testStep = TestStepHelper.StartTestStep(testStep);
                var    navigator_DBDevHomePage = new Navigator_DBFramework_Page(DriverContext);
                string Org_Output; string Env_Output;
                navigator_DBDevHomePage.DrillDownOrg(out Org_Output);
                navigator_DBDevHomePage.SelectEnvironment(out Env_Output); testStep.SetOutput(Org_Output + ";" + Env_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5:Generate Keys file Symmetric Key file with valid Password details and Export
                stepName = "Generate Keys file  Symmetric Key file with valid Password details and Export";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_MangeKeysPage.EnterKeyStorePassword("Password1*", "512", out stepOutput); string Output1 = stepOutput;
                navigator_MangeKeysPage.ExportPrivateKey(keyStorefile, out stepOutput); string             Output2 = stepOutput;
                navigator_MangeKeysPage.ExportSymmetrickey(symmetricKeystore, out stepOutput); string      Output3 = stepOutput; testStep.SetOutput(";" + Output1 + ".;" + Output2 + ".;" + Output3);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step6:Create Config Folder for Organization if not existed
                stepName = "Create Config Folder for Organization if not existed";
                testStep = TestStepHelper.StartTestStep(testStep);
                basePages.CreateOrVerfiyConfigFolder();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step7: Copy Keystore file
                stepName = "Copy Keystore file to Config folder";
                testStep = TestStepHelper.StartTestStep(testStep);
                basePages.CopyFile(keyStorefile, basePages.ConfigUploadPath + @"\Keystore.dat");
                basePages.VerifyExistedorDownloadedFile(basePages.ConfigUploadPath + @"\Keystore.dat", "Keystore.dat File uploaded Successfully to config path:" + basePages.ConfigUploadPath, out stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step8: Copy SymmetricKeystore file
                stepName = "Copy SymmetricKeystore file to Config folder";
                testStep = TestStepHelper.StartTestStep(testStep);
                basePages.CopyFile(symmetricKeystore, basePages.ConfigUploadPath + @"\SymmetricKeystore.dat");
                basePages.VerifyExistedorDownloadedFile(basePages.ConfigUploadPath + @"\SymmetricKeystore.dat", "SymmetricKeystore.dat File uploaded Successfully to config path:" + basePages.ConfigUploadPath, out stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step9: LogOut
                stepName = "Logout as USER Admin With All roles";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Passed");
            }
            catch (Exception e)
            {
                ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Failed");
                testStep.SetOutput(stepName + e);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                testCase.SetErrorMessage(e.Message);
                if (!OrderTest_Status.Contains("true"))
                {
                    Assert.Fail(); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString());
                }
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }
Beispiel #29
0
        public void BTA_7_LN_ChangeKeys()
        {
            ProjectBasePage basePages = new ProjectBasePage(driverContext);

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

            try
            {
                #region Step1:Launch Navigator Portal
                stepName = "Launch Navigator URL";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_LoginPage = new Navigator_LoginPage(DriverContext);
                navigator_LoginPage.LaunchNavigatorPortal(login.Url, out stepOutput); testStep.SetOutput(stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step2:Login As Key Admin User
                stepName = "Login As Key Admin User and Navigate to Keys Page";
                testStep = TestStepHelper.StartTestStep(testStep);
                var navigator_KeyUser_HomePage = new Navigator_KeysHomePage(DriverContext);
                var navigator_MangeKeysPage    = new Navigator_ManageKeysPage(DriverContext);
                login.UserName = NavigatorUsers.KEYUser;
                login.Password = NavigatorUsers.NavigatorPassword;
                navigator_LoginPage.Login(login, Users.AdminRole.KEY.ToString(), out string stroutput); testStep.SetOutput(stroutput);
                navigator_KeyUser_HomePage.NavigatetoMangeKeys_Page(out stepName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step3:Select Organization and Environment
                stepName = "Select Organization and Environment";
                testStep = TestStepHelper.StartTestStep(testStep);
                var    navigator_DBDevHomePage = new Navigator_DBFramework_Page(DriverContext);
                string Org_Output; string Env_Output;
                navigator_DBDevHomePage.DrillDownTestOrg(out Org_Output);
                navigator_DBDevHomePage.SelectTestEnvironment(out Env_Output); testStep.SetOutput(Org_Output + ";" + Env_Output);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step4:ChangeKey
                stepName = "ChangeKey";
                testStep = TestStepHelper.StartTestStep(testStep);
                var output = navigator_MangeKeysPage.ChangeKey("Password1*", "512", out stepOutput);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, output, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                #region Step5: LogOut
                stepName = "Logout as KEYADMIN";
                testStep = TestStepHelper.StartTestStep(testStep);
                navigator_LoginPage.Logout();
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB"));
                listOfTestSteps.Add(testStep);
                #endregion

                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep.SetOutput(stepName + 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);
            }
        }
Beispiel #30
0
        //TODO: Need the exact reward name from DB
        public void BTA1245_ST1781_SOAP_ReturnMemberRewardOrder_OrderNumberExistsPartNumberDoesNotExists()
        {
            testCase        = new TestCase(TestContext.TestName);
            listOfTestSteps = new List <TestStep>();
            testStep        = new TestStep();
            String stepName = "";
            Common common   = new Common(this.DriverContext);
            CDIS_Service_Methods cdis_Service_Method = new CDIS_Service_Methods(common);
            List <string>        CategoryID          = new List <string>();
            List <string>        DBCategoryID        = new List <string>();
            string errorCode       = "3355";
            string expectedMessage = "Order number not found.";

            try
            {
                Logger.Info("Test Method Started: " + testCase.GetTestCaseName());
                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Adding member with CDIS service";
                Member output = cdis_Service_Method.GetCDISMemberGeneral();
                testStep.SetOutput("IpCode: " + output.IpCode + ", Name: " + output.FirstName);;
                Logger.Info("TestStep: " + stepName + " ##Passed## IpCode:" + output.IpCode + ", Name: " + output.FirstName);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                IList <VirtualCard> vc = output.GetLoyaltyCards();

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Award LoyaltyCurrency to a member using AwardLoyaltyCurrency method";
                decimal? amount          = 100;
                DateTime expirationdate  = new DateTime(DateTime.Now.Year, 12, 31);
                DateTime?transactiondate = DateTime.Now;
                AwardLoyaltyCurrencyOut awardLoyaltyCurrency     = cdis_Service_Method.AwardLoyaltyCurrency(vc[0].LoyaltyIdNumber, LoyaltyEvents.PurchaseActivity, LoyaltyCurrency.BasePoints, amount, transactiondate, expirationdate, "Awarding new amounts", "SOAPService");
                GetAccountSummaryOut    getInitialAccountSummary = cdis_Service_Method.GetAccountSummary(vc[0].LoyaltyIdNumber);
                decimal initialBalance = getInitialAccountSummary.CurrencyBalance;
                testStep.SetOutput("The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString());
                Logger.Info("TestStep: " + stepName + " ##Passed## The LoyaltyCurrencyBalance awarded to the member is: " + awardLoyaltyCurrency.CurrencyBalance.ToString());
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Add Members rewards  with CDIS service";
                RewardCatalogSummaryStruct reward = new RewardCatalogSummaryStruct();
                reward.RewardName = DatabaseUtility.GetFromSoapDB("LW_REWARDSDEF", "name", "ZeroBalanceReward", "name", string.Empty);
                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);
                Logger.Info("member RewardID:" + memberRewardsOut.MemberRewardID);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);

                testStep = TestStepHelper.StartTestStep(testStep);
                stepName = "Return member rewards based on the Order number where order number exists and part number does not exists";
                string orderNumber = memberRewardsOut.OrderNumber;
                string message     = cdis_Service_Method.ReturnMemberRewardOrder(orderNumber, out elapsedTime);
                Assert.AreEqual(message.Contains(errorCode), true, "Error code received is different and is : " + errorCode + " for the member with order number: " + orderNumber);
                Assert.AreEqual(message.Contains(expectedMessage), true, "Error message received is different and is  : " + expectedMessage + " for the member with order number: " + orderNumber);
                testStep.SetOutput("Returned error code: " + errorCode + " and Error message : " + expectedMessage);
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                Logger.Info("###Test Execution Ends### Test Passed: " + testCase.GetTestCaseName());
                testCase.SetStatus(true);
            }
            catch (Exception e)
            {
                testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("API"));
                listOfTestSteps.Add(testStep);
                testCase.SetStatus(false);
                Logger.Info("Test Failed: " + testCase.GetTestCaseName() + "Reason: " + e.Message);
                testCase.SetErrorMessage(e.Message);
                Assert.Fail(e.Message);
            }
            finally
            {
                testCase.SetTestCaseSteps(listOfTestSteps);
                testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow());
                listOfTestCases.Add(testCase);
            }
        }