This is a migrated thread and some comments may be shown as answers.

RadDropDownButton User.Click does not work

5 Answers 217 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Evgeniy
Top achievements
Rank 1
Evgeniy asked on 26 Mar 2015, 01:11 PM
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?

5 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 27 Mar 2015, 07:37 AM
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.

 
0
Evgeniy
Top achievements
Rank 1
answered on 27 Mar 2015, 01:32 PM
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?
0
Accepted
Boyan Boev
Telerik team
answered on 01 Apr 2015, 08:18 AM
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
 
0
Evgeniy
Top achievements
Rank 1
answered on 09 Apr 2015, 07:58 AM

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'.

0
Boyan Boev
Telerik team
answered on 14 Apr 2015, 06:44 AM
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
 
Tags
Buttons
Asked by
Evgeniy
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Evgeniy
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or