codeforequity-at / botium-bindings

The Selenium for Chatbots
http://www.botium.at
MIT License
108 stars 33 forks source link

Correctly catch facebook failed login attempts #86

Closed juananpe closed 6 years ago

juananpe commented 6 years ago

Once in a while, Facebook detects testmybot as a suspicious user and forces us to prove that we are humans (for example, providing our birth date). In those cases, testmybot tests fail with a (IMHO) misleading error like this:

Failures:
1) TestMyBot Test Suite for testmybot-sample-monitoring simplecalc
  Message:
    Failed: Cannot build facebook container: 'Facebook login failed: { error: \'login-approval\', continue: [Function: continue] }'
  Stack:
    Error: Cannot build facebook container: 'Facebook login failed: { error: \'login-approval\', continue: [Function: continue] }'
        at /opt/testmybot/node_modules/botium-core/dist/botium-cjs.js:3145:25
        at /opt/testmybot/node_modules/async/dist/async.js:3874:9
        at /opt/testmybot/node_modules/async/dist/async.js:473:16
        at iterateeCallback (/opt/testmybot/node_modules/async/dist/async.js:976:17)
        at /opt/testmybot/node_modules/async/dist/async.js:958:16
        at /opt/testmybot/node_modules/async/dist/async.js:3871:13
        at /opt/testmybot/node_modules/botium-core/dist/botium-cjs.js:3135:15
        at /opt/testmybot/node_modules/facebook-chat-api/index.js:441:7
        at tryCatcher (/opt/testmybot/node_modules/bluebird/js/main/util.js:26:23)
        at Promise._settlePromiseFromHandler (/opt/testmybot/node_modules/bluebird/js/main/promise.js:510:31)
        at Promise._settlePromiseAt (/opt/testmybot/node_modules/bluebird/js/main/promise.js:584:18)
        at Promise._settlePromises (/opt/testmybot/node_modules/bluebird/js/main/promise.js:700:14)
        at Async._drainQueue (/opt/testmybot/node_modules/bluebird/js/main/async.js:123:16)
        at Async._drainQueues (/opt/testmybot/node_modules/bluebird/js/main/async.js:133:10)
        at Immediate.Async.drainQueues (/opt/testmybot/node_modules/bluebird/js/main/async.js:15:14)
        at runCallback (timers.js:756:18)
  Message:
    Failed: container not available
  Stack:
    Error: container not available
        at TestMyBot.beforeEach (/opt/testmybot/src/testmybot.js:71:29)
        at UserContext.beforeEach (/opt/testmybot/src/helpers/jasmine.js:35:11)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:160:7)

Could we catch the login error before trying the test? (and inform about it accordingly?) This part has confused me for a long time --> "Failed: container not available "

codeforequity-at commented 6 years ago

For me this happens everytime I try to use it from a cloud container (AWS or IBM) - my facebook account is locked immediately.

I agree, the error source should be better visible here.

codeforequity-at commented 6 years ago

Enhanced error message with build 1.4.3