[英]Working with custom edit popup forms in Telerik Testing Framework
( also posted on Telerik forums ) ( 也发布在Telerik论坛上 )
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. 我们正在尝试在代码中使用自动化测试框架,以将数据输入到自定义编辑弹出窗口表单中(例如在此演示中: http : //demos.telerik.com/aspnet-ajax/grid/examples/dataediting/popupeditform/defaultcs。 aspx )修改一行数据。 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.
我们遇到的问题是,如果我们只是在编辑表单上查找“更新”按钮并向其发送Click()事件,则该表单只是关闭而实际上并未触发RadGrid_UpdateCommand事件处理程序。 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"); RadGrid网格= Find.ById(“ RadGrid1”); GridDataItem firstRow = grid.MasteTable.DataItems[0];
GridDataItem firstRow = grid.MasteTable.DataItems [0]; GridDataCell firstRowThirdCell = firstRow.DataCells[2];
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)); // //声明初始值Assert.IsTrue(firstRowThirdCell.CellText ==“ Chai”,String.Format(“声明失败,期望值{0},实际值为{1}”,“ Chai”,firstRowThirdCell.CellText)); HtmlAnchor firstRowEditButton = firstRow.Find.ById("~AutoGeneratedEditButton");
HtmlAnchor firstRowEditButton = firstRow.Find.ById(“〜AutoGeneratedEditButton”);
// put the item in edit mode firstRowEditButton.Click(); //将项目置于编辑模式下firstRowEditButton.Click(); Wait.For(myItem => myItem.Edited, firstRow, 5000);
Wait.For(myItem => myItem.Edited,firstRow,5000); HtmlInputText productNameTbx = Find.ById("~ctl05_ctl09");
HtmlInputText productNameTbx = Find.ById(“〜ctl05_ctl09”); productNameTbx.Value = "foo";
productNameTbx.Value =“ foo”;
// update the item GridEditForm editForm = Find.ById("~ctl05_ctl00"); //更新项目GridEditForm editForm = Find.ById(“〜ctl05_ctl00”); editForm.Update();
editForm.Update(); Wait.For(myItem => !myItem.Edited, firstRow, 5000);
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)); // //验证网格是否已更新Assert.IsTrue(firstRowThirdCell.CellText ==“ foo”,String.Format(“ Assert failed,期望值{0},实际{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.
如有其他问题或困难,请随时告知我们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.