dalekjs / dalek

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

extend test object possible? #115

Open cupito opened 10 years ago

cupito commented 10 years ago

My test cases containing an repeating middle check part and I try to swap this to a separate file.

Everything works fine if I do

module.exports.middleCheck = function(test) {
  return test....;
};

But this leads to a very ugly code

'Do sth' : function(test) {
  test
    .open(url);
  middleCheck(test)
    .doSth()
   done();
};

I am stuck with implementing it as chain part

'Do sth' : function(test) {
  test
    .open(url);
    .middleCheck()
    .doSth()
   done();
};

Is there a possibilty to extend the test object with own defined prototype functions?

asciidisco commented 10 years ago

As for now, this isn't possible (and I also think that the code you posted isn't very ugly though, it actually makes quite clear what is happening, namely an external function call, not using some backed in internal stuff).

But nevertheless, we are talking about adding plugins that allow extending the test object, take a look here -> https://github.com/rodneyrehm/dalek-api#registering-an-action

hadynz commented 10 years ago

@asciidisco is there a way to extend Dalek today without plugins? When do you think that could possible be complete by?

I have an idea for a screenshot comparison plugin (similar to PhantomCSS) for DalekJS... would be great if I can talk about it with you on email or some forum

hadynz commented 9 years ago

Even though this missing feature is going to be covered in the new upcoming Dalek version, I've just released a stop-gap module measure to allow for easy action/assertion registration with the current Dalek framework - https://github.com/hadynz/dalek-pluginize