• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Timeout Occurred before expected event for simple SequenceRunner

Enthusiast ,
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

I'm having trouble with these tests. I'm always getting Timeout Occurred for my sequence in the test testOnLogout.

Any ideas?

Timeout Occurred before expected eventTimeout Occurred before expected event
Error: Timeout Occurred before expected event
    at org.flexunit.internals.runners.statements::ExpectAsync/handleAsyncTimeOut()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at org.flexunit.async::AsyncHandler/handleTimeout()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()

      package tests.view
{
   
   
    import flexunit.framework.Assert;
   
    import mx.events.FlexEvent;


    import org.flexunit.async.Async;
import org.fluint.sequence.SequenceRunner;
import org.fluint.sequence.SequenceSetter;
    import org.fluint.sequence.SequenceWaiter;
    import org.fluint.uiImpersonation.UIImpersonator;
   
    import views.LoginForm;
   
    public class TestLoginForm
    {       
       
        private var view:LoginForm;

        [Before(async,ui)]
        public function setUp() : void
        {
            view = new LoginForm;
            Async.proceedOnEvent( this, view, FlexEvent.CREATION_COMPLETE, 600 );
            UIImpersonator.addChild( view );
        }
       
       
        [After(async,ui)]
        public function tearDown():void
        {
            UIImpersonator.removeChild( view );           
            view = null;
        }

       
        [Test(async, ui)]
        public function testOnLogout():void {
            var passThroughData:Object = new Object();
           
            passThroughData.username = 'test';
            passThroughData.password = 'test';
            passThroughData.selectedIndex = 0;

            var sequence:SequenceRunner = new SequenceRunner( this     );
            sequence.addStep( new SequenceSetter( view.username, {text:passThroughData.username} ) );
            sequence.addStep( new SequenceWaiter(view.username, FlexEvent.VALUE_COMMIT, 400 ) );
           
            sequence.addStep( new SequenceSetter( view.password, {text:passThroughData.password} ) );
            sequence.addStep( new SequenceWaiter( view.password, FlexEvent.VALUE_COMMIT, 400 ) );
            sequence.addStep( new SequenceSetter( view.domain, {selectedIndex:passThroughData.selectedIndex} ) );
            sequence.addStep( new SequenceWaiter( view.domain, FlexEvent.VALUE_COMMIT, 400 ) );
           
            view.onLogout();
           
            sequence.addStep( new SequenceWaiter(view.username, FlexEvent.VALUE_COMMIT, 400 ) );
            sequence.addStep( new SequenceWaiter( view.password, FlexEvent.VALUE_COMMIT, 400 ) );
            sequence.addStep( new SequenceWaiter( view.domain, FlexEvent.VALUE_COMMIT, 400 ) );
           
           
           
            sequence.addAssertHandler( handleOnLogout, passThroughData );
           
            sequence.run();
        }

       
        protected function handleOnLogout( passThroughData:Object ):void {
            Assert.assertEquals(
                view.username.text,passThroughData.username,
                view.password.text,passThroughData.password,
                view.domain.selectedIndex,passThroughData.selectedIndex);
        }
       
       
       
    }
}

TOPICS
FlexUnit

Views

3.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 16, 2011 Mar 16, 2011

So, I am taking a guess here that what you want is the onLogout() call to happen as part of the sequence. But this is not what your code does. Sequences are defined and then run when you call the run() method.

Here you are calling the onLogout method in the middle of defining the sequence.. then sometime later (likely after the logout is done) your sequence begins waiting for things to happen... and times out because nothing is happening.

I think what you want here is to use the SequenceCaller cla

...

Votes

Translate

Translate
Advocate ,
Mar 16, 2011 Mar 16, 2011

Copy link to clipboard

Copied

So, I am taking a guess here that what you want is the onLogout() call to happen as part of the sequence. But this is not what your code does. Sequences are defined and then run when you call the run() method.

Here you are calling the onLogout method in the middle of defining the sequence.. then sometime later (likely after the logout is done) your sequence begins waiting for things to happen... and times out because nothing is happening.

I think what you want here is to use the SequenceCaller class to actually execute the onLogout as part of the sequence.

Mike

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 17, 2011 Mar 17, 2011

Copy link to clipboard

Copied

LATEST

thx mike, you mean like this: I'm still getting timeouts

    [Test(async, ui)]
    public function testOnLogout():void {
        var passThroughData:Object = new Object();

        passThroughData.username = 'test';
        passThroughData.password = 'test';
        passThroughData.selectedIndex = 0;

        var sequence:SequenceRunner = new SequenceRunner(this);
        sequence.addStep(new SequenceSetter(view.username, {text:passThroughData.username}));
        sequence.addStep(new SequenceWaiter(view.username, FlexEvent.VALUE_COMMIT, 400));
        sequence.addStep(new SequenceSetter(view.password, {text:passThroughData.password}));
        sequence.addStep(new SequenceWaiter(view.password, FlexEvent.VALUE_COMMIT, 400));
        sequence.addStep(new SequenceSetter(view.domain, {selectedIndex:passThroughData.selectedIndex}));
        sequence.addStep(new SequenceWaiter(view.domain, FlexEvent.VALUE_COMMIT, 400));

        sequence.addStep(new SequenceCaller(view,view.onLogout ));
      
        sequence.addStep(new SequenceWaiter(view.username, FlexEvent.VALUE_COMMIT, 400));
        sequence.addStep(new SequenceWaiter(view.password, FlexEvent.VALUE_COMMIT, 400));
        sequence.addStep(new SequenceWaiter(view.domain, FlexEvent.VALUE_COMMIT, 400));


        sequence.addAssertHandler(handleOnLogout, passThroughData);

        sequence.run();
    }

FYI

    public function onLogout():void
            {
                username.text = '';
                password.text = '';
                domain.selectedIndex = 0;
            }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines