Problem with Popupwatcher

Ranorex Studio, Spy, Recorder, and Driver.
Patrick Kunst
Posts: 9
Joined: Thu Jul 25, 2013 3:29 pm

Problem with Popupwatcher

Post by Patrick Kunst » Mon Jul 29, 2013 12:41 pm

Hi,
I am using the Popupwatcher to handle some expected Windows.
Because I need it more than one I create a separate class for this.

Code: Select all

public class UnexpectedWindowHandler
	{
		public UnexpectedWindowHandler()
		{
			PopupWatcher pw = new PopupWatcher();
			StandardtestRepository repo = StandardtestRepository.Instance;
			
			pw.Watch(repo.NichtFreigabefaehig, SpecialRelease);
			pw.Watch(repo.DubletteUebernehmen,AddDuplicate);
			pw.Start();
		}
		
	
		
		private static void SpecialRelease(Ranorex.Core.Repository.RepoItemInfo info,  Ranorex.Core.Element element)
		{
			Orders.SpecialRelease();
		}
		
		private static void AddDuplicate(Ranorex.Core.Repository.RepoItemInfo info,  Ranorex.Core.Element element)
		{
			Orders.RecentlyAddedArticle();
		}
Then I create a new object of the class before every test, so the popupwatcher is created for the test.

Code: Select all

 private void Init()
        {        
            // Your recording specific initialization code goes here.
            UnexpectedWindowHandler uwh = new UnexpectedWindowHandler();
        }
The problem is, that, if a unexpected dialog appears, only the first action is performed.
For example the method SpecialRelase has more than one action.

Code: Select all

	public static void SpecialRelease()
		{
                        repo.NichtFreigabefaehig.ButtonOK.Click("18;11");
			 repo.AuftragsabschlussDE.SonderfreigabeOhneReservierenF9.Click("231;7");
			 repo.AuftragsabschlussDE.Kundenabsprache.Click("227;10");

		}
The first Click is performed then the test seems to continue with rest of the test, but not the others clicks which are necessary to continue. I set a breakpoint in the method SpecialRelease and I saw that the method is called. Also the test comes to the second action. Even if I set a breakpoint the test does not stop at this point.

I hope you know what I mean and can help me.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Problem with Popupwatcher

Post by krstcs » Mon Jul 29, 2013 1:19 pm

The test does not stop because the pop-up watcher is running in a separate thread than the test.

That may also be why your other actions are not executed, but I'm not sure about that side.


If these pop-ups are expected, you should probably create test cases for them and run the test cases in your test suite, instead of using the pop-up watcher. The pop-up watcher should really only be used for a pop-up that is unexpected (like to dismiss an error dialog that only happens when the network is down, etc.).
Shortcuts usually aren't...

Patrick Kunst
Posts: 9
Joined: Thu Jul 25, 2013 3:29 pm

Re: Problem with Popupwatcher

Post by Patrick Kunst » Mon Jul 29, 2013 2:12 pm

Thank you. Then I misunderstood the use of Popupwatcher.