Get help with testing, discuss unit testing strategies etc.


Post by intro »

Hi I am trying to make test case to filter the grid with filter on grid.

I don't know How I can make function for click.

Thanks Vladimir

Post by mats »

Please take a moment and study our examples, plenty of Grid samples in the /examples folder.

Post by intro »

Hi Mats...thanks for reply ..
I checked examples but there is no example on clicking header menu filters.
:?
I am trying this way but is not working
{ action: "moveCursorTo", target: "gridpanel > headercontainer => .x-column-header:nth-child(2) .x-column-header-inner" }, //move to the header second column
{ action: "moveCursorTo", target: "gridpanel > headercontainer => .x-column-header:nth-child(2) .x-column-header-trigger" }  //not working -- it move back and I want to open filter header field
Thanks Mats

Post by mats »

Can you show the Ext JS code which builds your Grid? It's much easier for us to assist you if we know what you're doing :)

Post by intro »

Hi
You can use this grid for test...my problem is when you have normal grid with filters ..how to click on filter menu on grid header.

Thanks.
Ext.onReady(function() {
    
    
    var store = Ext.create('Ext.data.Store', {
        fields:['name'],
        data:{'items':[
            { 'name': 'Lisa' },
            { 'name': 'Bart' },
            { 'name': 'Homer' },
            { 'name': 'Marge' }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                rootProperty: 'items'
            }
        }
    });
    
    var grid = Ext.create('Ext.grid.Panel', {
        renderTo: Ext.getBody(),
		store: store,
        plugins: 'gridfilters',
        columns: [{
            dataIndex: 'name',
            text: 'Name',
            filter: {
                type: 'string'
            }
        }]
        
    });
});

Post by mats »

Did you try using the recorder to assist you?

Post by mats »

And what is this plugin?
        plugins: 'gridfilters',
You need to post a real test case we can run.

Post by intro »

Thanks ..
you can checkhttps://fiddle.sencha.com/#fiddle/6gg
problem is how to test grid filter... on Name

I tried recorder but it is going on wrong element ..can not get to go to the arrow click and open grid filter menu..

Thanks Mats for fast answers....

Vlad

Post by mats »

Very easy using the recorder:
t.chain(
    { action : "moveCursorTo", target : ">>gridcolumn[text=Name]" },

    { action : "click", target : "gridcolumn[text=Name] => .x-column-header-trigger", offset : [7, 11] },

    { action : "moveCursorTo", target : "[itemId=filters] => .x-menu-item-text", offset : [18, 14] },

    { action : "click", target : "menu{isVisible()} textfield => .x-form-text", offset : [30, 12] },

    { action : "type", text : "foo" }
);

Post by intro »

Thanks Mats it is working.

Vlad

Post Reply