Created
January 28, 2014 22:30
-
-
Save pherris/8677931 to your computer and use it in GitHub Desktop.
grunt angular file
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
// Protractor patches 'expect' to understand promises. | |
describe('MWH homepage', function() { | |
var ptor = protractor.getInstance(); | |
it('should load the default search criteria', function() { | |
var mwhHomePage = require('./MilesWithoutHoursPage.js'); | |
mwhHomePage.get(); | |
// Run this statement before the line which fails. If protractor is run | |
// with the debugger (protractor debug <...>), the test | |
// will pause after loading the webpage but before trying to find the | |
// element. | |
// mwhHomePage.browser.debugger(); | |
// Assert that the text element has the expected color - a little clunky way to do this, another option. | |
mwhHomePage.getUnassignedMwhButton().getCssValue('background-color').then(function(val) { | |
expect(val).toEqual(mwhHomePage.getStatics().checkboxButton.selected); | |
}); | |
mwhHomePage.getUnassignedMwhButton().getAttribute('class').then(function(clasz) { | |
expect(clasz.indexOf('active')).toBeGreaterThan(0); | |
}); | |
//click the unassigned button and make sure that the css changed | |
mwhHomePage.getUnassignedMwhButton().click(); | |
mwhHomePage.getUnassignedMwhButton().getAttribute('class').then(function(clasz) { | |
expect(clasz.indexOf('active')).toBeLessThan(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
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
/** | |
* Steps to build for prod: | |
* | |
* 1) copy | |
* 2) uglify | |
* 3) version | |
* | |
**/ | |
/** | |
* Concatenate JS and minify. | |
**/ | |
uglify: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\nvar <%= pkg.name.replace("-", "") %> = { \nversion: \'0\'\n };' | |
}, | |
build: { | |
src: 'app/js/**/*.js', | |
dest: 'build/<%= pkg.name %>-<%= pkg.version %>.min.js' | |
} | |
}, | |
/** | |
* The version task places the version number at the top of the PeopleNet minified file. | |
**/ | |
version: { | |
src: ['build/<%= pkg.name %>-<%= pkg.version %>.min.js'] | |
}, | |
/** | |
* Moves files to build directory for deployment. | |
**/ | |
copy: { | |
main: { | |
files: [ | |
// includes files within path | |
{expand: true, src: ['app/*.html'], dest: 'build/', filter: 'isFile'}, | |
// includes files within path and its sub-directories | |
{expand: true, src: ['app/js/**'], dest: 'build/'} | |
// flattens results to a single level | |
// {expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'} | |
] | |
} | |
}, | |
protractor: { | |
options: { | |
configFile: "config/protractorConf.js", // Default config file | |
keepAlive: true, // If false, the grunt process stops when the test fails. | |
noColor: false, // If true, protractor will not use colors in its output. | |
debug: false, | |
args: { | |
sauceUser : "XXXXXXXXXXXXXX", | |
sauceKey: "XXXXXXXXXXXXXXXXXX" | |
} | |
}, | |
all: { | |
} | |
} | |
}); | |
// Load the plugin that provides the "uglify" task. | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-version'); | |
grunt.loadNpmTasks('grunt-replace'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-protractor-runner'); | |
// Default task(s). | |
grunt.registerTask('default', ['uglify']); | |
}; |
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
exports.config = { | |
// The address of a running selenium server. | |
//seleniumAddress: 'http://localhost:4444/wd/hub', | |
// Capabilities to be passed to the webdriver instance. | |
capabilities: { | |
'browserName': ['chrome', 'internet explorer'] | |
}, | |
// Spec patterns are relative to the current working directly when | |
// protractor is called. | |
specs: ['../test/e2e/**/*.js'], | |
// Options to be passed to Jasmine-node. | |
jasmineNodeOpts: { | |
showColors: true, | |
defaultTimeoutInterval: 30000 | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment