(also posted on Telerik forums)
Hi all,
We are trying to use the automation testing framework in code to enter data into a custom edit popup form (like in this demo: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs.aspx ) to modify a row of data. The problem we are having is that if we simply look for the Update button on the edit form and send it the Click() event then the form simply closes and does not actually trigger the RadGrid_UpdateCommand event handler. This means the data never gets updated.
We have looked in the samples provided with the Testing Framework and there is an example with a in-place edit form, but none with a popup edit form. Is there something special that we need to do with a custom edit popup form to get the row to update when we are done with the form?
Any help appreciated,
Thanks
I am not sure what the particular problem you have stumbled upon may be, however I have prepared a simple test using the page from our examples which you have referenced:
RadGrid grid = Find.ById("RadGrid1"); GridDataItem firstRow = grid.MasteTable.DataItems[0]; GridDataCell firstRowThirdCell = firstRow.DataCells[2];
// assert initial value Assert.IsTrue(firstRowThirdCell.CellText == "Chai", String.Format("Assert failed, expected value {0}, actual {1}", "Chai", firstRowThirdCell.CellText)); HtmlAnchor firstRowEditButton = firstRow.Find.ById("~AutoGeneratedEditButton");
// put the item in edit mode firstRowEditButton.Click(); Wait.For(myItem => myItem.Edited, firstRow, 5000); HtmlInputText productNameTbx = Find.ById("~ctl05_ctl09"); productNameTbx.Value = "foo";
// update the item GridEditForm editForm = Find.ById("~ctl05_ctl00"); editForm.Update(); Wait.For(myItem => !myItem.Edited, firstRow, 5000);
// verify grid is updated Assert.IsTrue(firstRowThirdCell.CellText == "foo", String.Format("Assert failed, expected value {0}, actual {1}", "foo", firstRowThirdCell.CellText));
You can use it as a reference and modify it to meet the requirements of your web page/test. Should any additional questions or difficulties arise, do not hesitate to let us know about them.