// // Summary: // Callback when Desktop is successfully connected and ready to accept commands. public void onReady() { Openfin.Desktop.ApplicationOptions appOptions = new Openfin.Desktop.ApplicationOptions(parentAppUuid_, parentAppUuid_, url_); Openfin.Desktop.WindowOptions windowOptions = appOptions.MainWindowOptions; windowOptions.AutoShow = true; windowOptions.DefaultWidth = 310; windowOptions.DefaultHeight = 287; AckCallback afterCreate = (createAck) => { htmlApp_.run((runAck) => { // Handle on UI thread to get the window bounds this.Dispatcher.BeginInvoke(new Action(() => { htmlApp_.getWindow().showAt((int)Left + (int)Width + 80, (int)Top, false); htmlApp_.getWindow().setAsForeground(); // Subscribe to handle when this app has been registered with the HTML app connection_.getInterApplicationBus().subscribe(parentAppUuid_, "csharp-registered", (sourceUuid, topic, message) => { // Handle on UI thread to check externalObserver_ is not defined this.Dispatcher.BeginInvoke(new Action(() => { if (externalObserver_ == null) { // Integrate this window externalObserver_ = new Openfin.Desktop.ExternalWindowObserver(host_, port_, parentAppUuid_, name_, new WindowInteropHelper(this).Handle); } })); }); // Ensure HTML is ready before registering. connection_.getInterApplicationBus().subscribe(parentAppUuid_, "html-wpf-ready", (rSourceUuid, rTopic, rMessage) => { // Be on UI thread to ensure externalObserver_ is not defined this.Dispatcher.BeginInvoke(new Action(() => { // Notify HTML to register and prepare for docking with this C# app if (externalObserver_ == null) { JObject payload = new JObject(); DesktopUtils.updateJSONValue(payload, "name", name_); connection_.getInterApplicationBus().send(parentAppUuid_, "reserve-csharp-name", payload); } })); }); connection_.getInterApplicationBus().send(parentAppUuid_, "wpf-html-ready", null); })); }); }; htmlApp_ = new Openfin.Desktop.Application(appOptions, connection_, afterCreate, afterCreate); }
/// <summary> /// Sends a message using the InterApplicationBus /// </summary> public void SendMessage(object sender, RoutedEventArgs e) { // Create JSON payload containing the user input text JObject messagePayload = new JObject(); DesktopUtils.updateJSONValue(messagePayload, "data", ResponseTextBox.Text); // Send to HTML application connection_.getInterApplicationBus().send(receiverUuid_, "show-message", messagePayload); }
public virtual void TearDown() { var status = TestContext.CurrentContext.Result.Outcome.Status; var stackTrace = TestContext.CurrentContext.Result.StackTrace; var errorMessage = TestContext.CurrentContext.Result.Message; if (status == TestStatus.Failed) { test.Log(Status.Fail, status + stackTrace + errorMessage); (Pages.GooglePage.Document as ITakesScreenshot).GetScreenshot().SaveAsFile(DesktopUtils.GetScreenshotFolderPath() + $"\\{TestContext.CurrentContext.Test.Name}.jpeg"); test.AddScreenCaptureFromPath(DesktopUtils.GetScreenshotFolderPath() + $"\\{TestContext.CurrentContext.Test.Name}.jpeg"); } }
public virtual void OneTimeSetUp() { extent = new ExtentReports(); var dir = DesktopUtils.GetDebugFolderPath().Replace("\\bin\\Debug", ""); var htmlReporter = new ExtentHtmlReporter(dir + "\\TestExecutionResults\\Test.html"); htmlReporter.Configuration().Theme = Theme.Dark; extent.AddSystemInfo("Environment", "Local computer"); extent.AddSystemInfo("Username", "Zewer"); extent.AttachReporter(htmlReporter); WebDriver.OpenBrowser("https://google.com"); }
/// <summary> /// Open expected browser and navigate by URL /// </summary> public static void OpenBrowser(string url) { if (driver != null) { Quit(); } // TO DO - extract expected browser type. BrowserType = GetBrowser(); if (BrowserType == BrowserTypes.Chrome) { ChromeOptions options = new ChromeOptions(); options.AddArgument("--disable-extensions"); driver = new ChromeDriver(DesktopUtils.GetDebugFolderPath(), options); } NavigateTo(url); //BringBrowserToFront("Google - Google Chrome"); BringBrowserToFront(); driver.Manage().Window.Maximize(); }
private void sendButton_Click(object sender, EventArgs e) { subscriptionCallback = () => { JObject msg = new JObject(); JObject msg2 = new JObject(); DesktopUtils.updateJSONValue(msg, "data", dataTextBox.Text); DesktopUtils.updateJSONValue(msg2, "topic", "incoming-data"); DesktopUtils.updateJSONValue(msg2, "message", dataTextBox.Text); interAppBus_.send("exceladapter", "update", msg2); interAppBus_.send(htmlDemoUuid_, topicTextBox.Text, msg); }; if (subscriptionMap.ContainsKey(topicTextBox.Text)) { subscriptionCallback(); } else { JObject msg = new JObject(); DesktopUtils.updateJSONValue(msg, "topic", topicTextBox.Text); interAppBus_.send("htmlinterappcommdemo", "new-topic", msg); } }
/// <summary> /// Bring browser window to front. /// </summary> /// <returns></returns> public static bool BringBrowserToFront() { return(DesktopUtils.BringApplicationToFront($"{driver.Title} - Google Chrome")); }