Skip to content

Execute hangs when accessing variables from DalekJS scope #118

Open
@hadynz

Description

@hadynz

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions