Skip to content

Commit 6efea7b

Browse files
committed
Ported declarative tests for actions
1 parent 3f00390 commit 6efea7b

File tree

123 files changed

+5242
-1624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+5242
-1624
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**/node_modules
2+
/**/.vscode
3+
/**/tests/*
4+
coverage
5+
.nyc_output
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "../../../../schemas/sdk.schema",
3+
"$kind": "Microsoft.AdaptiveDialog",
4+
"id": "AskNameDialog",
5+
"triggers": [
6+
{
7+
"$kind": "Microsoft.OnBeginDialog",
8+
"actions": [
9+
{
10+
"$kind": "Microsoft.IfCondition",
11+
"condition": "(user.name == null)",
12+
"actions": [
13+
{
14+
"$kind": "Microsoft.TextInput",
15+
"property": "user.name",
16+
"prompt": "Hello, what is your name?",
17+
"unrecognizedPrompt": "How should I call you?",
18+
"invalidPrompt": "That does not soud like a name"
19+
}
20+
]
21+
},
22+
{
23+
"$kind": "Microsoft.SendActivity",
24+
"activity": "Hello @{user.name}, nice to meet you!"
25+
}
26+
]
27+
}
28+
],
29+
"autoEndDialog": true,
30+
"defaultResultProperty": "dialog.result"
31+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"$schema": "../../../../schemas/sdk.schema",
3+
"$kind": "Microsoft.Test.Script",
4+
"dialog": {
5+
"$kind": "Microsoft.AdaptiveDialog",
6+
"id": "planningTest",
7+
"recognizer": {
8+
"$kind": "Microsoft.RegexRecognizer",
9+
"intents": [
10+
{
11+
"intent": "JokeIntent",
12+
"pattern": "joke"
13+
}
14+
]
15+
},
16+
"triggers": [
17+
{
18+
"$kind": "Microsoft.OnBeginDialog",
19+
"actions": [
20+
{
21+
"$kind": "Microsoft.SendActivity",
22+
"activity": "I'm a joke bot. To get started say 'tell me a joke'"
23+
},
24+
{
25+
"$kind": "Microsoft.BeginDialog",
26+
"options": {},
27+
"dialog": "AskNameDialog"
28+
}
29+
]
30+
},
31+
{
32+
"$kind": "Microsoft.OnIntent",
33+
"intent": "JokeIntent",
34+
"actions": [
35+
{
36+
"$kind": "Microsoft.BeginDialog",
37+
"options": {},
38+
"dialog": "TellJokeDialog"
39+
}
40+
]
41+
},
42+
{
43+
"$kind": "Microsoft.OnUnknownIntent",
44+
"actions": [
45+
{
46+
"$kind": "Microsoft.SendActivity",
47+
"activity": "I'm a joke bot. To get started say 'tell me a joke'"
48+
}
49+
]
50+
}
51+
],
52+
"defaultResultProperty": "dialog.result"
53+
},
54+
"script": [
55+
{
56+
"$kind": "Microsoft.Test.UserConversationUpdate"
57+
},
58+
{
59+
"$kind": "Microsoft.Test.AssertReply",
60+
"text": "I'm a joke bot. To get started say 'tell me a joke'"
61+
},
62+
{
63+
"$kind": "Microsoft.Test.AssertReply",
64+
"text": "Hello, what is your name?"
65+
},
66+
{
67+
"$kind": "Microsoft.Test.UserSays",
68+
"text": "Carlos"
69+
},
70+
{
71+
"$kind": "Microsoft.Test.AssertReply",
72+
"text": "Hello Carlos, nice to meet you!"
73+
},
74+
{
75+
"$kind": "Microsoft.Test.UserSays",
76+
"text": "Cool"
77+
},
78+
{
79+
"$kind": "Microsoft.Test.AssertReply",
80+
"text": "I'm a joke bot. To get started say 'tell me a joke'"
81+
}
82+
]
83+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"$schema": "../../../../schemas/sdk.schema",
3+
"$kind": "Microsoft.Test.Script",
4+
"dialog": {
5+
"$kind": "Microsoft.AdaptiveDialog",
6+
"id": "root",
7+
"triggers": [
8+
{
9+
"$kind": "Microsoft.OnBeginDialog",
10+
"actions": [
11+
{
12+
"$kind": "Microsoft.BeginDialog",
13+
"includeActivity": true,
14+
"options": {},
15+
"dialog": {
16+
"$kind": "Microsoft.AdaptiveDialog",
17+
"id": "outer",
18+
"recognizer": {
19+
"$kind": "Microsoft.RegexRecognizer",
20+
"intents": [
21+
{
22+
"intent": "EmitIntent",
23+
"pattern": "emit"
24+
},
25+
{
26+
"intent": "CowboyIntent",
27+
"pattern": "moo"
28+
}
29+
]
30+
},
31+
"triggers": [
32+
{
33+
"$kind": "Microsoft.OnIntent",
34+
"intent": "CowboyIntent",
35+
"actions": [
36+
{
37+
"$kind": "Microsoft.SendActivity",
38+
"activity": "Yippee ki-yay!"
39+
}
40+
]
41+
},
42+
{
43+
"$kind": "Microsoft.OnIntent",
44+
"intent": "EmitIntent",
45+
"actions": [
46+
{
47+
"$kind": "Microsoft.EmitEvent",
48+
"eventName": "CustomEvent",
49+
"bubbleEvent": true
50+
}
51+
]
52+
}
53+
],
54+
"defaultResultProperty": "dialog.result"
55+
}
56+
}
57+
]
58+
},
59+
{
60+
"$kind": "Microsoft.OnCustomEvent",
61+
"event": "CustomEvent",
62+
"actions": [
63+
{
64+
"$kind": "Microsoft.SendActivity",
65+
"activity": "CustomEventFired"
66+
}
67+
]
68+
}
69+
],
70+
"autoEndDialog": true,
71+
"defaultResultProperty": "dialog.result"
72+
},
73+
"script": [
74+
{
75+
"$kind": "Microsoft.Test.UserSays",
76+
"text": "moo"
77+
},
78+
{
79+
"$kind": "Microsoft.Test.AssertReply",
80+
"text": "Yippee ki-yay!"
81+
},
82+
{
83+
"$kind": "Microsoft.Test.UserSays",
84+
"text": "emit"
85+
},
86+
{
87+
"$kind": "Microsoft.Test.AssertReply",
88+
"text": "CustomEventFired"
89+
},
90+
{
91+
"$kind": "Microsoft.Test.UserSays",
92+
"text": "moo"
93+
},
94+
{
95+
"$kind": "Microsoft.Test.AssertReply",
96+
"text": "Yippee ki-yay!"
97+
}
98+
]
99+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"$schema": "../../../../schemas/sdk.schema",
3+
"$kind": "Microsoft.Test.Script",
4+
"dialog": {
5+
"$kind": "Microsoft.AdaptiveDialog",
6+
"id": "planningTest",
7+
"triggers": [
8+
{
9+
"$kind": "Microsoft.OnBeginDialog",
10+
"actions": [
11+
{
12+
"$kind": "Microsoft.ChoiceInput",
13+
"choices": {
14+
"value": [
15+
{
16+
"value": "red"
17+
},
18+
{
19+
"value": "green"
20+
},
21+
{
22+
"value": "blue"
23+
}
24+
]
25+
},
26+
"styles": 2,
27+
"property": "user.color",
28+
"prompt": "Please select a color:",
29+
"unrecognizedPrompt": "Not a color. Please select a color:"
30+
},
31+
{
32+
"$kind": "Microsoft.SendActivity",
33+
"activity": "@{user.color}"
34+
},
35+
{
36+
"$kind": "Microsoft.ChoiceInput",
37+
"choices": {
38+
"value": [
39+
{
40+
"value": "red"
41+
},
42+
{
43+
"value": "green"
44+
},
45+
{
46+
"value": "blue"
47+
}
48+
]
49+
},
50+
"styles": 2,
51+
"alwaysPrompt": true,
52+
"property": "user.color",
53+
"prompt": "Please select a color:",
54+
"unrecognizedPrompt": "Please select a color:"
55+
},
56+
{
57+
"$kind": "Microsoft.SendActivity",
58+
"activity": "@{user.color}"
59+
},
60+
{
61+
"$kind": "Microsoft.ChoiceInput",
62+
"choices": {
63+
"value": [
64+
{
65+
"value": "red"
66+
},
67+
{
68+
"value": "green"
69+
},
70+
{
71+
"value": "blue"
72+
}
73+
]
74+
},
75+
"styles": 2,
76+
"alwaysPrompt": true,
77+
"property": "user.color",
78+
"prompt": "Please select a color:",
79+
"unrecognizedPrompt": "Please select a color:"
80+
},
81+
{
82+
"$kind": "Microsoft.SendActivity",
83+
"activity": "@{user.color}"
84+
}
85+
]
86+
}
87+
],
88+
"defaultResultProperty": "dialog.result"
89+
},
90+
"script": [
91+
{
92+
"$kind": "Microsoft.Test.UserSays",
93+
"text": "hi"
94+
},
95+
{
96+
"$kind": "Microsoft.Test.AssertReply",
97+
"text": "Please select a color: (1) red, (2) green, or (3) blue"
98+
},
99+
{
100+
"$kind": "Microsoft.Test.UserSays",
101+
"text": "asdasd"
102+
},
103+
{
104+
"$kind": "Microsoft.Test.AssertReply",
105+
"text": "Not a color. Please select a color: (1) red, (2) green, or (3) blue"
106+
},
107+
{
108+
"$kind": "Microsoft.Test.UserSays",
109+
"text": "blue"
110+
},
111+
{
112+
"$kind": "Microsoft.Test.AssertReply",
113+
"text": "blue"
114+
},
115+
{
116+
"$kind": "Microsoft.Test.AssertReply",
117+
"text": "Please select a color: (1) red, (2) green, or (3) blue"
118+
},
119+
{
120+
"$kind": "Microsoft.Test.UserSays",
121+
"text": "red"
122+
},
123+
{
124+
"$kind": "Microsoft.Test.AssertReply",
125+
"text": "red"
126+
}
127+
]
128+
}

0 commit comments

Comments
 (0)