codeforequity-at / botium-core

The Selenium for Chatbots - Bots Testing Bots
https://www.botium.ai
MIT License
229 stars 64 forks source link

No longer passing actual transcripts to setUserInput #671

Closed rscoates closed 2 years ago

rscoates commented 2 years ago

Describe the bug We had a custom setUserInput that allowed us to use RegEx in our definitions of QR buttons, to account for different times of day. Previously the transcript object that was passed to the setUserInput contained the 'actual' values, having been updated by the line transcript.steps = transcriptSteps.filter(s => s) (currently line 532 in src/scripting/Convo.js) at the end of each loop of the iteration of conversation.

However, since commit 119cd1dcd438120f888cb7e88e02e2fde58bc2db, the transcript.steps = transcriptSteps.filter(s => s) line has moved to the finally block, where it is not called until after the end of the loop that begins on line 278 of src/scripting/Convo.js (previously that code block was called as a callback after each iteration of the mapSeries. This means that during the conversation, the custom setUserInput does not have access to the transcript (which includes the actual values).

To Reproduce Write a custom setUserInput and see that the transcript parameter is an empty array when it is called.

Expected behavior The transcript array should contain the values, rather than be an empty array.

Botium Version Botium Core 1.12.2 (latest)

Proposed Fix Either move the line back into the loop, or update lines 310, 311 and 312 to mirror

await this.scriptingEvents.setUserInput({ convo: this, convoStep, container, scriptingMemory, meMsg, transcript, transcriptStep, transcriptSteps })

(adding transcriptSteps to the ...rest argument)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.