minkphp / MinkZombieDriver

Zombie.js driver for Mink framework
41 stars 49 forks source link

Behat 3 + Mink + Zombie Driver : Error while processing event 'click' (Behat\Mink\Exception\DriverException) #131

Closed vrubiella closed 7 years ago

vrubiella commented 9 years ago

Hi, I have defined this simple background:

$this->visit('/auth/register');
        $this->fillField('name',$name);
        $this->fillField('email',$email);
        $this->fillField('password','password');
        $this->fillField('password_confirmation','password');
        $this->pressButton('Register');

When Scenario runs under "zombie driver", this errors occurs:

Error while processing event 'click' (Behat\Mink\Exception\DriverException)

I edit ZombieDriver.php class to retrieve more error info:

JS:

 browser.fire(pointers[4], "click", function (err) {
        if (err) {
          stream.end(JSON.stringify(err.stack));
       } else {
          stream.end();
         }
       });

Error:

ReferenceError: CustomEvent is not defined\n    at HTMLDocument.trigger (http://admin.dev:78/plugins/fastclick/fastclick.min.js:1:8632)\n    at callListeners (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/events.js:202:38)\n    at dispatchPhase (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/events.js:191:13)\n    at HTMLDocument.core.EventTarget.dispatchEvent (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/events.js:289:9)\n    at HTMLDocument.DOM.EventTarget.dispatchEvent (/home/vagrant/node_modules/zombie/lib/dom/jsdom_patches.js:151:31)\n    at HTMLDocument.<anonymous> (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/html.js:459:12)\n    at /home/vagrant/node_modules/jsdom/lib/jsdom/level2/html.js:68:20\n    at Object.item.check (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/html.js:352:11)\n    at Object.item.check (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/html.js:355:23)\n    at Object.item.check (/home/vagrant/node_modules/jsdom/lib/jsdom/level2/html.js:355:23)\n    in http://admin.dev:78/auth/register"

Thank you!.

Note: I'm using Zombie 3.1.1 under NodeJS v0.10.38

aik099 commented 9 years ago

Sounds like problem on JSDom side or even Zombie side. Please report it there.

stof commented 9 years ago

this indeed looks like a bug in JSDom itself.

vrubiella commented 9 years ago

Hello, I remove node modules and reinstall zombie@3 but error persist. I open an issue in Zombie project

https://github.com/assaf/zombie/issues/914

Thank you!

honzalilak commented 9 years ago

Hi, I have the same problem. I tried running this js code to check that it is possible to click a button and this code works well (I extracted variables and made some other changes to highlight the point). Therefore I assume that the problem is in the driver.


var button = 'My Button';
var url = 'http://example.org';
var urlFormSubmitted = 'http://example.org/submitted';

const Browser = require('zombie');
const browser = new Browser();

var visited = function() {
    browser.assert.success();
    browser.pressButton(button);
    browser.assert.url(urlAfterButtonPressed);
}

browser
    .visit(urlFormSubmitted, visited);
aik099 commented 9 years ago

Still an issue with latest Zombie 3.x or Zombie 4.x versions?