dalekjs / dalek

[unmaintained] DalekJS Base framework
MIT License
695 stars 63 forks source link

Execute hangs when accessing variables from DalekJS scope #118

Open hadynz opened 10 years ago

hadynz commented 10 years ago

If an execute function is invoked with a reference to a variable from the DalekJS scope, no error is thrown and DalekJS simply hangs.

var selectors = require('selectors.js');

// Hangs
test.open('http://adomain.com')
   .execute(function () {
    var totalCost = window.document.querySelector(selectors.total_cost);
    this.assert.ok(totalCost.innerText === '20.00', 'Total Cost is correctly formatted');
})
.done();

// Completes Successfully
test.open('http://adomain.com')
   .execute(function (totalCostSelector) {
    var totalCost = window.document.querySelector(totalCostSelector);
    this.assert.ok(totalCost.innerText === '20.00', 'Total Cost is correctly formatted');
}, selectors.total_cost)
.done();

It would be a better developer experience if DalekJS would throw an error with the exact nature of this problem.

Even though the documentation alludes to that execute can be called with parameters, it doesn't explain why that would be necessarily. Will submit a pull request for this for clarification.

asciidisco commented 10 years ago

The problem/situation should be made more obvious in the docs.

askilada commented 9 years ago

What is the status for this one ?