alexa-skill-test-framework icon indicating copy to clipboard operation
alexa-skill-test-framework copied to clipboard

STATE seems to be ignored

Open ellier opened this issue 7 years ago • 3 comments

Forgive me if I'm wrong, but I don't see a way to deal with different states. I'm talking about this:

Alexa.CreateStateHandler(States.READY, { // handlers here })

ellier avatar Mar 17 '17 02:03 ellier

The alexa-skills-kit-sdk-for-nodejs that provides that state logic just stores the state as a session attribute and does the routing internally. The test framework support persisting the session attributes, so it should work fine. Have you tried it out? I'll write up an example when I get a chance.

BrianMacIntosh avatar Mar 22 '17 02:03 BrianMacIntosh

I have attempted setting state through session, and I am not having success with these attempts being recognized as state changes in my Mocha tests. The following are my attempts that were placed within describe() blocks and before alexa.test([]) blocks...

Through underlying alexa-sdk handler: alexaTest.index.handler.state = '_STARTMODE';

Through request object's session:

        var tState = alexaTest.getIntentRequest('Unhandled')
        tState.session.attributes['STATE'] = '_STARTMODE';

Any other thoughts on how state could be setting through the test framework would be greatly appreciated.

mwklein avatar Jul 24 '17 13:07 mwklein

@mwklein I'm setting the current state for each test with

alexaTest.test([
    {
        withStoredAttributes: {
          STATE: states.MY_STATE
        },
        // ...
    }
]);

this works for my cases because I'm using dynamodb to store session data.

Pindar avatar Feb 17 '18 13:02 Pindar