Hi Jeffrey,
In the case of a User Control Edit Form the approach is a bit different as we need to locate the update button manually (since the form is custom), in order to click it:
RadGrid grid = Find.ById<RadGrid>(
"RadGrid1"
);
GridDataItem firstRow = grid.MasterTable.DataItems[0];
GridDataCell firstRowThirdCell = firstRow.DataCells[2];
// assert initial value
Assert.IsTrue(firstRowThirdCell.CellText ==
"Nancy"
, String.Format(
"Assert failed, expected value {0}, actual {1}"
,
"Nancy"
, firstRowThirdCell.CellText));
HtmlAnchor firstRowEditButton = firstRow.Find.ById<HtmlAnchor>(
"~EditButton"
);
// put the item in edit mode
firstRowEditButton.Click();
Wait.For<GridDataItem>(myItem => myItem.Edited, firstRow, 5000);
HtmlInputText productNameTbx = Find.ById<HtmlInputText>(
"~EditFormControl_TextBox2"
);
productNameTbx.Value =
"foo"
;
// update the item
GridEditForm editForm = Find.ById<HtmlTable>(
"Table2"
).Parent<GridEditForm>();
editForm.Find.ById<HtmlInputButton>(
"~btnUpdate"
).Click();
Wait.For<GridDataItem>(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));
I used the above code with our
user control edit form example and it is working as expected. Could you please try it and let me know if you can reproduce the problem you described? Alternatively, if that does not help, you can send us a live url of the page you are testing against (if available) so I can investigate further and pinpoint the exact cause for this unexpected behavior.
Best wishes,
Pavel
the Telerik team
Check out
Telerik Trainer, the state of the art learning tool for Telerik products.