Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ tests/data/dialog/g_dialogs
**/.pytest_cache/
ci/outputs.tar.gz
ci/unit_tests/workspace_addjson/main_data/workspace_forAddJsonTest.json
.env
.vscode
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Then set following environment variables

- `WA_USERNAME` (Watson Assistant username - ALWAYS USE INSTANCE DEDICATED FOR TESTING ONLY! ALL CONTENT WILL BE DELETED DURING TESTING PROCESS!)
- `WA_PASSWORD` (Watson Assistant password)
- `WA_WORKSPACES_API_URL` (`https://.../assistant/api/v1/workspaces`)
- `CLOUD_FUNCTIONS_USERNAME` (Cloud Functions username)
- `CLOUD_FUNCTIONS_PASSWORD` (Cloud Functions password)
- `CLOUD_FUNCTIONS_URL` (Cloud Functions namespace - it should contain `https://` at the beginning and `/api/v1/namespaces` at the end)
Expand Down
10 changes: 7 additions & 3 deletions ci/app_tests/convertWorkspaceBackAndForth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class TestConvertWorkspaceBackAndForth(BaseTestCaseCapture):

dataBasePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'convertWorkspaceBackAndForth_data' + os.sep)
dataBasePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'convertWorkspaceBackAndForth_data')
testOutputPath = os.path.join(dataBasePath, 'outputs')

def setup_class(cls):
Expand All @@ -48,7 +48,11 @@ def test_basic(self, dialogFilename):
f.write(self.captured.out)

# convert xml back to json
self.t_fun_noException(dialog_xml2json.main, [['-dm', dialogXmlPath, '-of', self.testOutputPath, '-od', dialogFilename, '-c', configPath, '-v']])
self.t_fun_noException(dialog_xml2json.main, [['-dm', dialogXmlPath,
'-of', self.testOutputPath,
'-od', dialogFilename,
'-c', configPath,
'-v']])

# compare dialogs if they are same
self.t_fun_exitCode(compare_dialogs.main, 0, [[dialogJsonRefPath, dialogJsonHypPath]])
self.t_fun_exitCode(compare_dialogs.main, 0, [[dialogJsonRefPath, dialogJsonHypPath, '--verbose']])
6 changes: 6 additions & 0 deletions ci/app_tests/generateAndTestWorkspace_data/dialogs/music.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<node name="generalContext_musicPlay">
<condition>#ui-musicPlay</condition>
<goto>
<behavior>skip_user_input</behavior>
<target>generalContext_musicPlay_1stChild</target>
<selector>condition</selector>
</goto>
Expand Down Expand Up @@ -68,6 +69,7 @@
<sa name="sa-musicPlay"/>
</output>
<goto>
<behavior>skip_user_input</behavior>
<target>musicPlayingSong</target>
<selector>user_input</selector>
</goto>
Expand All @@ -78,6 +80,7 @@
<sa name="sa-musicSearch"/>
</output>
<goto>
<behavior>skip_user_input</behavior>
<target>musicList</target>
<selector>user_input</selector>
</goto>
Expand All @@ -87,6 +90,7 @@
<sa name="sa-musicPlay"/>
</output>
<goto>
<behavior>skip_user_input</behavior>
<target>musicPlayingSong</target>
<selector>user_input</selector>
</goto>
Expand Down Expand Up @@ -130,6 +134,7 @@
<sa name="sa-musicPlay"/>
</output>
<goto>
<behavior>skip_user_input</behavior>
<target>musicPlayingSong</target>
<selector>user_input</selector>
</goto>
Expand All @@ -140,6 +145,7 @@
<sa name="sa-musicPlay"/>
</output>
<goto>
<behavior>skip_user_input</behavior>
<target>musicPlayingSong</target>
<selector>user_input</selector>
</goto>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<type>response_condition</type>
</node>
<node name="frame_8727368180957184" title="bed962c8212f5d83b19baf9824add368">
<type>frame</type>
<slots>
<slot name="slot_1_6280101954060288" title="157869116c40536f941e9538a38dc298"/>
</slots>
<nodes>
<node name="slot_1_6280101954060288" title="157869116c40536f941e9538a38dc298">
<type>slot</type>
</node>
<node name="notype_3060600670257152" title="cad3c356ca5d5fb69e869bf090750fad">
<condition>anything_else</condition>
</node>
Expand All @@ -19,10 +18,9 @@
</node>
</nodes>
</node>
<node name="event_handler_6116417732608000" title="fb5d0979513c52c9b39501225df54e07">
<type>event_handler</type>
<event_name>filled</event_name>
</node>
</nodes>
<handlers>
<handler name="event_handler_6116417732608000" title="fb5d0979513c52c9b39501225df54e07" eventName="filled"/>
</handlers>
</node>
</nodes>
85 changes: 85 additions & 0 deletions ci/unit_tests/dialog_json2xml/main_data/expectedSlotsValid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<nodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node name="frame_test">
<condition>#DESIRES_FRIEND</condition>
<slots>
<slot name="node_0" variable="name">
<handlers>
<handler name="node_1" eventName="focus">
<output>
<text>Say your first name.</text>
</output>
</handler>
<handler name="node_2" eventName="input">
<condition>@name</condition>
<context>
<name>@name</name>
</context>
</handler>
<handler name="node_3" eventName="filled">
<output>
<text>Thank you, @name.</text>
</output>
</handler>
<handler name="node_4" eventName="nomatch">
<output>
<text>Please say your first name.</text>
</output>
</handler>
</handlers>
</slot>
<slot name="node_5" variable="age">
<handlers>
<handler name="node_6" eventName="focus">
<output>
<text>Say your age in years.</text>
</output>
</handler>
<handler name="node_7" eventName="input">
<condition>@sys-number</condition>
<context>
<age>@sys-number</age>
</context>
</handler>
<handler name="node_8" eventName="filled">
<output>
<text>You are @sys-number years old.</text>
</output>
</handler>
<handler name="node_9" eventName="nomatch">
<output>
<text>Please say your age in years.</text>
</output>
</handler>
</handlers>
</slot>
</slots>
<handlers>
<handler name="node_10" eventName="focus">
<output>
<text>Tell me your first name and age in years and I will find a friend for you.</text>
</output>
</handler>
<handler name="node_11" eventName="generic">
<condition>@sys-date</condition>
<output>
<text>Today is nice weather, isn't it?</text>
</output>
</handler>
<handler name="node_12" eventName="generic">
<condition>#ALL_ABOUT_ME_WHAT_DO_YOU_LIKE_TO_DO_FOR_FUN_</condition>
<output>
<textValues>
<selection_policy>sequential</selection_policy>
<values>I enjoy hiking</values>
<values>I love swimming?</values>
</textValues>
</output>
</handler>
</handlers>
<output>
<text>I will find some friend for you, $name.</text>
</output>
<digress_out_slots>allow_returning</digress_out_slots>

