I have a question regarding the genericDialog in Silverlight application. I have the following scenario:
If I launch the Silverlight Application and the genericDialog appears (it means the error appears), the test fails; if not, the test passes.
Telerik Test Studio Generates the following code:
GenericDialog genericDialog = new GenericDialog(ActiveBrowser, "", true, "");
genericDialog.ButtonId = 2;
Manager.DialogMonitor.AddDialog(genericDialog);
ActiveBrowser.NavigateTo("testurl");
genericDialog.WaitUntilHandled(5000); ----how to handle this one using if else condition?
Do you have any idea about how to use if else condition in genericDialog.WaitUntilHandled(5000)?
Thanks so much!
//Find The main GridHtmlDiv GridDiv = ActiveBrowser.Find.ById<HtmlDiv>("globalSearchGrid");//Find The ContentHtmlDiv Content = GridDiv.Find.ByAttributes<HtmlDiv>("class=k-grid-content");HtmlTable ContenthtmlTable = Content.Find.ByTagIndex<HtmlTable>("table", 0);
ContenthtmlTable {HtmlTable:<table style="height: auto;" id="globalSearchGrid-grid-table" class="k-focusable" cellSpacing="0">}
HTML:
<table id="globalSearchGrid-grid-table" cellspacing="0" style="height: auto;" class="k-focusable"> <colgroup> <col /> <col /> <col /> <col /> <col /> </colgroup> <tbody> <tr> <td class=""><input type="checkbox" /></td> <td><span>Test Matter</span></td> <td><span>5000000092</span></td> <td><span>2007-03-22T00:00:00</span></td> <td><span>Open</span></td> </tr> <tr> <td><input type="checkbox" /></td> <td class=""><span>ITP Budget Matter 2</span></td> <td><span>5000000023</span></td> <td><span>2006-04-11T00:00:00</span></td> <td><span>Open</span></td> </tr> <tr> <td><input type="checkbox" /></td> <td><span>test123123123</span></td> <td><span>5000000098</span></td> <td><span>2007-08-20T00:00:00</span></td> <td><span>Open</span></td> </tr> </tbody></table>public string GetCellValue(){ string value; var textBlock = TableCell.Find.ByType<TextBlock>(); var sw = new System.Diagnostics.Stopwatch(); sw.Start(); value = textBlock.Text; //Takes on average 750 milliseconds sw.Stop(); Tracer.CaptureTiming( "GetCellValue", sw.Elapsed.Ticks ); //Capturing timing return value;}[TestFixture] [Parallelizable(TestScope.Descendants)] public class TelerikMbUnit1 : BaseTest { ConcurrentDictionary<string, Browser> browserDict = new ConcurrentDictionary<string, Browser>(); #region [ Setup / TearDown ] [SetUp] public void MyTestInitialize() { Initialize(false); // Launch new browser Manager.LaunchNewBrowser(BrowserType.FireFox, true); Browser browser = Manager.ActiveBrowser; browserDict.TryAdd(TestContext.CurrentContext.TestStep.ToString(), browser); } [TearDown] public void MyTestCleanUp() { // this.CleanUp(); Browser browser; browserDict.TryRemove(TestContext.CurrentContext.TestStep.ToString(), out browser); browser.Close(); } [FixtureTearDown] public void FixtureCleanup() { // This will shut down all browsers if // recycleBrowser is turned on. Else // will do nothing. ShutDown(); } #endregion [Test] public void SampleWebAiiTest0() { Browser browser = browserDict.Where(d => d.Key == TestContext.CurrentContext.TestStep.ToString()).Single().Value; // The active browser browser.NavigateTo("http://www.google.dk"); // Find the google search box and set it to "Telerik"; browser.Find.ByName<HtmlInputText>("q").Text = "Telerik"; // Click the Search button browser.Find.ByName<HtmlButton>("btnK").Click(); // Validate the search contain the 'Telerik' text Assert.IsTrue(browser.ContainsText("Telerik")); }