Support Forum
Hi,
In your particular case, the correct wait function will be:
In general, its more robust to use the center coordinates of elements when waiting.
Here's the full example for testing editing with RowEditor (will be included in the next release):
But, for running this example, please patch the siesta-all.js. There was a bug, and "doubleClick" action in `t.chain` was using right click. Replace line 18716:
with
In your particular case, the correct wait function will be:
t.waitForSelectorAt(t.findCenter(firstCell), 'input', next)
Here's the full example for testing editing with RowEditor (will be included in the next release):
StartTest(function(t) {
//=================================================================
t.diag("Simple grid assertions");
// Use a convenience method to generate the grid, keeping the test as small as possible
var grid = t.getGrid({
plugins : Ext.create("Ext.grid.plugin.RowEditing", {}),
renderTo : document.body
});
var store = grid.store;
var firstCell, dateCell
var foundEl
t.chain(
function (next) {
// potentially, grid may have delayed rendering (`deferRowRender` option)
t.waitForRowsVisible(grid, next)
},
function (next) {
firstCell = t.getFirstCell(grid);
next()
},
{
action : 'doubleclick',
// get the "target" for action "just in time" since it will be only known after 2nd step
target : function () { return firstCell }
},
function (next) {
t.waitForSelectorAt(t.findCenter(firstCell), 'input', next)
},
function (next, el) {
foundEl = el
// Clear text field
foundEl.value = '';
next()
},
{
action : 'type',
target : function () { return foundEl },
text : 'foo'
},
// generally this "wait" is not required we just want to find the top-most element from the
// center point of the cell with date
function (next) {
t.waitForSelectorAt(t.findCenter(t.getCell(grid, 0, 3)), 'input', next)
},
function (next, el) {
foundEl = el
// Clear text field
foundEl.value = '';
next()
},
{
action : 'type',
target : function () { return foundEl },
text : '01/18/2009[ENTER]'
},
function () {
t.is(store.first().get('name'), 'foo', 'Name was updated correctly');
t.isDateEqual(store.first().get('lastgame'), new Date(2009, 0, 18), 'Date was updated correctly');
}
)
});
But, for running this example, please patch the siesta-all.js. There was a bug, and "doubleClick" action in `t.chain` was using right click. Replace line 18716:
this.test.rightClick(this.getTarget(), this.next)
this.test.doubleClick(this.getTarget(), this.next)
Read the API documentation