Telerik Forums
Testing Framework Forum
7 answers
139 views

Hi All,

 I have seen about 5 or 6 threads on this issue with no real solution or explanation given. I am in Visual Studio 2013 with Telerik Testing Framework. I am using examples provided by your support staff. I have added ArtOfTest.WebAii and Telerik.TestingFramework.Controls.KendoUI references to my solution. Then I have added the following namespaces to my test file (most of which I know are not necessary):

using ArtOfTest.WebAii;
using ArtOfTest.WebAii.Controls;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.ObjectModel;
using NUnit.Framework;
using Telerik.TestingFramework.Controls.KendoUI;

 

namespace VNextTelerik
{
    [TestFixture]
    public class Class1
    {
        public Manager myManager;
 
        [SetUp]
        public void TestFixtureSetUp()
        {
 
            // Initialize the settings
            Settings mySettings = new Settings();
 
            // Set the default browser
            mySettings.Web.DefaultBrowser = BrowserType.FireFox;
 
            // Create the manager object
            myManager = new Manager(mySettings);
 
            // Start the manager
            myManager.Start();
 
            
 
        }
         
        [Test]
        public void Kendo()
        {
 
            myManager.LaunchNewBrowser();
 
            myManager.ActiveBrowser.NavigateTo("http://demos.kendoui.com/web/numerictextbox/events.html");
 
            System.Threading.Thread.Sleep(5000);
 
            myManager.ActiveBrowser.RefreshDomTree();
 
            KendoInput textBox = myManager.ActiveBrowser.Find.ByExpression<KendoInput>("class=k-widget k-numerictextbox");
 
            textBox.TypeText("50");
        }
 
        [TearDown]
        public void TearDown()
        {
            // Shut-down the manager and do all clean-up
            myManager.Dispose();
        }
 
    }

Every time it runs (KendoInput textBox = myManager.ActiveBrowser.Find.ByExpression<KendoInput>("class=k-widget k-numerictextbox");) this  returns null. I have tried many many things changing DomRefreshTree, waiting for element, longer thread.sleep (terrible solution). Ive tried to intialize the object as so(KendoInput textBox = new  KendoInput).What could be the issue?  Ive ran it at least 40 times and only one time did it actually find the object.  Ive attached the solution. In all the other threads with this problem your support staff runs peoples project and says it works. I am looking for a reason this may be happening and a possible solution.

 

thanks

Ivaylo
Telerik team
 answered on 02 Oct 2015
1 answer
98 views

Hey Chummers,

 I f***ing love this Framework!!

However, it seems that I am way to stupid to use it. :-D Hope you can help me out!

I am trying to click on a button, but always get a NotFoundException. So I wrote a small test containing the following code:

01.var app = myManager.ActiveApplication.MainWindow;
02. 
03.app.Find.Strategy = FindStrategy.AlwaysWaitForElementsVisible;
04.IList<FrameworkElement> buttonList = app.Find.AllByType("Button");
05. 
06.foreach (var element in buttonList)
07.{
08.    Debug.WriteLine(element.Name);
09.}

The output is

PART_SysMinimizeButton
PART_SysMaximizeButton
PART_SysRestoreButton
PART_SysCloseButton

 So it seems my code is only able to address the buttons in the Window-frame so far and I have no idea what do do...

