Skip to content

Commit

Permalink
Add UI test configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jrichter1 committed Feb 29, 2016
1 parent daef8df commit e254d05
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
17 changes: 16 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var gulp = require('gulp'),
yargs = require('yargs')
.boolean('singleRun')
.default({ singleRun : true });
Server = require('karma').Server;
Server = require('karma').Server,
angularProtractor = require('gulp-angular-protractor');

var artifactName = 'DeveloperPlatformInstaller';

Expand Down Expand Up @@ -93,6 +94,20 @@ gulp.task('browser-test', function(done) {
}, done).start();
});

gulp.task('ui-test', function() {
return runSequence('generate', 'protractor-run');
});

gulp.task('protractor-run', function() {
return gulp.src(['./test/ui/**/*.js'])
.pipe(angularProtractor({
'configFile': 'protractor-conf.js',
'autoStartStopServer': false,
'debug': false
}))
.on('error', function(e) { throw e; });
});

gulp.task('default', function() {
return runSequence('generate');
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"electron-packager": "^5.2.0",
"electron-prebuilt": "0.36.8",
"gulp": "^3.9.0",
"gulp-angular-protractor": "^0.0.7",
"gulp-babel": "^5.2.1",
"gulp-rename": "^1.2.2",
"gulp-run": "^1.6.11",
Expand All @@ -54,6 +55,7 @@
"karma-sinon": "^1.0.4",
"mocha": "^2.3.4",
"mock-fs": "^3.5.0",
"protractor": "^3.1.1",
"run-sequence": "^1.1.4",
"sinon": "^1.17.2",
"sinon-as-promised": "^4.0.0",
Expand Down
18 changes: 18 additions & 0 deletions protractor-conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
exports.config = {
directConnect: true,

specs: ['test/ui/**/*.js'],
framework: 'jasmine2',

capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: './dist/win/DeveloperPlatformInstaller-win32-x64/DeveloperPlatformInstaller.exe'
},

onPrepare: function() {
browser.driver.manage().window().maximize();
browser.driver.get('browser/index.html');
}
}
}
18 changes: 18 additions & 0 deletions test/ui/dummy-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

let webdriver = browser.driver;

describe('basic ui test', function() {

it('should not crash', function() {
webdriver.getTitle().then(function(title) {
expect(title).toEqual('Red Hat Developer Platform Installer');
});

webdriver.wait(protractor.until.elementLocated(By.className("btn-lg")), 10000)
.then(function(elm) {
expect(elm.isEnabled()).toEqual(false);
});

});
});

0 comments on commit e254d05

Please sign in to comment.