actions-on-google / actions-on-google-testing-nodejs

Apache License 2.0
75 stars 18 forks source link

Avoid cancel when mic closed + update node to v10 #50

Closed adamcohenrose closed 4 years ago

adamcohenrose commented 4 years ago

It appears that AoG has changed how it behaves when given input outside of the action. Previously it would ignore that input and leave the conversation closed. Now it appears to open a new conversation which confuses the tests.

Consequently, always saying "cancel" after every test will cause problems when there are multiple tests in a single file.

This PR detects when the mic is closed and skips saying "cancel" if so.

Another change that appears to have happened to AoG is that the debug_info content is no longer being returned. This means that much of the content (including the previous flag for the microphone being closed!) is no longer available.

This PR grabs the microphone_mode value from the dialog_state_out which is still returned to discover if the mic has been closed.

Additional changes in this PR

Added a prepare lifecycle step to package.json so that the project can be used as a dependency straight from a github branch.

Updated node to v10 and typescript output to ES2017 to match -- node 8 is now deprecated and node 10 is the minimum LTS. Completely understand if you want to do the node update as a separate PR.

Fleker commented 4 years ago

Can this be broken into two smaller commits?

adamcohenrose commented 4 years ago

Sure

adamcohenrose commented 4 years ago

I've left the package.json "prepare" lifecycle on both so I can still use the branches in my dependencies - hope that's ok!