I have an ext js grid that uses the plugin row editing. I need to write selenium test scripts and would like to assign static ids or custom attributes to the row editing form fields and update and cancel buttons.. I know how to rename button text.. but what I really need to do is add a attribute so I can reference with selenium testing.
See fiddle demo.. if someone could show me how it would be appreciated (newbie extjs).
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data: [
{"name":"Lisa", "email":"lisa@simpsons.com", "phone":"555-111-1224"},
{"name":"Bart", "email":"bart@simpsons.com", "phone":"555--222-1234"},
{"name":"Homer", "email":"home@simpsons.com", "phone":"555-222-1244"},
{"name":"Marge", "email":"marge@simpsons.com", "phone":"555-222-1254"}
]
});
var grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{header: 'Name', dataIndex: 'name', editor: 'textfield'},
{header: 'Email', dataIndex: 'email', flex:1,
editor: {
xtype: 'textfield',
allowBlank: false
}
},
{header: 'Phone', dataIndex: 'phone'}
],
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1,
pluginId: 'qqrowEditingqq'
})
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
if (Ext.grid.RowEditor) {
Ext.apply(Ext.grid.RowEditor.prototype, {
saveBtnText : "Guardar",
cancelBtnText : "Cancelar",
errorsText : "Errores",
dirtyText : "Debe guardar o cancelar sus cambios"
});
}
grid.on('beforeedit', function(e) {
if (e.record.get('phone') == "555-111-1224")
grid.getPlugin('qqrowEditingqq').editor.form.findField('name').disable();
else
grid.getPlugin('qqrowEditingqq').editor.form.findField('name').enable();
});
I don't want to do xpath for this.
we will be doing grids and roweditng on many pages and would like to write selenium test scripts that select the object some sort of attribute that targets one form field or button within a grid.