QuickTip testing

Get help with testing, discuss unit testing strategies etc.

QuickTip testing

Postby zombeerose » Thu Feb 02, 2012 10:05 pm

Is it possible to test quick tips using Siesta?

Below is a simple test that I can't get to work. The callback is never executed.

Code: Select all
StartTest(function (t) {
    var Ext = t.getExt();
   
    var cmp = Ext.create('Ext.button.Button',{
        renderTo: Ext.getBody(),
        text: 'Some Button',
        tooltip: 'A tooltip describes the purpose'
    });
   
    var M = Ext.tip.QuickTipManager;
   
    M.init();
   
    t.mouseOver(cmp);
    t.waitFor(
        function(){ return M.getQuickTip().isVisible(); },
        function(){
            t.diag('Tooltip was displayed');
            t.done();
        },
        this
    );
});


If you hover over the button while the test is running and waiting, it will pass.
zombeerose
 
Posts: 111
Joined: Fri Nov 18, 2011 9:37 pm

Re: QuickTip testing

Postby mats » Thu Feb 02, 2012 10:19 pm

Are you sure that code actually uses a QuickTip under the hood, and not a Tooltip?
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com

Follow us on Twitter: @bryntum or Facebook

Need professional services or training? Read more here.
API documentation
User avatar
mats
Core Developer
Core Developer
 
Posts: 7074
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden

Re: QuickTip testing

Postby zombeerose » Mon Feb 06, 2012 5:30 pm

Hmmm....interesting question. I would believe so because if you inspect the element, the property in the html is 'data-qtip,' which directly correlates to the values of the tagConfig property that is defined in Ext.tip.QuickTip. Secondly, if you hover the mouse over the button while the test is running so that the tip pops up, then the test will continue and pass.

Code: Select all
<button id="button-1014-btnEl" type="button" class="x-btn-center" hidefocus="true" role="button" autocomplete="off" data-qtip="A tooltip describes the purpose of this button" style="width: 194px; height: 44px; "><span id="button-1014-btnInnerEl" class="x-btn-inner" style="width: 194px; height: 44px; line-height: 44px; ">Some Button</span><span id="button-1014-btnIconEl" class="x-btn-icon "></span></button>
zombeerose
 
Posts: 111
Joined: Fri Nov 18, 2011 9:37 pm

Re: QuickTip testing

Postby nickolay » Mon Feb 06, 2012 6:20 pm

Try to also move a "virtual" cursor a little may be?:

Code: Select all
    t.mouseOver(cmp);
    t.moveMouseBy([ 5, 0 ]);
    t.waitFor(...
We offer training in both Ext JS and our products, read more here.
Read the API documentation
User avatar
nickolay
Core Developer
Core Developer
 
Posts: 1074
Joined: Mon May 16, 2011 10:48 am

Re: QuickTip testing

Postby mats » Mon Feb 06, 2012 6:58 pm

This works fine for me:

Code: Select all
StartTest(function (t) {
    var Ext = t.getExt();

    var cmp = Ext.create('Ext.button.Button', {
        renderTo: Ext.getBody(),
        text: 'Some Button',
        tooltip: 'A tooltip describes the purpose'
    });

    var M = Ext.tip.QuickTipManager;

    M.init();

    t.moveMouseTo(cmp.el);
    t.waitForComponentVisible(M.getQuickTip(), function () {
        t.pass('Tooltip was displayed');
    });
});
We're hiring! We have an open position for an experienced Sencha developer (Ext JS and/or Sencha Touch). Contact us at jobs@bryntum.com

Follow us on Twitter: @bryntum or Facebook

Need professional services or training? Read more here.
API documentation
User avatar
mats
Core Developer
Core Developer
 
Posts: 7074
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden

Re: QuickTip testing

Postby zombeerose » Mon Feb 06, 2012 11:56 pm

Cool - thanks guys!
zombeerose
 
Posts: 111
Joined: Fri Nov 18, 2011 9:37 pm


Return to Help & General discussion

Who is online

Users browsing this forum: No registered users and 1 guest