This repository has been archived by the owner on Dec 15, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gruntfile task with Hello World test.
- Loading branch information
Showing
8 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
npm-debug.log |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
function loadConfig(path) { | ||
var glob = require('glob'); | ||
var object = {}; | ||
var key; | ||
|
||
glob.sync('*', {cwd: path}).forEach(function(option) { | ||
key = option.replace(/\.js$/,''); | ||
object[key] = require(path + option); | ||
}); | ||
|
||
return object; | ||
} | ||
|
||
module.exports = function(grunt) { | ||
// load all grunt tasks | ||
require('load-grunt-tasks')(grunt); | ||
grunt.loadTasks('tasks'); | ||
|
||
var config = { | ||
pkg: grunt.file.readJSON('package.json'), | ||
env: process.env | ||
}; | ||
|
||
grunt.util._.extend(config, loadConfig('./tasks/options/')); | ||
grunt.initConfig(config); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"astrolabe": "~0.3.0-alpha", | ||
"glob": "~3.2.7", | ||
"lodash": "~2.3.0", | ||
"load-grunt-tasks": "~0.2.0", | ||
"protractor": "~0.12.1", | ||
"grunt-shell": "~0.5.0" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var grunt = require('grunt'); | ||
|
||
module.exports = { | ||
protractor: { | ||
options: { | ||
stdout: true | ||
}, | ||
command: function (file) { | ||
var localConfigFile = 'test/protractor.conf.local.js'; | ||
var defaultConfigFile = 'test/protractor.conf.js'; | ||
var configFile = grunt.file.isFile(localConfigFile) ? localConfigFile : defaultConfigFile; | ||
var cmd = 'protractor ' + configFile; | ||
|
||
if (file && grunt.file.isFile(file)) { | ||
cmd += ' --specs ' + file; | ||
} | ||
|
||
console.log('Command: ' + cmd); | ||
return cmd; | ||
} | ||
} | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = function (grunt) { | ||
grunt.registerTask('test', 'Runs unit and midway tests - grunt unit:dev will run continously', | ||
function(type, file) { | ||
var protractorFile = file ? ':' + file : ''; | ||
|
||
// define types of tests to run | ||
var types = { | ||
'mid': 'shell:protractor' + protractorFile | ||
}; | ||
|
||
|
||
// set default to run unit and func test a single time | ||
var tasks = types.mid; | ||
|
||
// check if param passed in (e.g. 'grunt test:unit') | ||
if (typeof type === 'string') { | ||
// overwrite default tasks with single task | ||
tasks = types[type]; | ||
} | ||
|
||
grunt.task.run(tasks); | ||
}); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var Page = require('astrolabe').Page; | ||
|
||
module.exports = Page.create({ | ||
url: { value: '/home' } | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
exports.config = { | ||
// The address of a running selenium server. If this is specified, | ||
// seleniumServerJar and seleniumPort will be ignored. | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
|
||
// A base URL for your application under test. Calls to protractor.get() | ||
// with relative paths will be prepended with this. | ||
baseUrl: 'http://beta.epikvote.com', | ||
|
||
specs: [ | ||
'./stories/*.js' | ||
], | ||
|
||
// Capabilities to be passed to the webdriver instance. | ||
capabilities: { | ||
'browserName': 'firefox' | ||
}, | ||
|
||
// Options to be passed to Jasmine-node. | ||
jasmineNodeOpts: { | ||
isVerbose: true, | ||
showColors: true, | ||
includeStackTrace: true, | ||
defaultTimeoutInterval: 10000 | ||
} | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var basePage = require('../pages/Base'); | ||
|
||
describe('Main page', function() { | ||
|
||
basePage.go(); | ||
|
||
it('should be at the correct URL', function() { | ||
expect(basePage.currentUrl).toEqual(browser.baseUrl + basePage.url); | ||
}); | ||
|
||
}); |