From 385b3b7a2052d802ddc5d342ef58f74790caa7a3 Mon Sep 17 00:00:00 2001 From: Pooja Nagpal Date: Thu, 24 Jun 2021 18:13:07 -0700 Subject: [PATCH] Add tests for pause and resume recording --- packages/Telephony/Actions/StartRecording.cs | 9 +--- .../Common/RecordingStartSettings.cs | 44 --------------- .../Recording_BaseScenario.test.dialog | 41 +++++++++++++- ...cording_CommandResultWrongName.test.dialog | 5 +- .../StartRecording_HappyPath.test.dialog | 53 ++++++++++++++++++- ...g_IgnoredInNonTelephonyChannel.test.dialog | 28 ++++++++-- ...thTangent_InterruptionDisabled.test.dialog | 5 +- ...ithTangent_InterruptionEnabled.test.dialog | 3 +- 8 files changed, 123 insertions(+), 65 deletions(-) delete mode 100644 packages/Telephony/Common/RecordingStartSettings.cs diff --git a/packages/Telephony/Actions/StartRecording.cs b/packages/Telephony/Actions/StartRecording.cs index 366e204148..82d2a5c3f9 100644 --- a/packages/Telephony/Actions/StartRecording.cs +++ b/packages/Telephony/Actions/StartRecording.cs @@ -7,7 +7,6 @@ using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Components.Telephony.Common; using Microsoft.Bot.Connector; -using Microsoft.Bot.Schema.Telephony; using Newtonsoft.Json; namespace Microsoft.Bot.Components.Telephony.Actions @@ -15,7 +14,7 @@ namespace Microsoft.Bot.Components.Telephony.Actions /// /// Starts recording the current conversation. /// - public class StartRecording : CommandDialog + public class StartRecording : CommandDialog { /// /// Class identifier. @@ -38,12 +37,6 @@ public StartRecording([CallerFilePath] string sourceFilePath = "", [CallerLineNu this.RegisterSourceLocation(sourceFilePath, sourceLineNumber); this.CommandName = RecordingStart; - - this.Data = new RecordingStartSettings() - { - RecordingChannelType = RecordingChannelType.Mixed, - RecordingContentType = RecordingContentType.AudioVideo, - }; } /// diff --git a/packages/Telephony/Common/RecordingStartSettings.cs b/packages/Telephony/Common/RecordingStartSettings.cs deleted file mode 100644 index 8c64845714..0000000000 --- a/packages/Telephony/Common/RecordingStartSettings.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Microsoft.Bot.Schema.Telephony -{ - public enum RecordingContentType - { - /// - /// Record audio. - /// - Audio, - - /// - /// Record audio and video. - /// - AudioVideo - } - - public enum RecordingChannelType - { - /// - /// Mixed recording channel. - /// - Mixed, - - /// - /// Unmixed recording channel. - /// - Unmixed - } - - public class RecordingStartSettings - { - /// - /// Gets or sets the for the current recording action. - /// - public RecordingContentType RecordingContentType { get; set; } - - /// - /// Gets or sets the for the current recording action. - /// - public RecordingChannelType RecordingChannelType { get; set; } - } -} \ No newline at end of file diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/Recording_BaseScenario.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/Recording_BaseScenario.test.dialog index 81be53b22c..34595cf682 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/Recording_BaseScenario.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/Recording_BaseScenario.test.dialog @@ -13,6 +13,21 @@ { "$kind": "Microsoft.SendActivity", "activity": "Started recording!" + }, + { + "$kind": "Microsoft.SendActivity", + "activity": "Enter your account number." + }, + { + "$kind": "Microsoft.Telephony.PauseRecording", + "allowInterruptions": "=coalesce(settings.allowInterruptions, false)" + }, + { + "$kind": "Microsoft.SendActivity", + "activity": "Paused recording!" + }, + { + "$kind": "Microsoft.EndTurn" } ] }, @@ -25,14 +40,36 @@ "activity": "On help intent handler" } ] + }, + { + "$kind": "Microsoft.OnIntent", + "intent": "AccountIntent", + "actions": [ + { + "$kind": "Microsoft.SendActivity", + "activity": "Your account is active." + }, + { + "$kind": "Microsoft.Telephony.ResumeRecording", + "allowInterruptions": "=coalesce(settings.allowInterruptions, false)" + }, + { + "$kind": "Microsoft.SendActivity", + "activity": "Resumed recording!" + } + ] } ], "recognizer": { "$kind": "Microsoft.RegexRecognizer", "intents": [ { - "intent": "HelpIntent", - "pattern": "help" + "intent": "HelpIntent", + "pattern": "help" + }, + { + "intent": "AccountIntent", + "pattern": "account" } ] } diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_CommandResultWrongName.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_CommandResultWrongName.test.dialog index d855a45db4..1f5906f26d 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_CommandResultWrongName.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_CommandResultWrongName.test.dialog @@ -10,8 +10,9 @@ { "$kind": "Microsoft.Test.AssertReplyActivity", "assertions": [ - "type == 'command'", - ] + "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.start'" + ] }, { "$kind": "Microsoft.Test.UserActivity", diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_HappyPath.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_HappyPath.test.dialog index a6f727ec3c..22d1ff517f 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_HappyPath.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_HappyPath.test.dialog @@ -7,22 +7,71 @@ "$kind": "Microsoft.Test.UserSays", "text": "Hello I'm Calculon" }, + { + "$kind": "Microsoft.Test.AssertReplyActivity", + "assertions": [ + "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.start'" + ] + }, + { + "$kind": "Microsoft.Test.UserActivity", + "activity": { + "type": "commandResult", + "name": "channel/vnd.microsoft.telephony.recording.start" + } + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Started recording!" + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Enter your account number." + }, { "$kind": "Microsoft.Test.AssertReplyActivity", "assertions": [ "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.pause'" ] }, { "$kind": "Microsoft.Test.UserActivity", "activity": { "type": "commandResult", - "name": "channel/vnd.microsoft.telephony.recording.start" + "name": "channel/vnd.microsoft.telephony.recording.pause" } }, { "$kind": "Microsoft.Test.AssertReply", - "text": "Started recording!" + "text": "Paused recording!" + }, + { + "$kind": "Microsoft.Test.UserSays", + "text": "account" + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Your account is active." + }, + { + "$kind": "Microsoft.Test.AssertReplyActivity", + "assertions": [ + "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.resume'" + ] + }, + { + "$kind": "Microsoft.Test.UserActivity", + "activity": { + "type": "commandResult", + "name": "channel/vnd.microsoft.telephony.recording.resume" + } + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Resumed recording!" } ] } \ No newline at end of file diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_IgnoredInNonTelephonyChannel.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_IgnoredInNonTelephonyChannel.test.dialog index efaea32878..a3763c5907 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_IgnoredInNonTelephonyChannel.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_IgnoredInNonTelephonyChannel.test.dialog @@ -4,12 +4,32 @@ "dialog": "Recording_BaseScenario.test", "script": [ { - "$kind": "Microsoft.Test.UserSays", - "text": "Hello I'm Bender" + "$kind": "Microsoft.Test.UserSays", + "text": "Hello I'm Bender" }, { - "$kind": "Microsoft.Test.AssertReply", - "text": "Started recording!" + "$kind": "Microsoft.Test.AssertReply", + "text": "Started recording!" + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Enter your account number." + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Paused recording!" + }, + { + "$kind": "Microsoft.Test.UserSays", + "text": "account" + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Your account is active." + }, + { + "$kind": "Microsoft.Test.AssertReply", + "text": "Resumed recording!" } ] } \ No newline at end of file diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionDisabled.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionDisabled.test.dialog index cca25d7426..8b15a0dffc 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionDisabled.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionDisabled.test.dialog @@ -10,8 +10,9 @@ { "$kind": "Microsoft.Test.AssertReplyActivity", "assertions": [ - "type == 'command'", - ] + "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.start'" + ] }, { "$kind": "Microsoft.Test.UserSays", diff --git a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionEnabled.test.dialog b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionEnabled.test.dialog index 3074f5d77e..739e5f9dff 100644 --- a/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionEnabled.test.dialog +++ b/tests/packages/Microsoft.Bot.Components.Telephony.Tests/Integration/RecordingTests/StartRecording_WithTangent_InterruptionEnabled.test.dialog @@ -10,7 +10,8 @@ { "$kind": "Microsoft.Test.AssertReplyActivity", "assertions": [ - "type == 'command'", + "type == 'command'", + "name == 'channel/vnd.microsoft.telephony.recording.start'" ] }, {