Skip to content

Instantly share code, notes, and snippets.

@emilong
Created April 15, 2016 22:37
Show Gist options
  • Save emilong/9fa5455a85cf21dfa4ae2936c9439e31 to your computer and use it in GitHub Desktop.
Save emilong/9fa5455a85cf21dfa4ae2936c9439e31 to your computer and use it in GitHub Desktop.
Simple protractor framework for running files by require'ing them
exports.config = {
framework: 'custom',
frameworkPath: './lib/protractor-require-framework.js',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['automation/some-protractor-script.js'],
};
module.exports = {
run: function(runner, specs) {
const specResults = [];
const failedCount = 0;
return runner.runTestPreparer()
.then(function() {
specs.forEach((spec) => {
const start = +new Date();
try {
require(spec)
specResults.push({
description: spec,
assertions: [{ passed: true }],
duration: +new Date() - start
});
} catch(err) {
failedCount += 1;
specResults.push({
description: spec,
assertions: [{ passed: false }],
duration: +new Date() - start
});
}
});
})
.then(() => {
return {
failedCount,
specResults
};
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment