Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #11
    Ext User
    Join Date
    May 2007
    Posts
    10
    Vote Rating
    0
    kris is on a distinguished road

      0  

    Default


    Hi,

    thanks for this useful hint, indeed these locators seem to be more elegant.
    However, ext generates quite complex dom, and I'm still looking for a simpler solution to test some components (editor grid panel, trees). Selenium is really extensible, and I've found a few minutes today to develop this ugly spike:

    Code:
    function findExtGridCell(win, target) {
        if (!win.Ext) 
            throw new SeleniumError("Ext not found");
        
        var cfg = target.split(',');
    	if (cfg.length !== 3) throw new SeleniumError("invalid format. [cmpid,row,col]");
    	
    	var grid = win.Ext.getCmp(cfg[0]);
        if (!grid) 
            throw new SeleniumError("no ext grid '" + cmpid + "'");
        if (!grid.getGridEl) 
            throw new SeleniumError("ext cmp is not a grid");	
        return {
    		grid : grid,
    		row : parseInt(cfg[1]),
    		col : parseInt(cfg[2])
    	}
    }
    
    Selenium.prototype.doExtGridEdit = function(target, value){
    
        var cfg = findExtGridCell(this.browserbot.getCurrentWindow(), target);
        var grid = cfg.grid;
        if (!grid.startEditing) 
            throw new SeleniumError('grid is not editable');
        
        grid.startEditing(cfg.row,cfg.col);
        if (!grid.editing) 
            throw new SeleniumError('cell [' + cfg.row + ',' + cfg.col + '] is not editable');
        
        return Selenium.decorateFunctionWithTimeout(function(){
            if (!grid.activeEditor) 
                return false;
            grid.activeEditor.setValue(value);
            grid.stopEditing();
            return true;
        }, 1000); //ext defers editing by 50ms
    }
    
    PageBot.prototype.locateElementByExtGridCell = function(uiSpecifierString, inDocument, inWindow){
    	var cfg = findExtGridCell(inWindow, uiSpecifierString);
    	return cfg.grid.getView().getCell(cfg.row,cfg.col);
    }
    PageBot.prototype.locateElementByExtGridCell.prefix = 'extgridcell';
    this adds a new command (extGridEdit), so you can set any value in any editable cell, and a new type of locator (extgridcell=gridid,row,col). IMO it provides a bit higher level of abstraction - but there would be some work required to cover all components... I'm not sure if it's worth it, I have to ask my tester

  2. #12
    Ext User
    Join Date
    Apr 2008
    Posts
    16
    Vote Rating
    0
    p.v.param is on a distinguished road

      0  

    Default


    Thank very much Kris its solved
    Cheers
    PVP

  3. #13
    Ext User
    Join Date
    Nov 2008
    Posts
    3
    Vote Rating
    0
    sfboarders is on a distinguished road

      0  

    Default


    Quote Originally Posted by kris View Post
    Hi,

    thanks for this useful hint, indeed these locators seem to be more elegant.
    However, ext generates quite complex dom, and I'm still looking for a simpler solution to test some components (editor grid panel, trees). Selenium is really extensible, and I've found a few minutes today to develop this ugly spike:

    Code:
    function findExtGridCell(win, target) {
        if (!win.Ext) 
            throw new SeleniumError("Ext not found");
        
        var cfg = target.split(',');
        if (cfg.length !== 3) throw new SeleniumError("invalid format. [cmpid,row,col]");
        
        var grid = win.Ext.getCmp(cfg[0]);
        if (!grid) 
            throw new SeleniumError("no ext grid '" + cmpid + "'");
        if (!grid.getGridEl) 
            throw new SeleniumError("ext cmp is not a grid");    
        return {
            grid : grid,
            row : parseInt(cfg[1]),
            col : parseInt(cfg[2])
        }
    }
    
    Selenium.prototype.doExtGridEdit = function(target, value){
    
        var cfg = findExtGridCell(this.browserbot.getCurrentWindow(), target);
        var grid = cfg.grid;
        if (!grid.startEditing) 
            throw new SeleniumError('grid is not editable');
        
        grid.startEditing(cfg.row,cfg.col);
        if (!grid.editing) 
            throw new SeleniumError('cell [' + cfg.row + ',' + cfg.col + '] is not editable');
        
        return Selenium.decorateFunctionWithTimeout(function(){
            if (!grid.activeEditor) 
                return false;
            grid.activeEditor.setValue(value);
            grid.stopEditing();
            return true;
        }, 1000); //ext defers editing by 50ms
    }
    
    PageBot.prototype.locateElementByExtGridCell = function(uiSpecifierString, inDocument, inWindow){
        var cfg = findExtGridCell(inWindow, uiSpecifierString);
        return cfg.grid.getView().getCell(cfg.row,cfg.col);
    }
    PageBot.prototype.locateElementByExtGridCell.prefix = 'extgridcell';
    this adds a new command (extGridEdit), so you can set any value in any editable cell, and a new type of locator (extgridcell=gridid,row,col). IMO it provides a bit higher level of abstraction - but there would be some work required to cover all components... I'm not sure if it's worth it, I have to ask my tester
    Hi Kris,

    can you tell me how to use the code you have provided? I tried creating xpaths using the classes but each column in the grid is using the same class so that did not work to well. I'm hoping your solution will help me automate our extjs grid using Sel. IDE.

  4. #14
    Ext User FredrikWendt's Avatar
    Join Date
    Feb 2008
    Location
    Göteborg, Sweden
    Posts
    30
    Vote Rating
    0
    FredrikWendt is on a distinguished road

      0  

    Default alternative solution

    alternative solution


    We extended the ComboBox template to set known ID on the trigger (combo's id + '_trigger') which is more QA (human) friendly.

    Not everyone can do this - look at the initList method carefully regarding id:s on items - but we could and it made testing soo much easier.

    Code:
    	initList: function() {
    		var cls = 'x-combo-list';
    		this.tpl = '<tpl for="."><div class="'+cls+'-item" id="'+ this.id +'_{'+this.valueField+'}">{'
    			+ this.displayField + '}</div></tpl>';
    		js.lib.OurComboBox.superclass.initList.call(this);
    },
    Code:
    	onRender: function(ct, position) {
    		Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
    		this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
    		this.trigger = this.wrap.createChild(this.triggerConfig ||
    			{id: this.id + '_trigger', tag: "img", src: Ext.BLANK_IMAGE_URL,
    			cls: "x-form-trigger " + this.triggerClass});

  5. #15
    Ext User
    Join Date
    Dec 2007
    Posts
    67
    Vote Rating
    0
    jit is on a distinguished road

      0  

    Thumbs up


    kris, thanks for sharing your code.

    I've been trying to do something similar, but instead of using the Ext API, I've tried to use pure browser based interactions with selenium but haven't had much luck, see: http://extjs.com/forum/showthread.php?t=65072

    Jit

  6. #16
    Ext User
    Join Date
    Dec 2007
    Posts
    67
    Vote Rating
    0
    jit is on a distinguished road

      0  

    Question


    I've been making use of the following approach based on Kris's code example:

    Code:
    grid.startEditing(row, col);
    grid.activeEditor.setValue(value);
    grid.activeEditor.completeEdit(false);
    This has worked fine, however what I've noticed is that its possible to set invalid values into combo boxes.

    When you configure a combo box with 'forceSelection: true', normal behaviour when you type a value not configured in the combo's store is to just ignore the value and revert to the previous value.

    However using the activeEditor.setValue(..) approach, the normal behaviour isn't honoured and instead its possible to set any value in the combo box.

    This therefore makes it difficult to test the case where invalid data is entered into a combo box in an editable grid.

    Can anyone help with an alternative approach that allows displays the same behaviour as a user typing values?

    Thanks

    Jit

  7. #17
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Did you try setRawValue?

  8. #18
    Ext User
    Join Date
    Dec 2007
    Posts
    67
    Vote Rating
    0
    jit is on a distinguished road

      0  

    Default


    Thanks for the quick response Condor. I've just tried your suggestion of using setRawValue, but unfortunately this doesn't work. I'm finding that this doesn't set a value at all in the combo - even when trying to set a value that's contained in the combo's store.

    Jit

  9. #19
    Ext User
    Join Date
    Dec 2007
    Posts
    67
    Vote Rating
    0
    jit is on a distinguished road

      0  

    Default


    Here's a test case that can be run from the ext/examples directory:

    Code:
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Test</title>
        <link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
     	<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="../ext-all.js"></script>
    
    </head>
    
    <script type="text/javascript">
    
    Ext.onReady(function(){
    
    	var store = new Ext.data.SimpleStore({
    		id: 0,
    		fields: ['name'],
    		expandData: true,
    		data: ['item-1', 'item-2', 'item-3']
    	});
    
    	var combo = new Ext.form.ComboBox({
    		id: 'dummy',
    		store: new Ext.data.SimpleStore({
    			id: 0,
    			fields: ['id'],
    			data: [
    				['item-1'],
    				['item-2'],
    				['item-3']
    			]
    		}),
    		mode: 'local',
    		displayField: 'id',
    		valueField: 'id',
    		triggerAction: 'all',
    		selectOnFocus: true,
    		typeAhead: true,
    		forceSelection: true,
    		valueNotFoundText: ''
    	});
    
    	var columnModel = new Ext.grid.ColumnModel({
    		columns: [{
    			header: 'Name',
    			dataIndex: 'name',
    			editor: new Ext.form.ComboBox({
    				id: 'edit-1',
    				store: new Ext.data.SimpleStore({
    					id: 0,
    					fields: ['id'],
    					data: [
    							['item-1'],
    							['item-2'],
    							['item-3']
    					]
    				}),
    				mode: 'local',
    				displayField: 'id',
    				valueField: 'id',
    				triggerAction: 'all',
    				selectOnFocus: true,
    				typeAhead: true,
    				forceSelection: true,
    				valueNotFoundText: ''
    			})
    		}]
    	});
    
    	var grid = new Ext.grid.EditorGridPanel({
    		store: store,
    		clicksToEdit: 1,
    		cm: columnModel
    	});
    
    	var button1 = new Ext.Button({
    		text: 'Set 1st cell to item-2 - this should work',
    		handler: function() {
    			setValue('item-2');
    		}
    	});
    
    	var button2 = new Ext.Button({
    		text: 'Set 1st cell to hello - this should not work',
    		handler: function() {
    			setValue('hello');
    		}
    	});
    
    	function setValue(value) {
    			grid.startEditing(0, 0);
    			(function(){
    				Ext.getCmp('edit-1').setValue(value);
    				Ext.getCmp('edit-1').fireEvent('blur');
    				combo.setValue(value);
    				combo.fireEvent('blur');
    			}).defer(60);
    	}
    
    	new Ext.Viewport({
    		items: [button1, button2, combo, grid]
    	});
    });
    
    </script>
    
    <body>
    </body>
    </html>
    Jit
    Last edited by jit; 28 Apr 2009 at 7:11 AM. Reason: Updated test case code

  10. #20
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    82
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    How about:
    Code:
    grid.startEditing(0, 0);
    (function(){
    	grid.activeEditor.field.setRawValue('hello');
    	grid.activeEditor.field.triggerBlur();
    }).defer(60);
    (only required for TriggerFields)