在 Telerik 测试框架中使用自定义编辑弹出表单

发布于 2024-12-20 22:35:54 字数 715 浏览 3 评论 0原文

(也发布在 Telerik 论坛上

大家好,

我们正在尝试在代码中使用自动化测试框架将数据输入到自定义编辑弹出表单中(如本演示所示:http://demos.telerik.com/aspnet-ajax/grid /examples/dataediting/popupeditform/defaultcs.aspx ) 修改一行数据。我们遇到的问题是,如果我们只是在编辑表单上查找“更新”按钮并向其发送 Click() 事件,那么表单只会关闭并且实际上不会触发 RadGrid_UpdateCommand 事件处理程序。这意味着数据永远不会更新。

我们查看了测试框架提供的示例,其中有一个带有就地编辑表单的示例,但没有一个带有弹出编辑表单。我们是否需要对自定义编辑弹出表单执行一些特殊操作,以便在完成表单后更新行?

任何帮助表示赞赏,

谢谢

(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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尐偏执 2024-12-27 22:35:54

我不确定您偶然发现的特定问题可能是什么,但是我已经使用您引用的示例中的页面准备了一个简单的测试:

RadGrid grid = Find.ById("RadGrid1");
GridDataItemfirstRow = grid.MasteTable.DataItems[0];
GridDataCellfirstRowThirdCell=firstRow.DataCells[2];

// 断言初始值
Assert.IsTrue(firstRowThirdCell.CellText == "Chai", String.Format("断言失败,期望值{0},实际值{1}", "Chai", firstRowThirdCell.CellText));
HtmlAnchor firstRowEditButton = firstRow.Find.ById("~AutoGenerateEditButton");

// 将项目置于编辑模式
FirstRowEditButton.Click();
Wait.For(myItem => myItem.Edited,firstRow,5000);
HtmlInputText 产品名称Tbx = Find.ById("~ctl05_ctl09");
产品名称Tbx.Value = "foo";

// 更新项目
GridEditForm editForm = Find.ById("~ctl05_ctl00");
editForm.Update();
Wait.For(myItem => !myItem.Edited,firstRow,5000);

// 验证网格是否已更新
Assert.IsTrue(firstRowThirdCell.CellText == "foo", String.Format("断言失败,期望值{0},实际值{1}", "foo",firstRowThirdCell.CellText));

您可以将其作为参考并修改它以满足您的网页/测试的要求。如果出现任何其他问题或困难,请随时告诉我们。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文