Telerik Forums
Testing Framework Forum
7 answers
398 views
I need to iterate over the rows of a Silverlight RadGridView checking for duplicates and the total count.  I adapted the sample from http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/code-samples/silverlight/radgridview/scrolling.aspx.  I test against the telerik sample page here: http://demos.telerik.com/silverlight/#GridView/PagingLargeData.

I expect to get a row count on the first page of 100 and examine each row once.  Instead, I get a row count of ~120 (it changes between runs) and several rows seem to appear twice and/or out of order.  For example, the last row I print out is "83, Maxilaku, $45.60, 5/12/2008, ". How can I accomplish my goal of examining each and every row of the current RadGridView page in the order they appear in the grid and once and only once?

I am using Test Framework 2011.2.928.0 and Silverlight 4.0.60831.0.

My code follows.
Thanks,
Ken
[Test]
public void SampleWebAiiTest()
{
    Settings.Current.Web.EnableSilverlight = true;
 
    // Launch a browser instance
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
 
    // The active browser
    ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#GridView/PagingLargeData");
 
    SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
 
    int verticalOffset = 0; // Holds the current vertical offset in the viewport
    int viewPortHeight; // The height of the visible part of the grid
    int extentHeight; // The total height of the grid, visible plus non-visible
 
    // Copy the RadGridView into a local variable as a shortcut
    RadGridView grid = app.Find.ByAutomationId<RadGridView>("GridView");
 
    // Grab the VirtualizingPanel contained in the RadGridView. This is used to control the viewable portion of the grid.
    FrameworkElement virtualizingPanel = grid.Find.ByType("GridViewVirtualizingPanel");
 
    // Detect the view port height and the extent height
    viewPortHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ViewportHeight", typeof(int)));
    extentHeight = (int)virtualizingPanel.GetProperty(new AutomationProperty("ExtentHeight", typeof(int)));
 
    // Make sure it is scrolled to the very top
    // Walk through the entire grid verifying the data
    virtualizingPanel.InvokeMethod("SetVerticalOffset", 0);
 
    int index;
    int totalCount = 0;
    string rowText;
    while (verticalOffset < extentHeight)
    {
        foreach (GridViewRow r in grid.Rows)
        {
            totalCount++;
            index = r.Index;
            rowText = string.Join(", ", r.Cells.Select(item => item.Text));
        }
        // Scroll down one page
        verticalOffset += viewPortHeight;
        virtualizingPanel.InvokeMethod("SetVerticalOffset", verticalOffset);
    }
}
Cody
Telerik team
 answered on 12 Nov 2011
1 answer
96 views
I hope that this is possibly a simple question.  I am using 2011_2_9_28 and just trying to execute some tests that validate the selected text in the browser.  I was unable to get it working.

Here is a basic console app that does not display text in any of the browsers that I tried.  I would just launch it and then select various things on the page including text in the search box and GetSelectedText() is always empty.  Am I using it wrong?

Manager testManager = new Manager(false);
testManager.Start();
testManager.LaunchNewBrowser(BrowserType.InternetExplorer, true);
testManager.ActiveBrowser.NavigateTo("http://google.com");

for (int i = 0; i < 20; i++)
{
	Console.WriteLine("Current: " + testManager.ActiveBrowser.GetSelectedText());
	Thread.Sleep(1000);
}

Console.ReadLine();
testManager.Dispose();
 

Anthony
Telerik team
 answered on 11 Nov 2011
1 answer
102 views
Hi,

When I run performance testing of the our web application I get results which you can see at the attachment.
At functional testing I put 500 ms execution delay twice. But performance testing says first one's total time 1250ms and second one's 1796ms. 
How can we read performance testing result? 
Anthony
Telerik team
 answered on 10 Nov 2011
3 answers
64 views
Hi Telerik,

If I am recording a new test then everything including typing to text boxes is captured by recorder. I am recording Silverlight application.

However if I replay already recorder steps by Run->To Here by mouse right click within the test then:
- steps are repeated well based on recording
- then Test Studio with small bar is attached and I am ready to record next steps
- steps are recorder OK like mouse click etc.
- no typing inside text boxes or other controls is recorded.

Nothing helps what I tried. One and only workaround is to start with empty test and then copy and paste recorded steps to old test. It is quite tricky to do it especially within big test.

Any idea? I am using 2011.2.928.0.

Best regards,
Dalibor
Anthony
Telerik team
 answered on 08 Nov 2011
3 answers
147 views
Hi Telerik,

1. I have test 1 which opens a web page and types login name and password into my Silverlight application.
2. I have test2 which calls test 1 as a first step.
3. I have test3 which calls test 2 as a firts step.
4. I have a test4 which makes 5 times loop over test 3.

When I run test1 then it works.
When I run test2 (which calls test 1) then it works.
When I run test3 (which calls test 2 which calls test 1) then it works.
But when I run test4 which calls test 3 in loop then it fails.
Test 4 does
- loop
- calls of test3
- test 3 calls test2
- test2 calls test1. This opens a browser with my Silverlight application. Then second step (typing to login text box) fails with message Timeout trying to connect Silverlight application.