 Any suggestions?

Greetings Stephan

Ivaylo
Telerik team
 answered on 02 Oct 2015
10 answers
181 views
Hi,

I wonder if there´s any way to effectively work with tablebody-elements. As there is no HtmlTableBody-class, you can just work with it in form of Element, which doesn´t support most important features.
Most of the time it´s possible to find a workaround, but not in each case.
I hope you can help me with this.

Kind regards
Silvio
Boyan Boev
Telerik team
 answered on 02 Oct 2015
6 answers
99 views
Hi there. I have a label in my SL control.  When I try to search for it by name I get an error that doesn't seem to make sense.

Running the following code:
Assert.That(MyControl.Find.ByName("valueTextBlock").As<TextBlock>().Text, Is.EqualTo("Football"));

I get: 
System.ArgumentException : The control type 'ArtOfTest.WebAii.Silverlight.UI.TextBlock' does not match the xaml tag 'label'


Is this right??

I manage to find the label by doing
Assert.That(MyControl.Find.AllByType<TextBlock>()[1].Text, Is.EqualTo("Football"));

So if the above search worked why would the first one fail? If someone could explain this to me that would be great.  I wonder if it's a bug or a coding error.

Thanks 
adhy
Top achievements
Rank 1
 answered on 02 Oct 2015
2 answers
107 views

Hello,

There are 2 grids, one is used to find personnel, the other one is used to find divisions in which the personnel works

The same testing pattern applies to both grids: open the grid, type info in one or several input boxes and select a result. The first grid works fine, however, when using the second grid, it sometimes selects the first result from the list right after opening the grid. And I mean SOMETIMES, because sometimes sets the text in the input box, presses enter and then selects the wanted results, and sometimes it just selects the first result RIGHT AFTER opening the grid.

I'd like to know what could be the reasons that are causing this.

Thanks in advance.

Ivaylo
Telerik team
 answered on 24 Sep 2015
9 answers
323 views
Hi,

I like the snapshot functionality in WebAii, and have a seperate test that all other tests call as their last step.
This test will wait for a feedback div, and then pass. If it fails, it will take a snapshot, so I can see why the original test failed.
That will work for most of my cases because it rarely fails before this last step, but when it does I do not get the snapshot.

So I was wondering if there was an OnError eventhandler or something that would be called when a test failed, or if there are any other ways to take a snapshot when the test fails.

Thank you
srihari
Top achievements
Rank 1
 answered on 21 Sep 2015
1 answer
134 views
Hello,

I'm having trouble with File Upload dialog. Sometimes file upload window just freezes for as long as I choose a file or close the window manually. As a browser I use IE11, IDE - Visual Studio 2013. The code below is used to provide functionality:

private readonly DialogMonitor _dialogMonitor;
public void HandleUploadDialog(string path, HtmlInputFile controll)
        {
            var dialog = new FileUploadDialog(Manager.Current.ActiveBrowser, path, DialogButton.OPEN);
 
            _dialogMonitor.Start();
            _dialogMonitor.AddDialog(dialog);
 
            controll.Click();
            dialog.WaitUntilHandled(10000);
        }


I attached a screenshot as an example of frozen window
Could you suggest me a solution? What could be a reason of such behavior? Is there any other way to handle this dialog?

Boyan Boev
Telerik team
 answered on 15 Sep 2015
1 answer
118 views

Hi Team,

 

I'm trying to automate silverlight application using Telerik testing framework . I've explored and created a sample scenario on silverlight application and executed perfectly on Internet Explorer but not in Firefox (version 40.0)

 While I'm executing the same script its navigating to application and throws  runtime error "Timeout trying to connect to silverlight application" here   "SilverlightApp app = ActiveBrowser.SilverlightApps()[0];"

I've done the workaround on the issue and found following solutions but unfortunately couldn't able solve my problem

  1. Cleared the Firefox browser cache

  2. added hardcoded sleeps, waits, refreshDOM and waituntilready

  3.added Settings.Current.Web.EnableSilverlight = true;  before launching the browser

 Below is my code

