codeforequity-at / botium-core

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

links.add is not a function #272

Closed jakuste136 closed 5 years ago

jakuste136 commented 5 years ago

I'm having below issue using botium-asserter-basiclink.

Error: tools/open-gap-portal/Line 11: assertion error - TypeError: links.add is not a function at BasicLinkAsserter.assertConvoStep (C:\Temp\Botium-test\node_modules\botium-asserter-basiclink\src\BasicLinkAsserter.js:14:13) at p (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:113:61) at Promise (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:17:13) at new Promise () at p (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:15:19) at asserters.filter.map.a (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:113:17) at Array.map () at ScriptingProvider._createAsserterPromises (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:113:8) at ScriptingProvider.assertConvoStep (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\ScriptingProvider.js:63:21) at scriptingEvents.onBotStart.then.then (C:\Temp\Botium-test\node_modules\botium-core\src\scripting\Convo.js:338:36) TranscriptError: Error: tools/open-gap-portal/Line 11: assertion error - TypeError: links.add is not a function at BasicLinkAsserter.assertConvoStep (node_modules\botium-asserter-basiclink\src\BasicLinkAsserter.js:14:13) at p (node_modules\botium-core\src\scripting\ScriptingProvider.js:113:61) at Promise (node_modules\botium-core\src\scripting\ScriptingProvider.js:17:13) at new Promise () at p (node_modules\botium-core\src\scripting\ScriptingProvider.js:15:19) at asserters.filter.map.a (node_modules\botium-core\src\scripting\ScriptingProvider.js:113:17) at Array.map () at ScriptingProvider._createAsserterPromises (node_modules\botium-core\src\scripting\ScriptingProvider.js:113:8) at ScriptingProvider.assertConvoStep (node_modules\botium-core\src\scripting\ScriptingProvider.js:63:21) at scriptingEvents.onBotStart.then.then (node_modules\botium-core\src\scripting\Convo.js:338:36) at async.waterfall (node_modules\botium-core\src\scripting\Convo.js:207:25) at C:\Temp\Botium-test\node_modules\async\dist\async.js:473:16 at next (node_modules\async\dist\async.js:5329:29) at C:\Temp\Botium-test\node_modules\async\dist\async.js:969:16 at runConversation (node_modules\botium-core\src\scripting\Convo.js:185:15) at async.mapSeries (node_modules\botium-core\src\scripting\Convo.js:376:9) at C:\Temp\Botium-test\node_modules\async\dist\async.js:1140:9 at C:\Temp\Botium-test\node_modules\async\dist\async.js:473:16 at iterateeCallback (node_modules\async\dist\async.js:988:17) at C:\Temp\Botium-test\node_modules\async\dist\async.js:969:16 at C:\Temp\Botium-test\node_modules\async\dist\async.js:1137:13 at convoStepDone (node_modules\botium-core\src\scripting\Convo.js:251:11) at scriptingEvents.assertConvoStep.then.then.catch (node_modules\botium-core\src\scripting\Convo.js:348:19)

I've looked at BasicLinkAsserter.js and it looks like you're using add function on the Array object which is a Set class prototype according to this article.

Changing add to push solves the problem.

stefan-sev commented 5 years ago

Hey @jakuste136 I fixed it with this PR https://github.com/codeforequity-at/botium-asserter-basiclink/pull/3. You should find it in npm with version 0.0.4 as soon as the build is done and published.

jakuste136 commented 5 years ago

Hello @stefan-sev. Thanks for a quick response. Unfortunately there is another problem. It looks like function "has()" doesn't support fat arrow expression, only explicit values. See here, console.log(set1.has(x => x==1)); won't work.

stefan-sev commented 5 years ago

you are right my mistake fast fix are not good :P I have changed it and build a new version. You should find it in npm. version is 0.0.5.