Skip to content

Test doesnt work with repromt, why? #43

@falent

Description

@falent

It is strange. For example intent 'AMAZON.StopIntent' pass the test but every test I am expecting that alexa repeat the question fails :(

HelloWorldIntent:

module.exports = {
  'canHandle': (handlerInput) => {
    return handlerInput.requestEnvelope.request.type === 'IntentRequest'
      && handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent';
  },
  'handle': (handlerInput) => {
    const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
    const speakOutput = requestAttributes.t(('WELCOME'));
    const speakRepeat = requestAttributes.t(('REPEAT'));
    return handlerInput.responseBuilder
        .speak(speakOutput)
        .reprompt(speakRepeat)
        .getResponse();
  },
};

test:

alexaTest.initialize(
    require('../awsAdapter'),
    'amzn1.ask.skill.00000000-0000-0000-0000-000000000000',
    'amzn1.ask.account.VOID');
const textResources = require('../localization/translations.js');
alexaTest.initializeI18N(textResources);
const supportedLocales = ['en-US', 'de-DE'];
for (let i = 0; i < supportedLocales.length; i++) {
  const locale = supportedLocales[i];
  alexaTest.setLocale(locale);
  describe('skill tests', function() {
  // tests the behavior of the skill's HelloWorldIntent
    describe('CancelAndStopIntentIntent', () => {
      alexaTest.test([
        {
          request: alexaTest.getIntentRequest('AMAZON.CancelIntent'),
          says: alexaTest.t('STOP_ANSWER'), shouldEndSession: true,
        },
      ]);
    });
    describe('HelloWorldI ntent', function() {
      alexaTest.test([
        {
          request: alexaTest.getIntentRequest('HelloWorldIntent'),
          says: alexaTest.t('WELCOME'),
          reprompt: alexaTest.t('REPEAT'),
          repromptsNothing: false, shouldEndSession: false,
        },
      ]);
    });
  });
};

Output:

1)

 skill tests
       HelloWorldI ntent
         returns the correct responses:
     AssertionError: Request #1 (HelloWorldIntent): Possible Certification Problem: The response keeps the session open but does not contain a question mark.
      at Object._assert (/home/alexa/Templates/newAlexa/node_modules/alexa-skill-test-framework/index.js:845:9)
      at CallbackContext.assert (/home/alexa/Templates/newAlexa/node_modules/alexa-skill-test-framework/index.js:39:17)
      at CallbackContext._questionMarkCheck (/home/alexa/Templates/newAlexa/node_modules/alexa-skill-test-framework/index.js:64:8)
      at ctx.Promise.then.response (/home/alexa/Templates/newAlexa/node_modules/alexa-skill-test-framework/index.js:728:17)
      at <anonymous>

Could somebody help me please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions