RadDropDownButton User.Click does not work

7 posts, 1 answers
  1. Evgeniy
    Evgeniy avatar
    8 posts
    Member since:
    Mar 2015

    Posted 26 Mar 2015 Link to this post

    Hello.

    I was writing UI-test for WPF application (using NUnit
    Framework and ArtOfTests), and in my test I need to click on
    RadDropDownButton:

                       <telerik:RadDropDownButton x:Name="btnDrop">
                            <telerik:RadDropDownButton.DropDownContent>
                                <telerik:RadContextMenu >
                                    <telerik:RadMenuItem Header="op1" Command="{StaticResource op1CommandReference}"/>
                                    <telerik:RadMenuItem Header="op2" Command="{StaticResource op2CommandReference}"/>
                                    <telerik:RadMenuItem Header="op3" Command="{StaticResource op3CommandReference}"/>
                                </telerik:RadContextMenu>
                            </telerik:RadDropDownButton.DropDownContent>
                        </telerik:RadDropDownButton>

    To click on this button, I use the following code:

    var button = win.Find.ByName<Telerik.WebAii.Controls.Xaml.RadDropDownButton>("btnDrop");
    button.User.Click(MouseClickType.LeftClick);

    The test works fine (no exception have been thrown), but RadContextMenu does not appear.
    When I click on this button using mouse, I can see this menu with 3 RadMenuItem items.

    How can I solve this problem?
  2. Peshito
    Admin
    Peshito avatar
    496 posts

    Posted 27 Mar 2015 Link to this post

    Hi Evgeniy,

    Thank you for your question and for the snippets shared.

    I tried to reproduce this behavior on my side but to no avail. Please make sure that you are using the latest version of Telerik Testing Framework and let me know if the issue still persists.

    I also noticed you have started another forum thread regarding the same topic and would suggest to keep the conversation in a single thread. This way it would be easier for both sides to follow.

    Regards,
    Peshito
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Evgeniy
    Evgeniy avatar
    8 posts
    Member since:
    Mar 2015

    Posted 27 Mar 2015 in reply to Peshito Link to this post

    Hello again.

    I think I figured out why this problem appears.
    This forum post helped me:
    http://www.telerik.com/forums/example-to-access-and-test-wpf-mvvm-applications-using-the-webaii-testing-framework

    Method button.User.Click() does not work when my C# project with NUnit tests is targetted on 'Any CPU' (Project properties -> Build -> Platform target). It works only when 'Platform target' is 'x86'. But I can't make this project x86 because it is the part of big solution, whose projects should be targetted on 'Any CPU'.

    How can I make this tests work inside 'Any CPU'-targetted project?
  5. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 01 Apr 2015 Link to this post

    Hello Evgeniy,

    Please before you try changing something in your big project please create a simple project with that particular test. Change the CPU to x86 and try executing the test.

    This is for proving that the solution is working for you.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  6. Evgeniy
    Evgeniy avatar
    8 posts
    Member since:
    Mar 2015

    Posted 01 Apr 2015 in reply to Boyan Boev Link to this post

    Hello.
    Thanks for your advice.
    I've already figured out that changing target platform can solve this issue (I made a simple project for that purpose).
    So right now I'm pretty sure that changing every project in my big solution will help me.
    But is there any chance to avoid doing this work and make my tests work on 'Any CPU'-targetted project?
  7. Evgeniy
    Evgeniy avatar
    8 posts
    Member since:
    Mar 2015

    Posted 09 Apr 2015 Link to this post

    Finally I just changed all project in my test solution to x86-target.

    There is that there are no exceptions thrown in case of 'Any CPU'-target projects. The Click() method just does not work.

     I think it would be useful to make a post somewhere on your site about writing tests using NUnit framework.

    I saw several posts decribing the same issue (about making tests with C#). To make your tests work you need to do:

    1) Projects with tests should be 'x86'-targetted.

    2) For a successful run of this tests use 'nunit-x86.exe' or 'nunit-console-x86.exe'. Tests will not run with 'nunit.exe' or 'nunit-console.exe'.

  8. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 14 Apr 2015 Link to this post

    Hello Evgeniy,

    Thank you for your feedback.

    1) We will update the online documentation with that note.

    2) We already have this in our nUnit article.

    Thank you again!

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top
UI for WPF is Visual Studio 2017 Ready