aboutsummaryrefslogtreecommitdiffstats
path: root/docs/config/processors
diff options
context:
space:
mode:
authorJulie2014-02-12 22:47:42 +0000
committerPeter Bacon Darwin2014-02-16 19:03:42 +0000
commitcd508678cd9baffd2bc0c9e11ae724a7b2ff70bb (patch)
treeaed39a3c95c481e875c3dedd43006ffdbe15cf62 /docs/config/processors
parent0f77bd6d0a5c7c4529f5330ece032eea32eca278 (diff)
downloadangular.js-cd508678cd9baffd2bc0c9e11ae724a7b2ff70bb.tar.bz2
chore(protractor-generator): add dgeni processor for protractor
Diffstat (limited to 'docs/config/processors')
-rw-r--r--docs/config/processors/protractor-generate.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/config/processors/protractor-generate.js b/docs/config/processors/protractor-generate.js
new file mode 100644
index 00000000..39c79212
--- /dev/null
+++ b/docs/config/processors/protractor-generate.js
@@ -0,0 +1,45 @@
+var _ = require('lodash');
+var log = require('winston');
+var path = require('canonical-path');
+var trimIndentation = require('dgeni/lib/utils/trim-indentation');
+var code = require('dgeni/lib/utils/code');
+var protractorFolder;
+
+module.exports = {
+ name: 'protractor-generate',
+ description: 'Generate a protractor test file from the e2e tests in the examples',
+ runAfter: ['adding-extra-docs'],
+ runBefore: ['extra-docs-added'],
+ init: function(config, injectables) {
+ protractorFolder = config.get('rendering.protractor.outputFolder', 'ptore2e');
+ },
+ process: function(docs, examples) {
+ _.forEach(examples, function(example) {
+
+ _.forEach(example.files, function(file) {
+
+ // Check if it's a Protractor test.
+ if (!(file.type == 'protractor')) {
+ return;
+ }
+
+ // Create a new file for the test.
+ // TODO - at the moment, only jqLite is being used. Will need to generate
+ // another doc for jQuery if we want to test against that.
+ var protractorDoc = {
+ docType: 'e2e-test',
+ id: 'protractorTest' + '-' + example.id,
+ template: 'protractorTests.template.js',
+ outputPath: path.join(protractorFolder, example.id, 'jqlite' + '_test.js'),
+ innerTest: file.fileContents,
+ pathPrefix: '.', // Hold for if we test with full jQuery
+ exampleId: example.id,
+ description: example.doc.id,
+ examplePath: example.outputFolder + '/index.html'
+ };
+
+ docs.push(protractorDoc);
+ });
+ });
+ }
+};