Is there any automation tool available to automate yfiles for HTML based graph?
Or is there a way to use selenium for automating it?
You can use Selenium for this task. What's important to consider is that yFiles uses state machines internally for the processing of the events and therefor the events should be simulated like they would happen in the real world.
This means that instead of just dispatching click events, you would need to simulate the correct series of events that lead to a click: mousemove, mousedown, mouseup, click and for a drag there should be one or more mousemoves, mousedown, one or more mousemoves, and a mouseup.
Sadly Selenium does not do this automatically for you, but writing a couple of helper functions that will perform a proper click or drag is a one-time setup. You can then use dispatchEvent to dispatch synthetic events to the main component and write high-level tests that will perform a series of user interactions.
Related
I want to call a JavaScript function in a hosted WebBrowser. My JavaScript function is slow (in UI not retrieving data or ajax) and I want to make my WPF interface responsive while the JavaScript function is being executed.
You can call your JavaScript function asynchronously (e.g., upon a timer), but asynchrony doesn't assume multithreading, the function will still be executed entirely on the main UI thread. And you cannot use a separate thread for this, because the underlying WebBrowser ActiveX control is an STA COM object.
If you really have to perform a lengthy UI update work inside your JavaScript function, the right way of doing this would be to throttle the update logic and execute it in multiple steps, each step asynchronously, to keep the UI thread responsive. You can do this using setTimer or jQuery's delay. A more well-structured approach would be to use jQuery Deferreds, as explained here.
We solved our problem somehow with a trick, might be useful for others.
After a call to WebBrowser we start a new window in a new UI thread and put our new window on the previous window (which its thread is busy doing JavaScript calculation in WebBrowser) , so we are able to somehow show progress-bar and loading page while doing heavy drawing in our html .
I believe I read somewhere that the order of when UI events are triggered in WinRT is arbitrary. I also believe I read that it differs from Silverlight and/or WPF, and certainly WinForms. It differs in the manner that in WinForms you can know for sure that for instance the Click event of a Button fires after GotFocus and so forth (example may not be correct). In WinRT you can not. I have done some crude testing myself, and it seems to be correct. Sometimes event X fires first, sometimes Y.
Can anyone please confirm these assumptions for me, especially with regards to Silverlight and WPF where I am not very proficient? Preferably with links to official Microsoft articles.
I believe this is an important concept to grasp, since it will affect what you can and cannot do in the event handlers - especially with regards to synchronizing with databound properties.
WinRT is a complete redefinition of the opperational model. Don't let those words scare you though. What this means is that where ever there used to be synchronous actions, they've been turned into async actions.
What this means though, is that you are correct in assuming that one event may fire before another. With the prebuilt WinRT controls, there is not much that can be done to sync the async, but with custom code, you could implement a call and response pattern.
I blog about the Event Aggregator which allows events to be published and subscribed to from anywhere in the app:
http://developingzack.blogspot.com/2012/09/what-why-and-how-event-aggregator.html
By creating a set of events, where the original event subscriber, publishes a second event and the second events subscription publishes a third event ... to the Nth tier.
This would also be a de-coupled way to create the illusion (and operational order) of synchronous methodology.
Every Method that might take longer than 50ms to respond has been re-written as async.
Here is a fairly detailed explanation of Async from the MSDN blog: http://blogs.msdn.com/b/windowsappdev/archive/2012/06/14/exposing-net-tasks-as-winrt-asynchronous-operations.aspx
I'm trying to find a good resource to get started with UIAutomation. I need to simulate mouse input in a WPF application. Are there any good examples out there? I couldn't find any, and the MSDN documentation seems too extensive.
UI Automation is not really intended to simulate mouse clicks. It is meant to expose the user interface in a programmatically-accessible fashion.
It organizes controls in a hierarchy that can be easily traversed/navigated by screen readers or similar applications. And, it uses control patterns to allow users to interact with the controls.
A Button for example can expose the InvokePattern via it's automation peer. You can simulate a click using the Invoke method on that pattern. This is done independently of the mouse, so there would be no mouse over/enter/leave/down events, just a Click event.
You can use mouse class with UIAutomation. But as CodeNaked rightly said, we should use UIAutomation patterns for mouse like operations and it is not good practice to use mouse class.
You can refer this code project article to start with UIAutomation.
I hope this will help you.
I am using Dispatcher.PushFrame to block my code while allowing the UI to refresh until a long running process is done. This works as expected, so long as my call to Dispatcher.PushFrame is from a button click event. If, however, I use this same code during the Page’s Loaded event or constructor, the UI does not refresh, and so never paints. As a random experiment, I tried using Window.ShowDialog from the constructor, and it does allow the UI to paint, even though control is blocked until the modal dialog closes. Can anyone offer a solution to allow this functionality from the Page Loaded event using Dispatcher.PushFrame or some other manual mechanism?
As an addendum, if I minimize or maximize my window, the UI paints and I can interact with it normally, but not until I manually perform the resize.
From my readings in MSDN on Object Lifetime Events and stumping around in Reflector it appears that the Loaded and Unloaded events are not raised in the same manner as other events. Internally a BroadcastEventHelper class is used, which coordinates the various Loaded events amongst every element in the visual tree before eventually raising them at the DispatcherPriority.Loaded level.
I believe this is why you're seeing this behavior.
As for a concrete solution, I suggest long running tasks not be placed in the Page.Loaded event handler and instead a BackgroundWorker or Task be issued to complete the work.
the question is....
The application maybe in Silverligth.
It's possible to implement SYNChonous WebService call?
I try to realize any application RIA, with Grids, Edits and using WebServices in SL, but I do not understand how to make it's possible without a SYNC calls.
And I also need to use MODAL DIALOGS for some tasks.
I investigated the work of Daniel Vaughan who manages to run Web service calls synchronously, within a ThreadPool, but How I can do that GUI, wait for calls to webservices?
Daniel Vaughan Web: http://danielvaughan.orpius.com/post/Synchronous-Web-Service-Calls-with-Silverlight-2.aspx
Combining these basic things for other languages, IMHO is possible to build true application.
Hear suggestions...
Cheva.
Its best to analyse the actual objective which, since you want to do this in the GUI, is to prevent user activity until approriate resources have been fetched or processed.
One way to acheive that goal would be to have a synchronous call but the would just lock the UI up in a user unfriendly way. What we realy want is to lock the UI up but in an informative way. In fact we want the UI thread free to display such "Please wait I'm busy processing your request" preferable in a rich UI manner (some animation or progress going on).
To that you can use the BusyIndicator control (inside which you place all or just part of your current UI). You'll find the BusyIndicator in the Silverligt Toolkit. If you are using VS2010 and Silverlight 4 a Similar control is now part of the Ria Services SDK and can is called Activity.
Now when you want to do something "synchronous" you set the BusyIndicator.IsBusy property to true (in SL4 you set the Activity.IsActive to true). Then make a asynchronous request, on completion of the request you set the property to false.
For better or for worse, Silverlight doesn't support synchronous calls to web services. Your best bet is to go with something similar to what Anthony proposed in order to get the desired end result in your UI without actually locking up the UI thread.