diff --git a/protractor-local.conf.js b/protractor-local.conf.js new file mode 100644 index 0000000..a4e3060 --- /dev/null +++ b/protractor-local.conf.js @@ -0,0 +1,11 @@ +module.exports = { + seleniumAddress: 'http://localhost:4444/wd/hub', + multiCapabilities: [ + { + 'browserName': 'chrome' + }/*, + { + 'browserName': 'firefox' + }*/ + ] +}; diff --git a/protractor-sauce.conf.js b/protractor-sauce.conf.js new file mode 100644 index 0000000..647b4fe --- /dev/null +++ b/protractor-sauce.conf.js @@ -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' + } + ] +}; diff --git a/protractor.conf.js b/protractor.conf.js index 4789f04..f776890 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -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', diff --git a/test/e2e/notes/notes_list.spec.js b/test/e2e/notes/notes_list.spec.js index 86e2d27..26facaf 100644 --- a/test/e2e/notes/notes_list.spec.js +++ b/test/e2e/notes/notes_list.spec.js @@ -19,16 +19,7 @@ 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(''); @@ -36,6 +27,11 @@ describe('notes list', function(){ }); + 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(){ @@ -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(); +}