</node>
</nodes>
142 changes: 142 additions & 0 deletions ci/unit_tests/dialog_json2xml/main_data/inputSlotsValid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
[
{
"conditions": "#DESIRES_FRIEND",
"dialog_node": "frame_test",
"digress_out_slots": "allow_returning",
"output": {
"text": "I will find some friend for you, $name."
},
"type": "frame"
},
{
"dialog_node": "node_0",
"parent": "frame_test",
"type": "slot",
"variable": "name"
},
{
"dialog_node": "node_1",
"event_name": "focus",
"output": {
"text": "Say your first name."
},
"parent": "node_0",
"type": "event_handler"
},
{
"conditions": "@name",
"context": {
"name": "@name"
},
"dialog_node": "node_2",
"event_name": "input",
"parent": "node_0",
"previous_sibling": "node_1",
"type": "event_handler"
},
{
"dialog_node": "node_3",
"event_name": "filled",
"output": {
"text": "Thank you, @name."
},
"parent": "node_0",
"previous_sibling": "node_2",
"type": "event_handler"
},
{
"dialog_node": "node_4",
"event_name": "nomatch",
"output": {
"text": "Please say your first name."
},
"parent": "node_0",
"previous_sibling": "node_3",
"type": "event_handler"
},
{
"dialog_node": "node_5",
"parent": "frame_test",
"previous_sibling": "node_0",
"type": "slot",
"variable": "age"
},
{
"dialog_node": "node_6",
"event_name": "focus",
"output": {
"text": "Say your age in years."
},
"parent": "node_5",
"type": "event_handler"
},
{
"conditions": "@sys-number",
"context": {
"age": "@sys-number"
},
"dialog_node": "node_7",
"event_name": "input",
"parent": "node_5",
"previous_sibling": "node_6",
"type": "event_handler"
},
{
"dialog_node": "node_8",
"event_name": "filled",
"output": {
"text": "You are @sys-number years old."
},
"parent": "node_5",
"previous_sibling": "node_7",
"type": "event_handler"
},
{
"dialog_node": "node_9",
"event_name": "nomatch",
"output": {
"text": "Please say your age in years."
},
"parent": "node_5",
"previous_sibling": "node_8",
"type": "event_handler"
},
{
"dialog_node": "node_10",
"event_name": "focus",
"output": {
"text": "Tell me your first name and age in years and I will find a friend for you."
},
"parent": "frame_test",
"previous_sibling": "node_5",
"type": "event_handler"
},
{
"conditions": "@sys-date",
"dialog_node": "node_11",
"event_name": "generic",
"output": {
"text": "Today is nice weather, isn't it?"
},
"parent": "frame_test",
"previous_sibling": "node_10",
"type": "event_handler"
},
{
"conditions": "#ALL_ABOUT_ME_WHAT_DO_YOU_LIKE_TO_DO_FOR_FUN_",
"dialog_node": "node_12",
"event_name": "generic",
"output": {
"text": {
"selection_policy": "sequential",
"values": [
"I enjoy hiking",
"I love swimming?"
]
}
},
"parent": "frame_test",
"previous_sibling": "node_11",
"type": "event_handler"
}
]
Loading