Results 1 to 6 of 6

Thread: Message Box timeout problem clicking yes/no button

    Success! Looks like we've fixed this one. According to our records the fix was applied for ORION-1176 in 2.0.0.
  1. #1
    Sencha User
    Join Date
    Jun 2016
    Posts
    7

    Default Message Box timeout problem clicking yes/no button

    Hi,

    there is a problem clicking yes/no button inside a message box in Sencha. I receive a strange timeout problem in test results, even if the button is visually clicked correctly.


    The test is as follows:

    it('should click message box button button', function() {

    ST.component('messagebox')
    .rendered()
    .and(function(el) {
    ST.component('messagebox button[text="No"]')
    .rendered()
    .click();
    })
    })
    This is the error in Sencha Studio:


    Timeout waiting for target (messagebox button[text="No"]) to be visible for click


    The message box inside my code:

    Ext.Msg.confirm('Test message box', 'Click yes or no',
    function (choice) {
    if (choice === 'yes') {
    console.log('clicked yes')
    }
    else
    console.log('no')
    });

    This is crucial even if this can appear a trivial problem, since clicking yes triggers a series of actions that cannot be triggered in other ways.

    We tried almost every technique, even clicking using XPath but the error is the same. Last but not least, this problems seems to be not deterministic. (Sometimes it works and sometimes not)

    Any suggestion? Can be a problem with the used Webdrivers?

    Thanks,
    Luigi

  2. #2
    Sencha User vojtech.cerveny's Avatar
    Join Date
    Jun 2015
    Location
    Ostrava, Czech republic
    Posts
    52

    Default

    Hi Luigi,
    I guess that you use SenchaTest 1.0.3, right? It has a problem with components, which disappear after clicking. It is fixed in ST 2.0

    We have "hack" for it - normal click in ST 1.0.3 is composed from mousedown, mouseup, click, so it throws error if component disappears after mouseup.

    But you can use this:
    Code:
    function ghostClick(loc) {
    
        var fieldForPlay = [
            {type: "click", target: loc,  detail: 1}
        ];
    
        ST.play(fieldForPlay);
    }
    
    it('should click message box button button', function() {
        ST.component('messagebox')
            .rendered();
        // you can put it into and function, but it is unnecessary.     
        ghostClick('messagebox button[text="No"]')
    });
    Feel free to contact me any time.
    Vojtěch Červený
    “Testers don’t like to break things; they like to dispel the illusion that things work.”— Kaner, Bach, Pettichord

  3. #3
    Sencha User
    Join Date
    Jun 2016
    Posts
    7

    Default

    Hi Vojtěch,

    I tried the 2.0 EA version but with no success. Using the solution you posted above it triggers a click but without the correct focus, so messagebox is not closed.

    This is my code where I just added explicit focus on the component.

    Code:
    it('should click message box button button', function() {
        ST.component('messagebox button[text="Yes"]')
            .focus()
            .focused()
            .and(function () {
                
               ghostClick('messagebox button[text="Yes"]');
    });
    });
    

  4. #4
    Sencha User vojtech.cerveny's Avatar
    Join Date
    Jun 2015
    Location
    Ostrava, Czech republic
    Posts
    52

    Default

    Hi,
    I tried ST2.0.0.269 and this code works for me. I creates your messagebox and then I am able to click on button and box disappears. What version ExtJS do you use?

    Code:
    describe("TEST", function() {
        beforeAll(function(){
            Ext.Msg.confirm('Test message box', 'Click yes or no',
                function (choice) {
                if (choice === 'yes') {
                console.log('clicked yes')
                }
                else
                console.log('no')
                });
        });
        
        it("should pass", function() {
            ST.component('messagebox button[text="Yes"]')
                .click();
        });
    });
    “Testers don’t like to break things; they like to dispel the illusion that things work.”— Kaner, Bach, Pettichord

  5. #5
    Sencha User
    Join Date
    Jun 2016
    Posts
    7

    Default

    The Extjs version I use is 6.0.1

    Anyway, I tried again with Sencha Test 2 EA and it seems to work! But I can see that this EA version still has some problems so I would like to fix it on the previous version. Could you suggest any other technique for confirm buttons click?

    This is a list of main problems encountered with version 2:

    - stc command line error in test results,
    - synchronization error in setup/teardown method that works with 1.0.3,
    - stop button inside GUI is not clickable while running tests

    Is there a release roadmap for a full working release of Sencha Test 2?

    Thanks a lot,
    Luigi

  6. #6
    Sencha User
    Join Date
    Jun 2016
    Posts
    7

    Default

    For anyone interested I solved this way

    Code:
    ST.component('messagebox')
    .and(function(el) {
          expect(el.isVisible()).toBeTruthy();
    
          el.msgButtons.yes.handler.call(el, me.msgButtons.yes);
    
          expect(el.isVisible()).toBeFalsy();
    }

Similar Threads

  1. [FIXED] Message box without button still displays extra space where button suppose to be
    By riahut.com in forum Sencha Touch 2.x: Bugs
    Replies: 1
    Last Post: 7 Jan 2013, 9:19 AM
  2. Replies: 3
    Last Post: 16 Apr 2012, 6:11 AM
  3. Tooltip on button avoids clicking on button
    By d.raval in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 15 Jul 2010, 2:32 AM
  4. Leave multi-line message box opened after clicking OK
    By Royan in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 26 Nov 2007, 9:10 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •