Timeout Occurred before expected event for simple SequenceRunner
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);
}
}
}
