vendredi 16 juin 2017

Cucumber/Javascript "Cannot read property 'call' of undefined" creating custom world

I want to centralise spawning a browser for tests.

'use strict';
require('chromedriver');
var cucumber = require('cucumber'),
    webdriver = require('selenium-webdriver'),
    assert = require('assert');

var browsers = {
    chrome: new webdriver.Builder().forBrowser('chrome').build()
};

var CustomWorld = function() {
    this.browsers = browsers;
};

cucumber(function(setWorldConstructor) {
    setWorldConstructor(CustomWorld);
});

Without this (the browser constructor in each step file) I have no problem (other than multiple instances of a browser.

With this the console reports "Cannot read property 'call' of undefined" Can anyone help me see what is wrong here please?

Aucun commentaire:

Enregistrer un commentaire