Skip to content

Commit

Permalink
port: resume dialog fix from .net (#3525) (#3535)
Browse files Browse the repository at this point in the history
Fixes #3524
  • Loading branch information
joshgummersall authored Apr 6, 2021
1 parent 5cc26c8 commit f6cd3b0
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SkillConversationIdFactoryOptions } from './skillConversationIdFactoryO
import { SkillConversationReference } from './skillConversationReference';
import { Storage } from '../storage';
import { TurnContext } from '../turnContext';
import { v4 as uuid } from 'uuid';

export class SkillConversationIdFactory extends SkillConversationIdFactoryBase {
constructor(private readonly storage: Storage) {
Expand All @@ -16,12 +17,7 @@ export class SkillConversationIdFactory extends SkillConversationIdFactoryBase {
public async createSkillConversationIdWithOptions(options: SkillConversationIdFactoryOptions): Promise<string> {
const conversationReference = TurnContext.getConversationReference(options.activity);

const skillConversationId = [
options.fromBotId,
options.botFrameworkSkill.appId,
conversationReference.conversation?.id,
conversationReference.channelId,
].join('-');
const skillConversationId = uuid();

const skillConversationReference: SkillConversationReference = {
conversationReference: conversationReference as ConversationReference,
Expand Down
3 changes: 2 additions & 1 deletion libraries/botbuilder-dialogs-adaptive-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"lint": "eslint . --ext .js,.ts",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "yarn build && mocha tests/*.test.js",
"test": "npm-run-all build test:mocha",
"test:mocha": "mocha tests/*.test.js",
"test:compat": "api-extractor run --verbose"
},
"main": "./lib/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,147 +7,151 @@ describe('AdaptiveDialogTests', function () {
resourceExplorer = makeResourceExplorer('AdaptiveDialogTests');
});

it('ActivityAndIntentEvents', async () => {
it('ActivityAndIntentEvents', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ActivityAndIntentEvents');
});

it('ActivityEvents', async () => {
it('ActivityEvents', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ActivityEvents');
});

it('AdaptiveCardSubmit', async () => {
it('AdaptiveCardSubmit', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AdaptiveCardSubmit');
});

it('AllowInterruption', async () => {
it('AllowInterruption', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruption');
});

it('AllowInterruptionAlwaysWithFailedValidation', async () => {
it('AllowInterruptionAlwaysWithFailedValidation', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruptionAlwaysWithFailedValidation');
});

it('AllowInterruptionNever', async () => {
it('AllowInterruptionNever', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruptionNever');
});

it('AllowInterruptionNeverWithInvalidInput', async () => {
it('AllowInterruptionNeverWithInvalidInput', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruptionNeverWithInvalidInput');
});

it('AllowInterruptionNeverWithMaxCount', async () => {
it('AllowInterruptionNeverWithMaxCount', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruptionNeverWithMaxCount');
});

it('AllowInterruptionNeverWithUnrecognizedInput', async () => {
it('AllowInterruptionNeverWithUnrecognizedInput', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_AllowInterruptionNeverWithUnrecognizedInput');
});

it('BeginDialog', async () => {
it('BeginDialog', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_BeginDialog');
});

it('BindingCaptureValueWithinSameAdaptive', async () => {
it('BindingCaptureValueWithinSameAdaptive', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_BindingCaptureValueWithinSameAdaptive');
});

it('BindingOptionsAcrossAdaptiveDialogs', async () => {
it('BindingOptionsAcrossAdaptiveDialogs', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_BindingOptionsAcrossAdaptiveDialogs');
});

it('BindingReferValueInLaterAction', async () => {
it('BindingReferValueInLaterAction', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_BindingReferValueInLaterAction');
});

it('BindingReferValueInNestedAction', async () => {
it('BindingReferValueInNestedAction', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_BindingReferValueInNestedAction');
});

it('ConditionallyAllowInterruptions', async () => {
it('ConditionallyAllowInterruptions', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ConditionallyAllowInterruptions');
});

it('DoActions', async () => {
it('DoActions', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_DoActions');
});

it('EditArray', async () => {
it('EditArray', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_EditArray');
});

it('EmitEventActivityReceived', async () => {
it('EmitEventActivityReceived', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_EmitEventActivityReceived');
});

it('EndTurn', async () => {
it('EndTurn', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_EndTurn');
});

it('IfProperty', async () => {
it('IfProperty', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_IfProperty');
});

it('NestedInlineSequences', async () => {
it('NestedInlineSequences', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_NestedInlineSequences');
});

it('NestedMemoryAccess', async () => {
it('NestedMemoryAccess', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_NestedMemoryAccess');
});

it('NestedRecognizers', async () => {
it('NestedRecognizers', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_NestedRecognizers');
});

it('PropertySetInInterruption', async () => {
it('PropertySetInInterruption', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ParentBotInterruption');
});

it('PropertySetInInterruption', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_PropertySetInInterruption');
});

it('ReplacePlan', async () => {
it('ReplacePlan', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ReplacePlan');
});

it('ReProcessInputProperty', async () => {
it('ReProcessInputProperty', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ReProcessInputProperty');
});

it('ReProcessInputPropertyValidOnlyOnce', async () => {
it('ReProcessInputPropertyValidOnlyOnce', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_ReProcessInputPropertyValidOnlyOnce');
});

it('StringLiteralInExpression', async () => {
it('StringLiteralInExpression', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_StringLiteralInExpression');
});

it('TextInput', async () => {
it('TextInput', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_TextInput');
});

it('TextInputDefaultValueResponse', async () => {
it('TextInputDefaultValueResponse', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_TextInputDefaultValueResponse');
});

it('TextInputNoMaxTurnCount', async () => {
it('TextInputNoMaxTurnCount', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_TextInputNoMaxTurnCount');
});

it('TopLevelFallback', async () => {
it('TopLevelFallback', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_TopLevelFallback');
});

it('TopLevelFallbackMultipleActivities', async () => {
it('TopLevelFallbackMultipleActivities', async function () {
await TestUtils.runTestScript(resourceExplorer, 'AdaptiveDialog_TopLevelFallbackMultipleActivities');
});

it('TestBindingTwoWayAcrossAdaptiveDialogs', async () => {
it('TestBindingTwoWayAcrossAdaptiveDialogs', async function () {
await TestUtils.runTestScript(resourceExplorer, 'TestBindingTwoWayAcrossAdaptiveDialogs');
});

it('TestBindingTwoWayAcrossAdaptiveDialogsDefaultResultProperty', async () => {
it('TestBindingTwoWayAcrossAdaptiveDialogsDefaultResultProperty', async function () {
await TestUtils.runTestScript(resourceExplorer, 'TestBindingTwoWayAcrossAdaptiveDialogsDefaultResultProperty');
});

it('TestForeachWithPrompt', async () => {
it('TestForeachWithPrompt', async function () {
await TestUtils.runTestScript(resourceExplorer, 'TestForeachWithPrompt');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"$schema": "../../../tests.schema",
"$kind": "Microsoft.Test.Script",
"dialog": {
"$kind": "Microsoft.AdaptiveDialog",
"id": "AdaptiveDialog",
"recognizer": {
"$kind": "Microsoft.RegexRecognizer",
"intents": [
{
"intent": "dialoga",
"pattern": "(?i)dialoga"
},
{
"intent": "dialogb",
"pattern": "(?i)dialogb"
}
]
},
"triggers": [
{
"$kind": "Microsoft.OnIntent",
"intent": "dialoga",
"actions": [
{
"$kind": "Microsoft.BeginDialog",
"dialog": {
"id": "dialogA",
"$kind": "Microsoft.AdaptiveDialog",
"recognizer": {
"$kind": "Microsoft.RegexRecognizer"
},
"triggers": [
{
"$kind": "Microsoft.OnBeginDialog",
"actions": [
{
"$kind": "Microsoft.TextInput",
"allowInterruptions": true,
"property": "dialog.value",
"prompt": "DialogA Prompt"
},
{
"$kind": "Microsoft.SendActivity",
"activity": "DialogA: ${dialog.value}"
}
]
}
]
}
}
]
},
{
"$kind": "Microsoft.OnIntent",
"intent": "dialogb",
"actions": [
{
"$kind": "Microsoft.BeginDialog",
"dialog": {
"$kind": "Microsoft.AdaptiveDialog",
"id": "dialogB",
"recognizer": {
"$kind": "Microsoft.RegexRecognizer"
},
"triggers": [
{
"$kind": "Microsoft.OnBeginDialog",
"actions": [
{
"$kind": "Microsoft.TextInput",
"allowInterruptions": true,
"property": "dialog.value",
"prompt": "DialogB Prompt"
},
{
"$kind": "Microsoft.SendActivity",
"activity": "DialogB: ${dialog.value}"
}
]
}
]
}
}
]
},
{
"$kind": "Microsoft.OnIntent",
"intent": "Santa",
"actions": [
{
"$kind": "Microsoft.SendActivity",
"activity": "I love you santa."
}
]
},
{
"$kind": "Microsoft.OnUnknownIntent",
"actions": [
{
"$kind": "Microsoft.SendActivity",
"activity": "In None..."
}
]
}
],
"autoEndDialog": false,
"defaultResultProperty": "dialog.result"
},
"script": [
{
"$kind": "Microsoft.Test.UserSays",
"text": "dialoga"
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "DialogA Prompt"
},
{
"$kind": "Microsoft.Test.UserSays",
"text": "dialogb"
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "DialogB Prompt"
},
{
"$kind": "Microsoft.Test.UserSays",
"text": "testb"
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "DialogB: testb"
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "DialogA Prompt"
},
{
"$kind": "Microsoft.Test.UserSays",
"text": "testa"
},
{
"$kind": "Microsoft.Test.AssertReply",
"text": "DialogA: testa"
}
]
}
Loading

0 comments on commit f6cd3b0

Please sign in to comment.