Locked Javascript menu fails to load - but only when Coded UI tests interact with it

  • Wednesday, August 15, 2012 12:01 PM
     
     
    As part of a set of Coded UI tests, a menu is clicked. However, the menu (which uses Javascript) fails to load the menu options. 
    The menus work fine when I run the test manually. If I refresh the page while the tests are running (or re-launch the browser), the menu options then load.  

    But what is weirder is this only occurs on a remote test environment. When I run the tests locally on my own machine, the menus work even when the Coded UI tests are executing the tests. 

    It makes absolutely no sense to me why the menus would fail to load. Could the Coded UI tests be stopping the Javascript from executing (to load the menu options)? But why does it work when I refresh the page? 

    Comparing my own environment and the test environment - there are no differences that I can see. I'm testing against the exact same web application (the URL points to the same web server). It's the same version of Internet Explorer, and all the settings are the same, that I can see. Same operating system too (Windows 7). 

    Any ideas what I could try? 

    One thing to note is that the tests worked fine under IE7 document mode - although the Javascript behaviour could be different here perhaps. Currently, I have the tests running against the web application on IE9 document mode. 

All Replies

  • Thursday, August 16, 2012 9:22 AM
     
     Proposed
    I managed to find a solution, but unfortunately it is merely an inconvenient workaround. 

    If I change the document mode to Quirks mode the menus work fine during the automated test runs. 
  • Friday, August 17, 2012 2:40 AM
    Moderator
     
     

    Hi xbox360ciaran,

    Thank you for posting in the MSDN forum.

    If I change the document mode to Quirks mode the menus work fine during the automated test runs.

    It seems that you have resolved this issue, am I right? If so, I will mark your reply as the answer.

    If not, would you mind letting us know more information about this issue? Did you get any error message when you run your test? If you using the VS2010, did you install the VS2010 SP1? Since Internet Explorer 9 is only supported if you have installed Visual Studio 2010 Service Pack 1.

    Have a nice weekend,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, August 20, 2012 11:16 AM
     
     

    Unfortunately, this solution only worked for one test. 

    I ran into a multitude of other problems with other tests. In some tests, the web controls behave and look differently under other document modes so for many tests it isn't just a matter of changing the document mode. 

    I'm still constantly running into the issue whereby our menus (which use javascript to drop-down a list of links) aren't functioning when run on a remote machine and when the tests are being executed by the test agent. 

    I didn't get any error message. With the menus all that is happening is that when the drop-down menu is clicked, a 'Menu options loading' message appears. This normally disappears within a split second to be replaced by the menu options - but when the test agent is carrying out the tests the menu options never load. When I stop the tests on the environment and try it manually, the menu options DO load, so this is only happening when the tests are being automated. 

    Yes, I have VS2010 SP1 and FP2 installed. 

    I've run into various other problems too. For example, when running tests on the remote environment, for some web controls I get an error message thrown back saying that "The playback failed to find the control with the given search properties" - even though the test worked on my local environment. 

    But it is always the InnerText value it doesn't seem to like:

    "Failed to find any control that matched UK-Create Framework Agreement for the search property InnerText. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component."

    I checked the InnerText value of these controls on the remote environment and found that they were exactly the same as the values on my local environment, so it's a mystery to me why it doesn't work. Sometimes, if I just comment out the InnerText search property from the designer.cs file the tests work (assuming it has enough other search properties to find the web control). 


  • Monday, August 20, 2012 11:25 AM
     
     
    I'm recording the tests on my local environment (on IE9 compatibility mode with IE9 Document Mode), and I am playing back the tests on IE9 browser mode on IE9 standards document mode. 

    Would Visual Studio 2012 solve any of these issues? Am I right in saying that with VS2012, I can record the tests in IE9 browser mode (not IE9 compatibility mode). Do you think this is a source of at least some of these issues? 

    Also, I'll give details of the test environments. Perhaps the difference in the environments could also be a problem? 

    My local development environment is Windows 7 64-bit, 4GB RAM, Core 2 Duo 2.8ghz. 
    The remote environment I want to automate the tests on is Windows 7 32-bit, 1.5GB RAM, Intel Pentium 4 2.8ghz. 

    UPDATE: What I found was that if I switch to IE9 Compatibility Mode during test execution, the menus work fine, but then other things don't work - for example browser dialogs stop working. Why would they stop working on the remote environment? If I record in IE9 compatibility mode and playback in IE9 compatibility mode then *surely* the tests should be played back exactly as I have recorded them. Why would browse dialogs fail to be found? It makes no sense.

  • Wednesday, August 22, 2012 3:44 AM
    Moderator
     
     Answered

    Hi xbox360ciaran,

    Sorry for my delay.

    I've run into various other problems too. For example, when running tests on the remote environment, for some web controls I get an error message thrown back saying that "The playback failed to find the control with the given search properties" - even though the test worked on my local environment.

    Since it worked well locally, I doubt that it is related to the different Environment, sometimes some controls get different property in different computer, and one idea is that changing some of the properties for the controls (which couldn’t be found when you run your tests).

    Of course, if you have the VS2012 RC Environment, you could try to check it, since it seems that the VS2012 has some updated features for IE9.

    Reference:

    http://msdn.microsoft.com/en-us/library/bb385901(v=vs.110).aspx

    http://msdn.microsoft.com/en-us/library/dd380742.aspx

    Best Regards,

    Update:

    I'm recording the tests on my local environment (on IE9 compatibility mode with IE9 Document Mode), and I am playing back the tests on IE9 browser mode on IE9 standards document mode.

    I'm afraid that it is not supported.

    Reference:

    http://blogs.msdn.com/b/vstsqualitytools/archive/2011/03/09/coded-ui-support-for-ie9-with-sp1.aspx


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us