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); } }
public void BTA83_Navigator_GenerateFrameworkCfgFile() { #region Object declaration string configPath = BnPBaseFramework.Web.Helpers.FilesHelper.GetFolder(BaseConfiguration.DownloadFolder, Directory.GetCurrentDirectory()); ProjectBasePage basePages = new ProjectBasePage(driverContext); string FrameworkCfgFile = basePages.ConfigDownloadPath + @"\Framework.cfg"; basePages.DeleteExistedFile(FrameworkCfgFile); 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 = ""; #endregion try { #region OrderExection Requirement string Prereq_testCase = "BTA79_Navigator_CreateAdminUser_And_Login_With_AdminUser"; ProjectBasePage.VerifyOrderTest(OrderTest_Status, Prereq_testCase, methodName, testStep); #endregion #region Object initilization var loginPage = new Navigator_LoginPage(DriverContext); var manageOrganizationPage = new Navigator_Orgnizations_FrameworkConfigurationPage(DriverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(driverContext); var organizationPage = new Navigator_Admin_OrganizationsPage(driverContext); #endregion #region Step1: Open Navigator URL stepName = "Open Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); 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 ADMIN stepName = "Login to navigator using ADMIN"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.AdminUser; login.Password = NavigatorUsers.NavigatorPassword; 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: 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: Select Organization and Environment stepName = "Select Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); manageOrganizationPage.DrillDownOrg(out string Message); manageOrganizationPage.SelectEnvironment(out string Message1); testStep.SetOutput(Message + ";" + Message1); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Navigate to Framework Configuration tab stepName = "Select Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); 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 Step6: Update changes to the framework configuration page and file stepName = "Update changes to the framework configuration page and file"; testStep = TestStepHelper.StartTestStep(testStep); manageOrganizationPage.ExportFrameworkCfgFile(FrameworkCfgFile); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7: Copy framework configuration file to configuration path stepName = "Copy framework configuration file to configuration path"; testStep = TestStepHelper.StartTestStep(testStep); basePages.CreateOrVerfiyConfigFolder(); File.Copy(FrameworkCfgFile, basePages.ConfigUploadPath + @"\Framework.cfg", true); basePages.VerifyExistedorDownloadedFile(basePages.ConfigUploadPath + @"\Framework.cfg", "Framework.cfg File uploaded Successfully in 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:Logout from USER page stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); 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); } }