 [Test]
        public void SilverlightCRM()
        {
            Settings.Current.Web.EnableSilverlight = true;
            Manager.LaunchNewBrowser(BrowserType.FireFox);

         
            ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/crm/");
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.RefreshDomTree();
            System.Threading.Thread.Sleep(50000);

            SilverlightApp app = ActiveBrowser.SilverlightApps()[0];

            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.Window.Maximize();

            //app.Find.ByTextContent("companies").Wait.ForExists();

           // app.Find.ByTextContent("companies").User.Click();
            System.Threading.Thread.Sleep(5000);
            ActiveBrowser.RefreshDomTree();
            ActiveBrowser.WaitUntilReady();
            app.Find.ByExpression(new XamlFindExpression("XamlTag=contentcontrol","name=MainMenuRegionPlaceholder","|",
                "XamlPath=/contentpresenter[0]/mainmenuview[0]/grid[name=LayoutRoot]/stackpanel[0]/radradiobutton[1]")).User.Click(); //click on company

            ActiveBrowser.WaitUntilReady();
            System.Threading.Thread.Sleep(50000);
            app.Find.ByAutomationId("AddNew").Wait.ForExists();
            System.Threading.Thread.Sleep(5000);
            //app.Find.ByExpression(new XamlFindExpression("XamlTag = radbutton", "AutomationId = AddNew")).Wait.ForVisible();
           // app.Find.ByExpression(new XamlFindExpression("XamlTag = radbutton", "AutomationId = AddNew")).User.Click() ; //click on ADD

          // app.Find.ByAutomationId("AddNew").User.Click(); //Click on ADD
            
            System.Threading.Thread.Sleep(5000);

        
            // app.Find.ByName("PART_FieldsContentPresenter").User.Click();   //enter text in description field
            // app.Find.ByName("PART_FieldsContentPresenter").User.TypeText("telerik",10);

            //app.Find.ByExpression(new XamlFindExpression("XamlTag=contentpresenter", "name=PART_FieldsContentPresenter1", "|", "XamlTag=TextBoxView")).User.Click();  //click on field
            // app.Find.ByExpression(new XamlFindExpression("XamlTag=contentpresenter", "name=PART_FieldsContentPresenter1",
            //   "|", "XamlTag=TextBox")).User.TypeText("srkjasdn", 10); //enter text in field

            app.Find.ByName("ContentElement").User.Click();  //click on compnay field
            app.Find.ByName("ContentElement").User.TypeText("telerik", 10);    //enter text in company field 

 }

  Please let me know if there is any other way to resolve this issue or am I need to add anything else , Thanks in advance

 

Regards,

Deepak.

Ivaylo
Telerik team
 answered on 09 Sep 2015
1 answer
166 views
I've been using the built in facility in Visual studio 2010 for creating unit tests in Silverlight. 
(Microsoft.Silverlight.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll)

I now want to use Telerik Testing Framework for scipted UK testing

I've installed TTF

Various libraries are installed in C:\Program Files\Telerik\Test Studio\Bin\  but only 
artoftest.SL.Extension and 
Telerik.WebAii.Controls.Xaml.CustomTypes
can be added to my project, as they seem to be the only ones compiled in the Silverlight Library

So how to get started?

I can't follow your youtube example by Jim Holmes as that's not for Silverlight.

The first reference I can find to Silverlight in the documentation is at http://docs.telerik.com/teststudio/testing-framework/write-tests-in-code/silverlight-wpf-automation-wtc/silverlight-ui-automation
However this only lists a method, and excludes the class, namespace and "using" statements.

It starts:
        [TestMethod]
        public void SLDemo()
        {
            //Enable Silverlight
            Settings.Current.Web.EnableSilverlight = true;


and it fails on Settings as there is no context for it.

(

I put this as a basic header for it:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ViewsTests
{
    [TestClass]
    public class TelerikVSUnitTest1 

)    

Another alternative I tried was to use the templates.  Using Test > TelerikTestingFramework>Web>VsUnit  gives me a template which includes the following:

using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.TestAttributes;
using ArtOfTest.WebAii.TestTemplates;
using ArtOfTest.WebAii.Win32.Dialogs;
 
none of which compile.

Could you point me in the right direction to make some progress.

Many thanks.



James
Top achievements
Rank 1
 answered on 04 Sep 2015
3 answers
183 views
Hi,
I am interested in next topic:
- Can I use Telerik Test Framework for desktop automation for windows form based applications ?

For example simple test:
I'd like to launch calc.exe, then press couple buttons, then verify result.

If that possibly to do ? Or only Silverlight / WPF supported in desktop direction?
Cody
Telerik team
 answered on 31 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?