protected virtual void ApplyLateralAuraModifiers(EngineSetup configuration, List <EngineAura> auras) { var lateralAcceleration = ApplyModifiers(configuration.lateralAcceleration, auras.Select(a => a.lateralAcceleration)); var lateralMaximumVelocity = ApplyModifiers(configuration.lateralMaximumVelocity, auras.Select(a => a.lateralMaximumVelocity)); configuration.SetLateralMovement(lateralAcceleration, lateralMaximumVelocity); }
protected virtual void ApplyAngularAuraModifiers(EngineSetup configuration, List <EngineAura> auras) { var angularAcceleration = ApplyModifiers(configuration.angularAcceleration, auras.Select(a => a.angularAcceleration)); var angularMaximumVelocity = ApplyModifiers(configuration.angularMaximumVelocity, auras.Select(a => a.angularMaximumVelocity)); configuration.SetAngularMovement(angularAcceleration, angularMaximumVelocity); }
internal static EngineSetup ConfigureLogging(this EngineSetup setup, FfdbConfig config) { if (!string.IsNullOrWhiteSpace(config.Logging?.Directory)) { var rollingInterval = config.Logging.RollingInterval.HasValue ? config.Logging.RollingInterval.Value : RollingInterval.Day; setup.Logging .SetLogDirectory(config.Logging.Directory) .SetRollingInterval(rollingInterval); if (config.Logging.UseDebugLogLevel) { setup.Logging.UseDebugLogLevel(); } if (config.Logging.MaxBytes.HasValue) { setup.Logging.SetMaxBytes(config.Logging.MaxBytes.Value); } if (config.Logging.RollOnFileSizeLimit) { setup.Logging.RollOnFileSizeLimit(); } } return(setup); }
protected virtual void ApplyRigidbody2DAuraModifiers(EngineSetup configuration, List <EngineAura> auras) { var mass = ApplyModifiers(configuration.mass, auras.Select(a => a.mass)); var drag = ApplyModifiers(configuration.drag, auras.Select(a => a.drag)); var angularDrag = ApplyModifiers(configuration.angularDrag, auras.Select(a => a.angularDrag)); configuration.SetRigidbody2DValues(mass, drag, angularDrag); }
protected virtual void ApplyLongitudinalAuraModifiers(EngineSetup configuration, List <EngineAura> auras) { var forwardAcceleration = ApplyModifiers(configuration.forwardAcceleration, auras.Select(a => a.forwardAcceleration)); var backwardAcceleration = ApplyModifiers(configuration.backwardAcceleration, auras.Select(a => a.backwardAcceleration)); var forwardMaximumVelocity = ApplyModifiers(configuration.forwardMaximumVelocity, auras.Select(a => a.maximumVelocity)); var backwardMaximumVelocity = ApplyModifiers(configuration.backwardMaximumVelocity, auras.Select(a => a.maximumVelocity)); configuration.SetLongitudinalMovement(forwardAcceleration, forwardMaximumVelocity, backwardAcceleration, backwardMaximumVelocity); }
static void Main() { var setup = new EngineSetup(); setup.HInstance = Process.GetCurrentProcess().Handle; setup.Name = "Engine Control Test"; setup.StateSetup = StateSetup; new Engine.Engine(setup); Engine.Engine.GEngine.Run(); }
protected virtual void ApplyAuras(EngineSetup configuration) { var auras = _auras.Cast <EngineAura>().ToList(); ApplyLongitudinalAuraModifiers(configuration, auras); ApplyLateralAuraModifiers(configuration, auras); ApplyAngularAuraModifiers(configuration, auras); ApplyRigidbody2DAuraModifiers(configuration, auras); _engine.ApplyConfigurationToEngine(configuration); }
private static FfdbEngine GetConfiguredMongoEngine() { var setup = new EngineSetup(); setup.UseMongo(new MongoConfig { ConnectionString = "mongodb://localhost:27017/FFDB_Test_2?replicaSet=rs_local", DatabaseName = "FFDB_Test_3" }); return(GetConfiguredEngine(setup)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var setup = new EngineSetup() { HInstance = Process.GetCurrentProcess().Handle, Name = "Framework Test" }; new Engine.Engine(setup); Engine.Engine.GEngine.Run(); }
internal static EngineSetup ConfigureDbProvider(this EngineSetup setup, FfdbConfig config) { if (config.PostgreSql != null) { setup.UsePostgreSql(config.PostgreSql); } else if (config.Mongo != null) { setup.UseMongo(config.Mongo); } return(setup); }
private static FfdbEngine GetConfiguredPostgresEngine() { var setup = new EngineSetup(); setup.UsePostgreSql(new PostgresConfig { DatabaseName = "ffdb_test_5", Host = "localhost", Username = "******", Password = "******" }); return(GetConfiguredEngine(setup)); }
public void Logout() { try { Actions action = new Actions(driver); action.MoveToElement(driver.FindElement(headerMenuUserRole)).Perform(); driver.WaitForPageLoad(TimeSpan.FromSeconds(5)); driver.ClickElementUsingWebElement(logout, "Logout"); this.TESTREPORT.LogInfo("Logout is Success"); } catch (Exception ex) { this.TESTREPORT.LogFailure("Logout is not success", EngineSetup.GetScreenShotPath()); } }
internal static EngineSetup ConfigureWebClient(this EngineSetup setup, FfdbConfig config) { if (config.WebRequest.RandomizedThrottle != null) { setup.WebRequest.SetRandomizedThrottle( config.WebRequest.RandomizedThrottle.Min, config.WebRequest.RandomizedThrottle.Max); } else { setup.WebRequest.SetThrottle(config.WebRequest.ThrottleMilliseconds); } return(setup); }
private static FfdbEngine FOR_DOCS() { var setup = new EngineSetup(); setup .SetRootDataDirectoryPath(@"C:\path\to\data\dir\") .UseMongo(new MongoConfig { ConnectionString = "connection_string", DatabaseName = "db_name" }); FfdbEngine engine = setup.Create(); return(GetConfiguredEngine(setup)); }
static void Main(string[] args) { Mutex mutex = new Mutex(true, "DeviceExtractionService", out Boolean createdNew); if (createdNew) { LanguageManager.SwitchAll(LanguageType.Cn); PluginAdapter.Instance.Initialization(null); EngineSetup setup = new EngineSetup("isolatedTask", null); TaskEngine engine = new TaskEngine(setup); engine.Start(); Console.WriteLine("Task engin is running...:{0}", engine.IsRuning); Console.Read(); mutex.ReleaseMutex(); } }
internal static EngineSetup ConfigureFromRunInfo(this EngineSetup setup, RunInfoBase runInfo) { if (runInfo.SkipRosterFetch) { setup.SkipRosterFetch(); } if (runInfo.SaveToDisk) { setup.SaveToDisk(); } if (runInfo.SaveOriginalSourceFiles) { setup.SaveOriginalSourceFiles(); } return(setup); }
internal static FfdbEngine Resolve(FfdbConfig config, RunInfoBase runInfo, DataRepoState dataRepoState) { var setup = new EngineSetup() .SetRootDataDirectoryPath(config.RootDataPath) .ConfigureWebClient(config) .ConfigureLogging(config) .ConfigureDbProvider(config) .ConfigureFromRunInfo(runInfo); bool fetchFromDataRepo = dataRepoState?.Enabled ?? false; if (fetchFromDataRepo) { setup.EnableFetchingFromDataRepo(); } return(setup.Create()); }
public bool AccountingListPage() { bool isValid = false; try { driver.FindElement(setUpObject).Click(); driver.WaitElementPresent(setupManager); driver.ClickElementUsingWebElement(accountingObject, accountingConst); driver.ClickElementUsingWebElement(accountingListObject, accountingListTitle); driver.WaitForPageLoad(TimeSpan.FromSeconds(50)); driver.SwitchTo().Frame(1); isValid = driver.CheckElementExists(exportCSVButton, exportCSVConst); } catch (Exception ex) { this.TESTREPORT.LogFailure("Error in Accounting List Page: ", EngineSetup.GetScreenShotPath()); } return(isValid); }
private static FfdbEngine GetConfiguredEngine(EngineSetup setup) { setup .SetRootDataDirectoryPath(@"D:\Repos\ffdb_data_5\"); //.SetRootDataDirectoryPath(@"D:\Repos\FFDB.Data\"); setup.WebRequest .SetThrottle(3000) .AddDefaultBrowserHeaders(); setup.Logging .SetLogDirectory(@"D:\Repos\ffdb_logs\") .SetRollingInterval(RollingInterval.Day) .UseDebugLogLevel(); setup .SkipRosterFetch() .SaveToDisk() .SaveOriginalSourceFiles() .EnableFetchingFromDataRepo(); return(setup.Create()); }
/// <summary> /// Method to validate user transaction and refund /// </summary> /// <param name="transactionType"></param> public void validateUserTransactionAndRefund(string transactionType = "", string amount = "") { try { string transactionId = getTransactionId(); if (transactionId != "") { if (transactionType != "") { VerifyUserTransaction("", "", "", transactionId, "", "", "", "", "", "", "", "", "", transactionType); } else if (amount != "") { VerifyUserTransaction("", "", amount, transactionId); } else { VerifyUserTransaction("", "", "", transactionId); } RefundTransaction("", transactionId, ""); } else { this.TESTREPORT.LogFailure("validateUserTransactionAndRefund", "Error occurred while validating transaction! Transaction id not found", EngineSetup.GetScreenShotPath()); } } catch (Exception ex) { this.TESTREPORT.LogFailure("validateUserTransactionAndRefund", "Error occurred while validating user transaction & refund", EngineSetup.GetScreenShotPath()); } }
/// <summary> /// Method to validate Thank You Page /// </summary> public void validateThankYouPage(string amount = "") { try { driver.WaitForElement(lblThankYou, TimeSpan.FromSeconds(60)); //driver.CheckElementExists(lblThankYou, "THANK YOU!"); driver.CheckElementExists(btnPrintReceipt, "PRINT RECEIPT"); if (amount != "") { driver.VerifyTextValue(lblDonationAmount, amount, "Donation Amount"); } //driver.CheckElementExists(lblHTMLReceipt, "HTML Receipt"); driver.WaitForPageLoad(TimeSpan.FromSeconds(60)); } catch (Exception ex) { this.TESTREPORT.LogFailure("validateThankYouPage", "Error occurred while validating Thank You page", EngineSetup.GetScreenShotPath()); } }
/// <summary> /// Method to validate Refund Transaction API /// </summary> public void validateRefundTransaction(string transactionDate, string transactionId = "", string constituentId = "") { try { RefundTransaction(transactionDate, transactionId, constituentId); } catch (Exception ex) { this.TESTREPORT.LogFailure("validateRefundTransaction", "Error occurred while validating RefundTransaction using LO API", EngineSetup.GetScreenShotPath()); } }
/// <summary> /// Method to validate User Transaction API /// </summary> public void validateUserTransaction(string transactionDate, string constituentId = "", string amount = "", string transactionId = "", string creditCardNumber = "", string creditCardType = "", string billingFirstName = "", string billinglastName = "", string street1Address = "", string city = "", string state = "", string country = "", string postalCode = "", string transactionType = "") { try { VerifyUserTransaction(transactionDate, constituentId, amount, transactionId, creditCardNumber, creditCardType, billingFirstName, billinglastName, street1Address, city, state, country, postalCode, transactionType); } catch (Exception ex) { this.TESTREPORT.LogFailure("validateUserTransaction", "Error occurred while validating User Transaction using LO API", EngineSetup.GetScreenShotPath()); } }
/// <summary> /// Method to click clear form and start over /// </summary> public void ClickClearformandstartoverbutton() { try { driver.ScrollToPageBottom(); driver.ClickElement(btnClearFormAndStartOver, "Clearformandstartoverbutton"); driver.WaitForPageLoad(TimeSpan.FromSeconds(60)); } catch (Exception ex) { this.TESTREPORT.LogFailure("ClickClearformandstartoverbutton", "Failed to Clearformandstartover", EngineSetup.GetScreenShotPath()); } }
public void AdditionalAuthentication() { try { string question = driver.FindElement(additionalAuthenticationQuestion).Text; if (question.Contains(additionalAuthenticationFirstQuestion)) { driver.FindElement(additionalAuthenticationAnswer).SendKeys(additionalAuthenticationFirstQuestionAnswerValue); driver.FindElement(additionalAuthenticationSubmit).Click(); driver.WaitForPageLoad(TimeSpan.FromSeconds(60)); driver.CheckElementExists(homepageverification, feedbackElementInHomePage); this.TESTREPORT.LogSuccess("Additional Authentication ", "Navigation of Additional Authentication is success"); } else if (question.Contains(additionalAuthenticationSecondQuestion)) { driver.FindElement(additionalAuthenticationAnswer).SendKeys(additionalAuthenticationSecondQuestionAnswerValue); driver.FindElement(additionalAuthenticationSubmit).Click(); driver.WaitForPageLoad(TimeSpan.FromSeconds(60)); driver.CheckElementExists(homepageverification, feedbackElementInHomePage); this.TESTREPORT.LogSuccess("Additional Authentication ", "Navigation of Additional Authentication is success"); } else if (question.Contains(additionalAuthenticationThirdQuestion)) { driver.FindElement(additionalAuthenticationAnswer).SendKeys(additionalAuthenticationThirdQuestionAnswerValue); driver.FindElement(additionalAuthenticationSubmit).Click(); driver.WaitForPageLoad(TimeSpan.FromSeconds(60)); driver.CheckElementExists(homepageverification, feedbackElementInHomePage); this.TESTREPORT.LogSuccess("Additional Authentication ", "Navigation of Additional Authentication is success"); } }catch (Exception ex) { this.TESTREPORT.LogFailure("Additional Authentication Page", "You have entered an invalid security answer. Please try again." + EngineSetup.GetScreenShotPath()); } }
/// <summary> /// Validate donation review page controls /// </summary> public void validateDonationReviewPageControls() { try { driver.CheckElementExists(lblDonationDuration, "Donation Duration"); driver.CheckElementExists(lblDonationAmount, "Donation Amount"); driver.VerifyTextValue(lblDonationAmount, "$100", "Donation Amount"); driver.CheckElementExists(lblDonorBenifitting, "Donation Benifitting"); driver.VerifyTextValue(lblDonorBenifitting, "Make-A-Wish® America", "Benefitting"); driver.CheckElementExists(btnReviewEdit, "REVIEW/EDIT button"); driver.ScrollPage(); driver.CheckElementExists(txtFirstName, "First Name"); driver.CheckElementExists(txtLastName, "Last Name"); driver.CheckElementExists(chkDonateOnBehalfOfCommpany, "Donate on behalf of company"); driver.ClickElement(chkDonateOnBehalfOfCommpany, "Donate on behalf of company"); driver.CheckElementExists(txtCompanyName, "Company Name"); driver.CheckElementExists(txtEmailAddress, "Email Address"); driver.CheckElementExists(txtStreetAddress1, "Street Address 1"); driver.CheckElementExists(txtStreetAddress2, "Street Address 2"); driver.CheckElementExists(txtPostalCode, "Postal Code"); driver.ScrollPage(); driver.CheckElementExists(rbtnCreditCard, "Credit Card"); driver.CheckElementExists(rbtnPayPal, "Paypal"); driver.CheckElementExists(txtCreditCardNumber, "Credit Card Number"); driver.ScrollPage(); driver.CheckElementExists(imgVisa, "Visa"); driver.CheckElementExists(imgMasterCard, "Master Card"); driver.CheckElementExists(imgAmericanExpress, "American Express"); driver.CheckElementExists(imgDiscover, "Discover"); driver.CheckElementExists(listExpirationMonth, "Expiration Month"); driver.CheckElementExists(listExpirationYear, "Expiration Year"); driver.CheckElementExists(txtCvv, "CVV"); driver.CheckElementExists(btnSubmitDonation, "Submit Donation"); driver.CheckElementExists(btnClearFormAndStartOver, "Clear form and start over"); } catch (Exception ex) { this.TESTREPORT.LogFailure("ValidateDonationReviewPageControls", "Failed to validate controls on Donation review page", EngineSetup.GetScreenShotPath()); } }
public void RoleSelection(string roleName) { try { //this.TESTREPORT.LogInfo("Selecting the Corresponding ROLE : ", roleName.ToString()); driver.FindElement(headerMenuUserRole).Click(); driver.WaitElementExistsAndVisible(mawController); driver.FindElement(mawController).Click(); driver.WaitForPageLoad(TimeSpan.FromSeconds(20)); } catch (Exception ex) { this.TESTREPORT.LogFailure("Role Selection Failed : ", "Failed to navigate to Role :", EngineSetup.GetScreenShotPath()); } }
public void NavigateToLoginPage(String url) { try { driver.Navigate().GoToUrl(url); this.TESTREPORT.LogSuccess("NavigateToLogin", String.Format("Navigated to url: <mark>{0}</mark> successfully", url)); driver.CheckElementExists(loginIn, "Log In"); } catch (Exception ex) { this.TESTREPORT.LogFailure("NavigateToLogin", "Failed to navigate to url:" + url, EngineSetup.GetScreenShotPath()); } }
/// <summary> /// if an error has occurred, try to complete the current function so the test can continue /// </summary> /// <typeparam name="T"></typeparam> /// <param name="func"></param> /// <param name="defaultTimeout"></param> /// <param name="logMsg"></param> /// <returns></returns> internal static T CompleteAction <T>(Func <T> func, int defaultTimeout, IWebDriver _driver, string logMsg = null, string stepName = "") { bool errorHasOccurred = false; var begin = DateTime.UtcNow; while (true) { try { if (errorHasOccurred && activeContext != null) { activeDriver.SwitchTo().DefaultContent(); if (activeContext is string) { //activeDriver.SwitchTo().Frame((dynamic)activeContext); activeDriver.SwitchTo().Frame((string)activeContext); } else if (activeContext is int) { activeDriver.SwitchTo().Frame((int)activeContext); } else if (activeContext is By) { activeDriver.SwitchTo().Frame(activeDriver.FindElement((By)activeContext)); } } var returnObj = func.Invoke(); if (!String.IsNullOrEmpty(logMsg)) { if (stepName != "") { testReport.LogSuccess(stepName, logMsg); } else { testReport.LogSuccess("UI Action", logMsg); } } return(returnObj); } catch (Exception ex) { errorHasOccurred = true; if ((DateTime.UtcNow - begin).TotalSeconds >= defaultTimeout) { //we should check kdashboard_EditProfileButtonind of exception it is ...currently, I am doing temp fix if (ex.StackTrace.Contains("UnpackAndThrowOnError") || ex.Message.Contains("Timed out waiting for page to load.") || ex.Message.Contains("The HTTP request") || ex.Message.Contains("timed out after 60 seconds") || ex.Message.Contains("Element is obscured")) { testReport.LogWarning("UI Action", String.Format("From IgnoredException: Exception Type - {0}, Error: {1} StackTrace: {2}", ex.GetType(), ex.Message, ex.StackTrace), EngineSetup.GetScreenShotPath()); Thread.Sleep(5000); errorHasOccurred = false; throw; } else { testReport.LogException(ex, EngineSetup.GetScreenShotPath()); throw; } } //maybe do an else if here for situations in which the time didnt take longer than the timeout, but a longer time than expected System.Threading.Thread.Sleep(100); } } }
/// <summary> /// Method to verify Paypal error page /// </summary> public void verifyPayPalErrorScreen() { try { driver.CheckElementExists(imgLogo, "Make A Wish image Logo"); driver.VerifyTextValue(lblPayPalError, "PayPal Error", "Paypal Error"); driver.CheckElementExists(lnkTryAgain, "Please Try Again"); } catch (Exception ex) { this.TESTREPORT.LogFailure("verifyPayPalScreen", "Failed to verify the PayPal screen", EngineSetup.GetScreenShotPath()); } }