lundi 11 janvier 2016

Protractor: call a step definition inside another step definition

I have this step definition that check if an element, identified by a CSS selector, is present in the page:

this.Then(/The element with selector "([^"]*)" should be present/, function(elementSelector, callback){
    var selectedElement = element(by.css(elementSelector));

    expect(selectedElement.isPresent()).to.eventually.equal(true, "Can't find the element with selector '" + elementSelector + "' that should be present").and.notify(callback);
 });

I would like to know if it's possible to call this step definition inside another step definition. This approach could be useful, for example, in a step definition used to fill a text area. In this case I would like to know if the text area exists in page before trying to fill it.

Thank you in advance!

Aucun commentaire:

Enregistrer un commentaire