algonauti/ember-g-recaptcha

Seemingly arbitrary test failures: "reCAPTCHA placeholder element must be an element or id"

Closed this issue ยท 6 comments

Many of our sites are using this add-on with Ember 3.20 but are currently stuck on the v0.10.0 due to later versions seeming to cause issues while testing.

A quick example:

not ok 66 Firefox 69.0 - [151 ms] - Acceptance | portfolio-test.js: Navigated to /portfolio-companies and header text is PORTFOLIO
    ---
        actual: >
            [object Object]
        stack: >
            p</<@https://www.gstatic.com/recaptcha/releases/r8jtf1oixV0IGff4hgB4EzDF/recaptcha__en.js:363:325
            renderReCaptcha@http://localhost:7357/assets/vendor.js:121958:40
            didInsertElement/window.__ember_g_recaptcha_onload_callback@http://localhost:7357/assets/vendor.js:122007:14

        message: >
            reCAPTCHA placeholder element must be an element or id
        negative: >
            false
        browser log: |

The major confusion though is that this sort of test failure is inconsistent. For example, if we ran through all the tests again, this specific test might actually pass, whereas another totally different test might suddenly fail with the same error message. We have spent some time in this but are perplexed. Because we are on Ember 3.20, we are also getting some linting failures for being on v0.10.0 which we are simply ignoring for now.

It's possible this is something that has to be solved on our end, but this problem has persisted throughout each of our sites using the ember-g-recaptcha library. I'm not really clear what the issue is but I thought I might at least mention in it here.

@keanedawg I ran into the same issue and I was able to resolve it by clearing the callback at the end of the test. I put this in an afterEach callback:

window.__ember_g_recaptcha_onload_callback = undefined;

Thanks

that fix works for me as well!

Hey guys. @keanedawg @calvinlough

Version 2.x will fix this issue as well.

Thanks a lot for contribution.

@sinankeskin @keanedawg @calvinlough @brunoocasali Published both 2.0.0 and 2.1.0 to npm registry. Thank you guys, and sorry for huge delay.

FYI @mateusalexandre you can remove your github branch link ๐ŸŽ‰

Awesome @brunoocasali! Thanks for letting me know