Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Add tests for pause and resume recording (#1165)
Browse files Browse the repository at this point in the history
Co-authored-by: Pooja Nagpal <[email protected]>
  • Loading branch information
p-nagpal and Pooja Nagpal authored Jun 25, 2021
1 parent 9f1beba commit b6ef2f4
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 65 deletions.
9 changes: 1 addition & 8 deletions packages/Telephony/Actions/StartRecording.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
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
{
/// <summary>
/// Starts recording the current conversation.
/// </summary>
public class StartRecording : CommandDialog<RecordingStartSettings>
public class StartRecording : CommandDialog
{
/// <summary>
/// Class identifier.
Expand All @@ -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,
};
}

/// <inheritdoc/>
Expand Down
44 changes: 0 additions & 44 deletions packages/Telephony/Common/RecordingStartSettings.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
},
Expand All @@ -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"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
{
"$kind": "Microsoft.Test.AssertReplyActivity",
"assertions": [
"type == 'command'",
]
"type == 'command'",
"name == 'channel/vnd.microsoft.telephony.recording.start'"
]
},
{
"$kind": "Microsoft.Test.UserActivity",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
{
"$kind": "Microsoft.Test.AssertReplyActivity",
"assertions": [
"type == 'command'",
]
"type == 'command'",
"name == 'channel/vnd.microsoft.telephony.recording.start'"
]
},
{
"$kind": "Microsoft.Test.UserSays",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
{
"$kind": "Microsoft.Test.AssertReplyActivity",
"assertions": [
"type == 'command'",
"type == 'command'",
"name == 'channel/vnd.microsoft.telephony.recording.start'"
]
},
{
Expand Down

0 comments on commit b6ef2f4

Please sign in to comment.