Get help with testing, discuss unit testing strategies etc.


Post by satishkn »

Hi,

I am using FF 10.0.2 on Windows XP, and Siesta 1.0.7

type doesn't seem to work on a cell in a grid. However, it seems to work in a combobox.

Any suggestions how to make it work?

Thx,
-Satish

Post by nickolay »

Hi,

You can't type directly in the cell of the grid. Need to activate the grid editor first (usually with double click). See /examples/023-extjs-grid/040_editing.t.js

Post by satishkn »

I am activating with doubleclick, but immediately followed by type.

Do I need to have t.waitForSelectorAt(....) between doubleclick() and type() as is shown in the example?
Thx
-Satish

Post by nickolay »

Yes, Ext editor makes a 15ms delay after double click, before it will actually appear. Not sure why its done in this way, but you need to use that `waitForSelector` as in example

Post by satishkn »

Hi,

I tried, but I keep getting the following exception:
...
Timeout while waiting for condition.

Failed assertion [waitFor]
Condition was not fullfilled during 10000ms

....
Even though I am using RowEditing as selection model (and not cellediting), should I be looking for 'input' as the css selector?

If not, how do I find out what css selector string I need to use with the api (waitfor.....) ?

Sorry if it is a basic question.
Thx,
-Satish

Post by nickolay »

Double click on the cell to show your editor and then examine how it is represented in the DOM. Look for specific tag or CSS class or their combination.

Post by satishkn »

Thanks for the suggestion!!

However, I am able to find the cell and position the mouse properly, but keyPress or type just doesn't work.
I suspect that it is because of rowediting (not cellediting) plugin that we are using with the grid.

Would appreciate if you can shed some light on this.
-Satish

Post by nickolay »

If you will post a test case I could take a look on it, hard to say anything otherwise.

Post by satishkn »

Thanks for your response.

I hope I am not asking for too much :)-

Would it be possible for you to provide an example with rowediting (grid & extjs) just like you have provided for grid's cell editing?

Thx,
-Satish

Post by satishkn »

Hi,

Quick update -

I just tweaked your example - Editing/040_editing.js, and changed from cellediting to rowediting (plugin).

What was working with cellediting, isn't working with rowediting.
Noticing the same issues with Editing/040_editing.js as I am facing with my own application.

Thx,
-Satish

fyi- here is the code for Editing/040_editing.js
I have tried with various wait methods, but no luck.

.......................
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;

t.waitForRowsVisible(grid, function() {
var firstCell = t.getFirstCell(grid);

// See if we can edit the name cell
t.doubleClick(firstCell, function() {

var prevValue = store.first().get('name');

// Wait for editor to appear at the position of the cell
// t.waitForSelectorAt(firstCell.getXY(), 'input', function(foundEl) {
t.waitForContentLike(firstCell, 'x-box-inner', function(foundEl) {

// Clear text field
foundEl.value = '';

// Type some text
t.type(foundEl, 'foo[ENTER]', function() {

t.is(store.first().get('name'), 'foo', 'Name was updated correctly');

var dateCell = t.getCell(grid, 0, 3);

// See if we can edit the "last game" cell
t.doubleClick(dateCell, function() {
// Date value is "11/12/2010", change to "01/12/2010"
t.waitForSelectorAt(dateCell.getXY(), 'input', function(foundEl) {
foundEl.value = ''; // Reset field
t.type(foundEl, '01/18/2009[ENTER]', function() {
t.isDateEqual(store.first().get('lastgame'), new Date(2009, 0, 18), 'Date was updated correctly');
});
});
});
});
// eof waitFor
});
// eof waitForSelectorAt
});
// eof doubleClick
});
// eof waitForRowsVisible
});
........................
Last edited by satishkn on Thu Apr 05, 2012 8:31 am, edited 1 time in total.

Post Reply