Quantcast
Channel: Adobe Community : Popular Discussions - FlexUnit
Viewing all articles
Browse latest Browse all 25673

I am writting a test using a sequencer to test for multiple button click

$
0
0

I'm using flex sdk 4.1 and have a situation where a  button click is sometimes called twice. I am writting a test for this using a sequencer and it will run for at least one button click, what I am not sure is how to test for multiple click events(which shouldn't happen, but occours randomly in my project)

 

package tests.view
{
    import flash.events.MouseEvent;
   
    import flexunit.framework.Assert;
   
    import mx.events.FlexEvent;
   
    import org.flexunit.async.Async;
    import org.fluint.sequence.SequenceEventDispatcher;
    import org.fluint.sequence.SequenceRunner;
    import org.fluint.sequence.SequenceWaiter;
    import org.fluint.uiImpersonation.UIImpersonator;
   
    import views.AddComments;
   
    public class TestAddComments
    {       
       
        private var view:AddComments;
       
        [Before(async,ui)]
        public function setUp() : void
        {
            view = new AddComments;
            Async.proceedOnEvent( this, view, FlexEvent.CREATION_COMPLETE, 600 );
            UIImpersonator.addChild( view );
        }
       
       
        [Test]
        public function testButtonClick():void
        {
            view.addCommentBtn
            var sequence:SequenceRunner = new SequenceRunner( this );
           
           
            sequence.addStep( new SequenceEventDispatcher( view.addCommentBtn, new MouseEvent( 'click', true, false ) ) );
            sequence.addStep( new SequenceWaiter( view.addCommentBtn, MouseEvent.CLICK, 100 ) );
            sequence.run();
        }
    }
}


Viewing all articles
Browse latest Browse all 25673

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>