Using Yadda's Protractor
I tried to find some examples of using Yadda (using Jasmine or another fw) and Protractor but no luck. Anyone have any experience?
+3
source to share
1 answer
Okay, I'm answering my own question.
Step 1 - defining specifications for the 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 functions and step files
"test / features / bottles .feature" -> "tests / definitions / bottles -steps.js"
+4
source to share