Skip to content

Commit

Permalink
Fixed up e2e protractor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Tomsu committed Sep 22, 2015
1 parent 85e71be commit c108448
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 40 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"build": "node ./node_modules/webpack/bin/webpack.js",
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --devtool eval",
"test": "./node_modules/karma/bin/karma start",
"preinstall": "npm install -g [email protected]"
"preinstall": "npm install -g [email protected]",
"int": "protractor protractor.conf.js"
},
"devDependencies": {
"angular-mocks": "^1.4.1",
Expand Down Expand Up @@ -86,6 +87,7 @@
"octicons": "^2.2.0",
"phantomjs": "^1.9.17",
"phantomjs-polyfill": "0.0.1",
"protractor": "^2.2.0",
"select2": "git://github.com/select2/select2.git#3.4.8",
"style-loader": "^0.12.3",
"url-loader": "^0.5.6",
Expand Down
26 changes: 12 additions & 14 deletions protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
exports.config = {
seleniumServerJar: './node_modules/selenium-server/lib/runner/selenium-server-standalone-2.44.0.jar',
chromeDriver: './node_modules/chromedriver/lib/chromedriver/chromedriver',
//seleniumAddress: 'http://localhost:4444/wd/hub',

framework: 'jasmine',

baseUrl: 'http://0.0.0.0:9000',
troubleshoot: true,
baseUrl: 'http://localhost:9000',
specs: 'test/e2e/**/*.js',
getPageTimeout: 20000,
allScriptsTimeout: 20000,
//directConnect:true,
capabilities: {
'browserName': 'chrome',
},
onPrepare: function() {
//browser.driver.manage().window().setSize(1500, 800);

require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true)
);
// ----- Options to be passed to minijasminenode -----
jasmineNodeOpts: {
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 30000
}
};
22 changes: 6 additions & 16 deletions test/e2e/applications.e2e.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';

var page = require('../pages/applications.page.js');
//var Modal = require('../pages/newApplication.modal.js');
var Q = require('q');

var newApplicationModal = require('../pages/newApplication.modal.js');

describe('Applications Landing Page', function() {
describe('Applications Landing Page - ', function() {
var browserName;

beforeEach(function(done) {
Expand All @@ -24,18 +21,18 @@ describe('Applications Landing Page', function() {
};
});

describe('Rerouting: ', function () {
describe('Rerouting - ', function () {

it('should redirect to /applications from /', function() {
it('should redirect to /#/applications from /', function() {
browser.get('/');
expect(page.header.getText()).toEqual('Applications');
});

});

describe('The Actions Button', function() {
describe('The Actions Button -', function() {

describe('Create Application', function () {
describe('Create Application -', function () {

it('Click the Actions Button to display Create Application action', function(done) {
this.openMenu().then(function() {
Expand All @@ -57,7 +54,7 @@ describe('Applications Landing Page', function() {
}, console.log);
});

describe('Test the new application modal form', function () {
describe('Test the new application modal form -', function () {

afterEach(function() {
newApplicationModal.resetForm();
Expand All @@ -67,12 +64,6 @@ describe('Applications Landing Page', function() {
expect(newApplicationModal.submit.getAttribute('disabled')).not.toBe(null);
});

it('should give a warning if the application name is not unique', function () {
newApplicationModal.typeName('deck');
expect(newApplicationModal.uniqueNameWarning.isPresent()).toBe(true);
expect(newApplicationModal.uniqueNameWarning.getText()).toContain('unique');
});

it('takes a name, email, description and account', function() {
newApplicationModal.typeName('deck_e2e_test_'+browserName);
newApplicationModal.typeDescription('a deck test');
Expand All @@ -83,7 +74,6 @@ describe('Applications Landing Page', function() {
});

it('creates the application', function(done) {
// TODO: application creation is currently busted in prestaging
newApplicationModal.typeName('deck.e2e.'+browserName);
newApplicationModal.typeDescription('a deck test');
newApplicationModal.typeEmail('[email protected]');
Expand Down
4 changes: 2 additions & 2 deletions test/pages/applications.page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
url: '#/applications',
header: element(by.css('[data-purpose="view-header"]')),
menu: element(by.css('[data-purpose="applications-menu"] button')),
createApplicationMenuItem: element(by.css('[data-purpose="applications-menu"] li a')),
menu: element(by.buttonText('Actions')),
createApplicationMenuItem: element(by.linkText('Create Application')),
};
8 changes: 1 addition & 7 deletions test/pages/newApplication.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ module.exports = {
header: element(by.css('[data-purpose="modal-header"]')),
description: element(by.css('[data-purpose="application-description"]')),
email: element(by.css('[data-purpose="application-email"]')),
name: element(by.css('[data-purpose="application-name"]')),
name: element(by.name('name')),
uniqueNameWarning: element(by.css('.error-message')).element(by.tagName('span')),
//prod: element(by.css('[data-purpose="application-accounts"] [value="prod"]')),
prod: element(by.cssContainingText('option', 'prod')),
submit: element(by.css('[data-purpose="submit"]')),
accountSelectBox: element(by.css('.select2-input')),

Expand All @@ -24,10 +22,6 @@ module.exports = {
this.description.sendKeys(description) ;
},

selectProdAccount: function () {
return this.prod.click();
},

selectTestAccount: function () {
this.accountSelectBox.click().then(function() {
element(by.css('li#ui-select-choices-row-0-0 div span')).click();
Expand Down

0 comments on commit c108448

Please sign in to comment.