Any idea? I am using 2011.2.928.0.

Best regards,
Dalibor
Plamen
Telerik team
 answered on 08 Nov 2011
1 answer
157 views
Hello, 

I'm developing a WPF desktop application
How could I create an AlertDialog and add a special handling to it.
the problem is the AlertDialog needs a Browser , but I'm working on WPF desktop app!!
any help !!
Plamen
Telerik team
 answered on 04 Nov 2011
5 answers
252 views
Hello,

Do you plan to have this documentation back, Online or Offline?
For my part, I often refer to it to learn correctly the framework.

Thanks.
Anthony
Telerik team
 answered on 03 Nov 2011
1 answer
122 views
In the web app I am testing against I've got the element:

<form name="aspnetForm" id="aspnetForm" onsubmit="javascript:return WebForm_OnSubmit();" action="default.aspx" method="post" sizcache="10" sizset="0">

The following code:

Element element1 = Find.ById("aspnetForm");
Element element2 = Find.ByXPath("//form[@id='aspnetForm']");
Element element3 = Find.ByXPath("//form[@name='aspnetForm']");

returns element1 as correct found element, wheras element2 and element3 are nulls. What is the reason for that?

IE8, WinXP.
Anthony
Telerik team
 answered on 25 Oct 2011
1 answer
112 views
HI,

I have a WPF application I want to test with Test Studio, but I'm havieng some problems to handle an Alert Dialog. In the application, i click a button to save my changes and a popup window appears to inform that changes had been saved. It contains nothing but a label and an OK button. If I execute the test from the VS plugin, it works, but when i generate code form that test these lines are created to handle the alertdialog:
// Handle 'Generic' dialog.
          GenericDialog genericDialog = new GenericDialog(ActiveBrowser, "Modeling Scenario", true, "Submit Completed Successfully");
          genericDialog.ButtonId = 2;
          Manager.DialogMonitor.AddDialog(genericDialog);

The problem is that I don't have any ActiveBrowser, Instead I do have an ActiveApplication, but GenericDialgon needs an 'ArtOfTest.WebAii.Core.Browser' variable while ActiveApplication is an 'ArtOfTest.WebAii.Wpf.WpfApplication'.
I alos tried other posibilities like AlertDialog or ConfirmDialog, but I ended with the same problem. Can you help me please? Which is the correct class i should use for a WPF message box?
Anthony
Telerik team
 answered on 25 Oct 2011
6 answers
192 views
I am attempting to automate an export scenario. our web app has a trigger that launches a second browser that triggers the download dialog. 
I have used the 3 part method of handling IE8 dialogs (saveAsDialog, IEDownloadDialog, and IEDownloadCompleteDialog) and had it working about 1/2 dozen times. And then it stopped working. I tried changing the code to use just the DownloadDialogsHandler method. Same results. 
Nothing in this area of our app has changed to make this stop working. 

What I see happening is that when the download is triggered a second IE8 browser pops, (then the download dialog is suppose to appear) however, the browser that pops is closed before the dialog gets a chance to appear. 

If someone could see where I went wrong, or has an idea as to why the thing isn't working anymore I would appreciate it.

the simpler method of using the DownloadDialogsHandler (that I've not seen work at all) was used as
DownloadDialogsHandler exportDownload = new DownloadDialogsHandler(Manager.ActiveBrowser, DialogButton.SAVE, fileSave, Desktop);
 
Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager.DialogMonitor.Start();
 
HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink"));
exportSelectCSV.Click();
 
exportDownload .WaitUntilHandled();
the code I've used (and saw working a few times) is as follows 
if (File.Exists(fileSave + "export.csv"))
            
{
                File.Delete(fileSave + "export.csv");
            }
 
            SaveAsDialog saveExport = new SaveAsDialog(ActiveBrowser, DialogButton.SAVE, fileSave + "export.csv", Desktop);
            Manager.DialogMonitor.AddDialog(saveExport);
            IEDownloadDialog ieDialog = new IEDownloadDialog(ActiveBrowser, DialogButton.SAVE, Desktop);
            Manager.DialogMonitor.AddDialog(ieDialog);
            IEDownloadCompleteDialog dlComplete = new IEDownloadCompleteDialog(ActiveBrowser, DialogButton.CLOSE, Desktop);
            Manager.DialogMonitor.AddDialog(dlComplete);
             
            Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
            Manager.DialogMonitor.Start();
 
            HtmlControl exportSelectCSV = new HtmlControl(Find.ByAttributes("class=~SiteExportLink"));
            exportSelectCSV.Click();
 
            ieDialog.WaitUntilHandled();
            saveExport.WaitUntilHandled();
            dlComplete.WaitUntilHandled();
Cody
Telerik team
 answered on 19 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?