Created
April 15, 2016 22:37
-
-
Save emilong/9fa5455a85cf21dfa4ae2936c9439e31 to your computer and use it in GitHub Desktop.
Simple protractor framework for running files by require'ing them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.config = { | |
framework: 'custom', | |
frameworkPath: './lib/protractor-require-framework.js', | |
seleniumAddress: 'http://localhost:4444/wd/hub', | |
specs: ['automation/some-protractor-script.js'], | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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