Skip to content

Commit

Permalink
added local and sauce tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abarnhard committed Dec 18, 2014
1 parent dc6e9d6 commit bbef044
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 22 deletions.
11 changes: 11 additions & 0 deletions protractor-local.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
seleniumAddress: 'http://localhost:4444/wd/hub',
multiCapabilities: [
{
'browserName': 'chrome'
}/*,
{
'browserName': 'firefox'
}*/
]
};
46 changes: 46 additions & 0 deletions protractor-sauce.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
multiCapabilities: [
{
'browserName': 'chrome',
'platform' : 'OS X 10.10',
'version' : '38',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'App Tests'
},
{
'browserName': 'chrome',
'platform' : 'OS X 10.10',
'version' : '37',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'App Tests'
},
{
'browserName': 'firefox',
'platform' : 'OS X 10.10',
'version' : '34',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'App Tests'
},
{
'browserName': 'safari',
'platform' : 'OS X 10.10',
'version' : '8',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'App Tests'
},
{
'browserName': 'internet explorer',
'platform' : 'Windows 7',
'version' : '11',
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'App Tests'
}
]
};
18 changes: 6 additions & 12 deletions protractor.conf.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
'use strict';
var config;

var config = {};

config.seleniumAddress = 'http://localhost:4444/wd/hub';
config.multiCapabilities = [
{
browserName: 'chrome'
}/*,
{
browserName: 'firefox'
}*/
];
if(process.env.TRAVIS_JOB_NUMBER){
config = require('./protractor-sauce.conf');
}else{
config = require('./protractor-local.conf');
}

config.suites = {
homepage: 'test/e2e/homepage/**/*.spec.js',
Expand Down
27 changes: 17 additions & 10 deletions test/e2e/notes/notes_list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,19 @@ describe('notes list', function(){
});

it('should create a note', function(){
var image = path.resolve(__dirname, '../../fixtures/test_img.png');

element(by.model('note.title')).sendKeys('test title');
// h.debug('red');
element(by.model('note.body')).sendKeys('test body');
element(by.model('note.tags')).sendKeys('a,b,c');
element(by.css('input[type="file"]')).sendKeys(image);
// h.debug('blue');
element(by.css('button[ng-click]')).click();

createNote('test title', 'test body', 'a,b,c');
expect(element(by.model('note.title')).getAttribute('value')).toEqual('');
expect(element(by.model('note.body')).getAttribute('value')).toEqual('');
expect(element(by.model('note.tags')).getAttribute('value')).toEqual('');
expect(element.all(by.repeater('note in notes')).count()).toBeGreaterThan(0);

});

it('should go to the note detail', function(){
createNote('test title', 'test body', 'a,b,c');
element(by.repeater('note in notes').row(0)).element(by.css('td:nth-child(2) > a')).click();
expect(element(by.css('div[ui-view] > h1')).getText()).toEqual('test title');
});
});

function login(){
Expand All @@ -45,3 +41,14 @@ function login(){
element(by.css('button[ng-click]')).click();
browser.get('/#/notes');
}

function createNote(title, body, tags){
var image = path.resolve(__dirname, '../../fixtures/test_img.png');
element(by.model('note.title')).sendKeys(title);
// h.debug('red');
element(by.model('note.body')).sendKeys(body);
element(by.model('note.tags')).sendKeys(tags);
element(by.css('input[type="file"]')).sendKeys(image);
// h.debug('blue');
element(by.css('button[ng-click]')).click();
}

0 comments on commit bbef044

Please sign in to comment.