paulgibbs / behat-wordpress-extension

WordHat: Behat for WordPress
https://wordhat.info
GNU General Public License v3.0
106 stars 20 forks source link

Unexpected alert open error #211

Closed ghost closed 6 years ago

ghost commented 6 years ago

Expected behaviour

Alert should be ignored.

Current behavour

Test fails, no screenshots are made.

Possible solution

https://stackoverflow.com/questions/39646444/how-to-handle-a-javascript-alert-window-using-php-behat-mink-selenium2-chrome-we

Steps to reproduce (for bugs)

Not sure if there are reliable way to reproduce it.

Context

This happens after log in to WP website.

Your environment

Docksal dev environment.

ghost commented 6 years ago

This is an error message I am getting:

    Given I am logged in as an admin                                                             # PaulGibbs\WordpressBehatExtension\Context\UserContext::iAmLoggedInAs()
      unexpected alert open: {Alert text : }
        (Session info: headless chrome=67.0.3396.99)
        (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-96-generic x86_64) (WebDriver\Exception\UnexpectedAlertOpen)
paulgibbs commented 6 years ago

Why does your WordPress throw alert() when you log in?

ghost commented 6 years ago

I have no idea, it happens randomly, I was not able manually reproduce this issue. Sometimes it happens not even on the log in step. It is really hard to handle it. I tried different solutions (even redefining window.alert) but they were not helpful.

paulgibbs commented 6 years ago

If you run it in a browser (not headless, so you can see what's going on), what's the content of the alert message, or is it blank?

paulgibbs commented 6 years ago

I'm going to close this because I think something custom is throwing Javascript alerts, and I have no guess at why WordHat might be causing one. We can re-open if we have ideas to track it down more.