Reputation: 11642
I was trying to find some cases of using Yadda (with Jasmine or some other fw) and Protractor but with no luck. Does anybody have experience with it?
Upvotes: 3
Views: 297
Reputation: 11642
Ok, I am answering my own question.
Step 1 - define specs for protractor conf file:
specs: ['test/yadda-runner.js']
Step 2 - create 'test/yadda-runner.js'
var exports = module.exports = {};
exports.runner = (function () {
var Yadda = require('yadda');
Yadda.plugins.jasmine.StepLevelPlugin.init();
new Yadda.FeatureFileSearch('./test/features').each(function foundFeatureFiles(file) {
featureFile(file, function test(feature) {
var a = file.match(/[a-zA-Z0-9-_]*\.feature/gi)[0],
name = a.replace(".feature","");
var definitions = require('./definitions/' + name + '-steps.js');
var yadda = Yadda.createInstance(definitions);
scenarios(feature.scenarios, function execute(scenario) {
steps(scenario.steps, function executeStep(step) {
yadda.run(step);
});
});
});
});
}());
Step 3 - Create your feature and step files
"test/features/bottles.feature" -> "test/definitions/bottles-steps.js"
Upvotes: 4