From b63c00d81be69b3885ac8ce5c8fe283b31ef68d8 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Tue, 7 Jan 2014 23:31:53 +0100 Subject: [PATCH 001/104] Express requires 'doctype html' instead of '\!\!\!' as the first line. --- views/layout.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/layout.jade b/views/layout.jade index 1a36941..10fbd04 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -1,4 +1,4 @@ -!!! +doctype html html head title= title From 9b8d51c4a878051a13ded25e0ebbb473a89a93ff Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 8 Jan 2014 23:53:29 +0100 Subject: [PATCH 002/104] Added Makefile for make test and moved mocha test cases to default location. --- Makefile | 6 ++++++ {tests => test}/page_test.js | 0 {tests => test}/simple_test.js | 0 3 files changed, 6 insertions(+) create mode 100644 Makefile rename {tests => test}/page_test.js (100%) rename {tests => test}/simple_test.js (100%) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f23daf --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ + +test: + mocha test/simple_test.js test/page_test.js -t 30000 + + +.PHONY: test diff --git a/tests/page_test.js b/test/page_test.js similarity index 100% rename from tests/page_test.js rename to test/page_test.js diff --git a/tests/simple_test.js b/test/simple_test.js similarity index 100% rename from tests/simple_test.js rename to test/simple_test.js From 109270521761e04e49703876487223427a31fb9f Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 18:15:14 +0100 Subject: [PATCH 003/104] Make the tests work with webdriver v0.7.13. Added TDD tests in addition to the BDD style. Removed obsolete helper command. --- test/page_test.js | 142 +++++++++++++++++++++++++++++--------------- test/simple_test.js | 45 +++++++------- 2 files changed, 117 insertions(+), 70 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 89c913c..23b45b8 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -1,62 +1,106 @@ -var expect = require('chai').expect, - webdriverjs = require("webdriverjs"), - client = webdriverjs.remote(); +var chai = require('chai'); +var assert = chai.assert, // TDD + expect = chai.expect, // BDD + webdriverjs = require('webdriverjs'); +var options = { + desiredCapabilities: { + browserName: 'chrome' + } +}; -describe('Run Selenium tests', function() { +describe('Run some Selenium tests', function() { + + var client = {}; before(function(done) { - // Add some helper commands - client.addCommand('hasText', function(selector, text, callback) { - this.getText(selector, function(result) { - expect(result.value).to.have.string(text); - callback(); - }); - }); - client.addCommand('waitUntilVisible', function(element, callback) { - var self = this; - function checkElement() { - self.isVisible(element, function(result) { - if (result === true) { - callback(); - } else { - setTimeout(checkElement, 500); - } - }); - } - checkElement(); - }); - done(); + // console.log('--before--'); + + //client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); + client = webdriverjs.remote(options); + + // start the session + client.init() + .call(done); + }); + + after(function(done) { + //console.log('--after--'); + client.end() + .call(done); }); beforeEach(function(done) { + //console.log('--beforeEach--'); + this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test - client.init(); - client.url('http://localhost:3000', done); + client.url('http://localhost:3000') + .call(done); }); - it('should be able to navigate betwen the pages', function(done) { - this.timeout(10000); + it('checks the title only - using TDD style check', function(done) { + // uses helper command getTitle() + client.getTitle(function(err, result) { + assert.strictEqual(err, null); + //console.log('1 Title was: ' + result); + assert.strictEqual(result, 'Library'); // TDD + }) + .call(done); + }); + + it('checks the title only, a second time - but using BDD style check', function(done) { client - .hasText('#title', 'Library') - .click('#authors') - .waitUntilVisible("#authorList", function() { - client - .hasText('#author1', 'Patrick Rothfuss') - .click('#back') - .waitUntilVisible('#books', function() { - client - .click('#books') - .waitUntilVisible('#bookList', function() { - client.hasText('book1', "Wise Man's Fear"); - done(); - }); - }); - }); + .getTitle(function(err, result) { + if (err) throw err; + //console.log('1 Title was: ' + result); + expect(result).to.have.string('Library'); // BDD + }) + // uses underlying protocol function title() + .title(function(err, result) { + if (err) throw err; + //console.log('2 Title was: ' + result.value); + expect(result.value).to.have.string('Library'); // BDD + }) + .call(done);; }); - - afterEach(function(done) { - client.end(); - done(); + + it('should be able to navigate between the pages', function(done) { + client + .getTitle(function(err, result) { + assert.strictEqual(err, null); + //console.log('Title was: ' + result); + assert.strictEqual(result, 'Library'); + }) + .click('#authors') + .getTitle(function(err, title) { + assert.strictEqual(err, null); + assert.strictEqual(title, 'Authors'); + }) + .getText('#author1', function(err, result) { + if (err) throw err; + //console.log('#author1: ' + result); + expect(result).to.have.string('Patrick Rothfuss'); + }) + .click('#back') + .getTitle(function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, 'Library'); + }) + .click('#books') + .getTitle(function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, 'Books'); + }) + .getText('#book1', function(err, result) { + assert.strictEqual(err, null); + //console.log('#book1: ' + result); + assert.strictEqual(result, 'Wise Man\'s Fear'); + }) + .click('#back') + .getTitle(function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, 'Library'); + }) + .call(done); }); -}); \ No newline at end of file +}); diff --git a/test/simple_test.js b/test/simple_test.js index ba3517f..9c7f2bb 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -1,36 +1,39 @@ -var expect = require('chai').expect, - webdriverjs = require("webdriverjs"), - client = webdriverjs.remote(); +var assert = require('chai').assert, + expect = require('chai').expect, + webdriverjs = require('webdriverjs'), + client = webdriverjs.remote({ desiredCapabilities: {browserName: 'chrome'} }); describe('Run Selenium tests', function() { before(function(done) { - // Add some helper commands + // Add a helper command client.addCommand('hasText', function(selector, text, callback) { - this.getText(selector, function(result) { - expect(result.value).to.have.string(text); - callback(); - }); + this.getText(selector, function(err, result) { + assert.strictEqual(err, null); + assert.strictEqual(result, text); // TDD + expect(result).to.have.string(text); // BDD + }) + .call(callback); }); - done(); + + client.init() + .call(done); }); beforeEach(function(done) { + this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test - client.init(); - client.url('http://localhost:3000', done); + client.url('http://localhost:3000') + .call(done); }); - + it('should be able to view the home page', function(done) { - this.timeout(10000); - client.hasText('#title', 'Library'); - done(); - + client.hasText('#title', 'Library') + .call(done); }); - - afterEach(function(done) { - client.end(); - done(); + + after(function(done) { + client.end().call(done); }); -}); \ No newline at end of file +}); From 8d458882d69d80cadacaa50fa1b58b2cd0566472 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 18:25:08 +0100 Subject: [PATCH 004/104] Added Travis file with locally running tests. --- .travis.yml | 26 ++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..dd9bd3d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +language: node_js + +node_js: + - '0.10' + +before_script: + - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + - java -jar selenium-server-standalone-2.39.0.jar & + - sudo npm install + - node app.js + +script: + - mocha --reporter min + +#addons: +# sauce_connect: true + +#env: +# global: +# - secure: "OCd/NzEOCuD2p+BsYCr4TaUyKXdo3dmzwf2U5VdRQUXPK/TzzTx+HqOy46VxJ/reySYzGAXTF/Zxmu6289GdOzol3v6dIIGdq/g+62+0/SCtFK8IhaVJNRV1dC9ccN7q9oskzmmgEtjuvPAj0gDX0EhtOVWfogobCGvFITjJcgE=" +# - secure: "J1slVeysWT4pntabPUVdOZnlOuOBO95GuRwR7s4GMPWOe8Wm0iWLC07Qr5DoeUK0A17vxsxv62IjzOQsoTARu7yxMjXnWWzit8nqDkOLCi/T6LjOTmDjvB6g0ohQ7Nw8oMWNqqN5HOzd7BpMXVC293+hWkDXvAX/+wIMtbV1gZQ=" + +# matrix: +# - _BROWSER: "chrome" +# _PLATFORM: "Windows_8" +# _VERSION: "31" diff --git a/Makefile b/Makefile index 7f23daf..f71886d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ test: - mocha test/simple_test.js test/page_test.js -t 30000 + mocha test/simple_test.js test/page_test.js .PHONY: test From a1babb810b822d907f9caaf8e0c72d84fac79cec Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 19:04:52 +0100 Subject: [PATCH 005/104] Makefile: Automatically launch app.js. The program is only started when it is not already running. --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f71886d..9b968d1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,18 @@ -test: +APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d' ' -f2) + +all: test + +launchapp: +ifneq (,$(APPPID)) + @echo "node app.js is already running. Process id: $(APPPID)." +else + @echo "Starting node app.js ..." + node app.js & +endif + +test: launchapp mocha test/simple_test.js test/page_test.js -.PHONY: test +.PHONY: all test launchapp From c64e249a2cf788f400312da49c4f17fb5927a735 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 19:17:01 +0100 Subject: [PATCH 006/104] Travis: npm seems not available, but is automatically invoked. --- .travis.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index dd9bd3d..bfed8ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,22 @@ language: node_js node_js: - - '0.10' + - '0.10' + +install: + - echo "$(date +%H:%M:%S.%N) - install begin" + - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + - java -jar selenium-server-standalone-2.39.0.jar & + - sleep 10 + - echo "$(date +%H:%M:%S.%N) - install end" before_script: - - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - - java -jar selenium-server-standalone-2.39.0.jar & - - sudo npm install - - node app.js + #- sudo npm install - is automatically executed + - node app.js script: - - mocha --reporter min + - echo "$(date +%H:%M:%S.%N) - script begin" + - mocha --reporter min #addons: # sauce_connect: true From 6be0f503bee7d3a881b199bba81172fb8b6dd1b6 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 19:29:21 +0100 Subject: [PATCH 007/104] Travis: npm is only automatically invoked when install step is missing. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfed8ea..e1d76ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,15 @@ language: node_js node_js: - '0.10' -install: - - echo "$(date +%H:%M:%S.%N) - install begin" +before_install: + - echo "$(date +%H:%M:%S.%N) - before_install begin" - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - java -jar selenium-server-standalone-2.39.0.jar & - sleep 10 - - echo "$(date +%H:%M:%S.%N) - install end" + - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: - #- sudo npm install - is automatically executed + #- sudo npm install - is automatically executed when install is missing - node app.js script: From 5d65697069506f65de8549a56c77add5ddfdeaf2 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 21:02:42 +0100 Subject: [PATCH 008/104] Travis: start example web app in the background. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e1d76ad..3212709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_install: before_script: #- sudo npm install - is automatically executed when install is missing - - node app.js + - node app.js & script: - echo "$(date +%H:%M:%S.%N) - script begin" From e87997faee16f0aea517ddc559be2322044c5cc7 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 21:03:23 +0100 Subject: [PATCH 009/104] Updated the example web app to use latest express version. --- app.js | 46 +++++++++++++++++++++++----------------------- package.json | 4 ++-- views/authors.jade | 19 +++++++++++-------- views/books.jade | 19 +++++++++++-------- views/index.jade | 15 +++++++++------ views/layout.jade | 3 ++- 6 files changed, 58 insertions(+), 48 deletions(-) diff --git a/app.js b/app.js index 0ab7f77..8e4e676 100644 --- a/app.js +++ b/app.js @@ -4,34 +4,34 @@ */ var express = require('express') - , routes = require('./routes'); - -var app = module.exports = express.createServer(); + , routes = require('./routes') + , http = require('http') + , path = require('path'); + +var app = express(); // Configuration - -app.configure(function(){ - app.set('views', __dirname + '/views'); - app.set('view engine', 'jade'); - app.use(express.bodyParser()); - app.use(express.methodOverride()); - app.use(app.router); - app.use(express.static(__dirname + '/public')); -}); - -app.configure('development', function(){ - app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); -}); - -app.configure('production', function(){ - app.use(express.errorHandler()); -}); +app.set('port', process.env.PORT || 3000); +app.set('views', path.join(__dirname, 'views')); +app.set('view engine', 'jade'); +app.use(express.favicon()); +app.use(express.logger('dev')); +app.use(express.json()); +app.use(express.urlencoded()); +app.use(express.methodOverride()); +app.use(app.router); +app.use(express.static(path.join(__dirname, 'public'))); + +// development only +if ('development' == app.get('env')) { + app.use(express.errorHandler()); +} // Routes - app.get('/', routes.index); app.get('/authors', routes.authors); app.get('/books', routes.books); -app.listen(3000); -console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); +http.createServer(app).listen(app.get('port'), function(){ + console.log("Express server listening on port %d in %s mode...", app.get('port'), app.get('env')); +}); diff --git a/package.json b/package.json index 299ff16..543c2a0 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "selenium-example", - "version": "0.0.1", + "version": "1.0.0", "private": true, "dependencies": { - "express": "2.5.8", + "express": "*", "jade": ">= 0.0.1" }, "devDependencies": { diff --git a/views/authors.jade b/views/authors.jade index 5e1c5ab..80f3b9b 100644 --- a/views/authors.jade +++ b/views/authors.jade @@ -1,9 +1,12 @@ -h1#title= title +extends layout -ul#authorList - li#author1 Patrick Rothfuss - li#author2 William Shakespeare - li#author3 Eric Flint - li#author4 George Orwell - -a#back(href='/') Back \ No newline at end of file +block content + h1#title= title + + ul#authorList + li#author1 Patrick Rothfuss + li#author2 William Shakespeare + li#author3 Eric Flint + li#author4 George Orwell + + a#back(href='/') Back \ No newline at end of file diff --git a/views/books.jade b/views/books.jade index c8c1910..8788051 100644 --- a/views/books.jade +++ b/views/books.jade @@ -1,9 +1,12 @@ -h1#title= title +extends layout -ul#bookList - li#book1 Wise Man's Fear - li#book2 Hamlet - li#book3 1632 - li#book4 1984 - -a#back(href='/') Back \ No newline at end of file +block content + h1#title= title + + ul#bookList + li#book1 Wise Man's Fear + li#book2 Hamlet + li#book3 1632 + li#book4 1984 + + a#back(href='/') Back diff --git a/views/index.jade b/views/index.jade index 4b29c4a..e9de18e 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,7 +1,10 @@ -h1#title= title -p Welcome to the Library +extends layout -p - a#authors(href='/authors') Authors -p - a#books(href='/books') Books \ No newline at end of file +block content + h1#title= title + p Welcome to the #{title} + + p + a#authors(href='/authors') Authors + p + a#books(href='/books') Books diff --git a/views/layout.jade b/views/layout.jade index 10fbd04..15af079 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -3,4 +3,5 @@ html head title= title link(rel='stylesheet', href='/stylesheets/style.css') - body!= body \ No newline at end of file + body + block content From 7ec1788fc37af712ccb1374d30af9672c3038ef6 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 21:13:20 +0100 Subject: [PATCH 010/104] Travis: use saucelabs for the tests. --- .travis.yml | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3212709..d496d5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,30 +3,33 @@ language: node_js node_js: - '0.10' -before_install: - - echo "$(date +%H:%M:%S.%N) - before_install begin" - - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - - java -jar selenium-server-standalone-2.39.0.jar & - - sleep 10 - - echo "$(date +%H:%M:%S.%N) - before_install end" +# before_install: +# - echo "$(date +%H:%M:%S.%N) - before_install begin" +# - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar +# - java -jar selenium-server-standalone-2.39.0.jar & +# - sleep 10 +# - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: #- sudo npm install - is automatically executed when install is missing - node app.js & -script: - - echo "$(date +%H:%M:%S.%N) - script begin" - - mocha --reporter min +#script: +# - echo "$(date +%H:%M:%S.%N) - script begin" +# - mocha --reporter min -#addons: -# sauce_connect: true +addons: + sauce_connect: true -#env: -# global: -# - secure: "OCd/NzEOCuD2p+BsYCr4TaUyKXdo3dmzwf2U5VdRQUXPK/TzzTx+HqOy46VxJ/reySYzGAXTF/Zxmu6289GdOzol3v6dIIGdq/g+62+0/SCtFK8IhaVJNRV1dC9ccN7q9oskzmmgEtjuvPAj0gDX0EhtOVWfogobCGvFITjJcgE=" -# - secure: "J1slVeysWT4pntabPUVdOZnlOuOBO95GuRwR7s4GMPWOe8Wm0iWLC07Qr5DoeUK0A17vxsxv62IjzOQsoTARu7yxMjXnWWzit8nqDkOLCi/T6LjOTmDjvB6g0ohQ7Nw8oMWNqqN5HOzd7BpMXVC293+hWkDXvAX/+wIMtbV1gZQ=" +env: + global: + - secure: "OCd/NzEOCuD2p+BsYCr4TaUyKXdo3dmzwf2U5VdRQUXPK/TzzTx+HqOy46VxJ/reySYzGAXTF/Zxmu6289GdOzol3v6dIIGdq/g+62+0/SCtFK8IhaVJNRV1dC9ccN7q9oskzmmgEtjuvPAj0gDX0EhtOVWfogobCGvFITjJcgE=" + - secure: "J1slVeysWT4pntabPUVdOZnlOuOBO95GuRwR7s4GMPWOe8Wm0iWLC07Qr5DoeUK0A17vxsxv62IjzOQsoTARu7yxMjXnWWzit8nqDkOLCi/T6LjOTmDjvB6g0ohQ7Nw8oMWNqqN5HOzd7BpMXVC293+hWkDXvAX/+wIMtbV1gZQ=" -# matrix: -# - _BROWSER: "chrome" -# _PLATFORM: "Windows_8" -# _VERSION: "31" + matrix: + - _BROWSER: "chrome" + _PLATFORM: "Windows_8" + _VERSION: "31" + - _BROWSER: "firefox" + _PLATFORM: "Linux" + _VERSION: "25" From 8fe6e708eb5e9d84dd7244f59bb21718839dc4bf Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 21:22:50 +0100 Subject: [PATCH 011/104] Travis: add saucelab user and key. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d496d5e..3b8c259 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,9 @@ addons: env: global: - - secure: "OCd/NzEOCuD2p+BsYCr4TaUyKXdo3dmzwf2U5VdRQUXPK/TzzTx+HqOy46VxJ/reySYzGAXTF/Zxmu6289GdOzol3v6dIIGdq/g+62+0/SCtFK8IhaVJNRV1dC9ccN7q9oskzmmgEtjuvPAj0gDX0EhtOVWfogobCGvFITjJcgE=" - - secure: "J1slVeysWT4pntabPUVdOZnlOuOBO95GuRwR7s4GMPWOe8Wm0iWLC07Qr5DoeUK0A17vxsxv62IjzOQsoTARu7yxMjXnWWzit8nqDkOLCi/T6LjOTmDjvB6g0ohQ7Nw8oMWNqqN5HOzd7BpMXVC293+hWkDXvAX/+wIMtbV1gZQ=" - + - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" + - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" + matrix: - _BROWSER: "chrome" _PLATFORM: "Windows_8" From 3f385cbb0e9ff935fa9867ea988296ccb28a5a67 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 21:34:02 +0100 Subject: [PATCH 012/104] Add test script to package.json so that npm test calls mocha to run the tests. --- .travis.yml | 2 +- package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b8c259..22d483f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ before_script: #script: # - echo "$(date +%H:%M:%S.%N) - script begin" -# - mocha --reporter min +# - mocha --reporter spec addons: sauce_connect: true diff --git a/package.json b/package.json index 543c2a0..4ce064e 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,8 @@ "mocha": "*", "chai": "*", "webdriverjs": "*" + }, + "scripts": { + "test": "mocha --reporter spec" } } \ No newline at end of file From 1c6cae9986dd6bd13ff4d52d3af8b689e9082213 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 22:01:20 +0100 Subject: [PATCH 013/104] On Travis connect to saucelabs for running the tests. --- test/page_test.js | 41 +++++++++++++++++++++++++++++++++++------ test/simple_test.js | 25 +++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 23b45b8..4454e85 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -2,13 +2,42 @@ var chai = require('chai'); var assert = chai.assert, // TDD expect = chai.expect, // BDD webdriverjs = require('webdriverjs'); -var options = { - desiredCapabilities: { - browserName: 'chrome' - } -}; +var env = GLOBAL.env = {} -describe('Run some Selenium tests', function() { +var options = {}; +if (env.TRAVIS) { + var BROWSERNAME = env._BROWSER || env.BROWSER || 'chrome'; + var BROWSERVERSION = env._VERSION || env.VERSION || '*'; + var BROWSERPLATFORM = env._PLATFORM || env.PLATFORM || 'Linux'; + console.log('BROWSERNAME: ' + BROWSERNAME); + console.log('BROWSERVERSION: ' + BROWSERVERSION); + console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + + var options = { desiredCapabilities: { + browserName: BROWSERNAME, + version: BROWSERVERSION, + platform: BROWSERPLATFORM, + tags: ['examples'], + name: 'Run web app test using webdriverjs/Selenium.' + }, + host: 'ondemand.saucelabs.com', + port: 80, + user: env.SAUCE_USERNAME, + key: env.SAUCE_ACCESS_KEY, + logLevel: 'silent' + }; +} +else +{ + options = { + desiredCapabilities: { + browserName: 'chrome' + } + }; +} + + +describe('Run web app test using webdriverjs/Selenium.', function() { var client = {}; diff --git a/test/simple_test.js b/test/simple_test.js index 9c7f2bb..57222ec 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -1,9 +1,30 @@ var assert = require('chai').assert, expect = require('chai').expect, - webdriverjs = require('webdriverjs'), + webdriverjs = require('webdriverjs'); +var env = GLOBAL.env = {}; +var client = {}; + +if (env.TRAVIS) { + client = webdriverjs.remote({ desiredCapabilities: { + browserName: 'chrome', + version: '27', + platform: 'XP', + tags: ['examples'], + name: 'Run single page test using webdriverjs/Selenium.' + }, + host: 'ondemand.saucelabs.com', + port: 80, + user: env.SAUCE_USERNAME, + key: env.SAUCE_ACCESS_KEY, + logLevel: 'silent' + }); +} +else +{ client = webdriverjs.remote({ desiredCapabilities: {browserName: 'chrome'} }); +} -describe('Run Selenium tests', function() { +describe('Run single page test using webdriverjs/Selenium.', function() { before(function(done) { // Add a helper command From 6b2c4449d5798f30e094d4b715388dd25be2516c Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 22:45:34 +0100 Subject: [PATCH 014/104] Change port to 4445 which is provided by sauce connect. --- test/page_test.js | 9 +++++++-- test/simple_test.js | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 4454e85..d736ae9 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -12,6 +12,7 @@ if (env.TRAVIS) { console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + console.log('SELENIUM_HOST: ' + env.SELENIUM_HOST); var options = { desiredCapabilities: { browserName: BROWSERNAME, @@ -20,8 +21,12 @@ if (env.TRAVIS) { tags: ['examples'], name: 'Run web app test using webdriverjs/Selenium.' }, - host: 'ondemand.saucelabs.com', - port: 80, + // for w/o sauce connect + // host: 'ondemand.saucelabs.com', + // port: 80, + // use with sauce connect: + host: 'localhost', + port: 4445, user: env.SAUCE_USERNAME, key: env.SAUCE_ACCESS_KEY, logLevel: 'silent' diff --git a/test/simple_test.js b/test/simple_test.js index 57222ec..1975260 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -12,8 +12,12 @@ if (env.TRAVIS) { tags: ['examples'], name: 'Run single page test using webdriverjs/Selenium.' }, - host: 'ondemand.saucelabs.com', - port: 80, + // for w/o sauce connect + // host: 'ondemand.saucelabs.com', + // port: 80, + // use with sauce connect: + host: 'localhost', + port: 4445, user: env.SAUCE_USERNAME, key: env.SAUCE_ACCESS_KEY, logLevel: 'silent' From 362fd8d27074e59fbaeffd27de184d85222f2714 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 23:15:03 +0100 Subject: [PATCH 015/104] Makefile: Launch selenium server when needed, too. --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9b968d1..0eff1f4 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,33 @@ -APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d' ' -f2) +SELENIUMJAR=selenium-server-standalone-2.39.0.jar +SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-2.39.0.jar$$' | cut -d ' ' -f 2-3) +APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d ' ' -f 2-3) all: test +$(SELENIUMJAR): + @echo "Getting selenium server $(SELENIUMJAR) ..." + curl -O http://selenium.googlecode.com/files/$(SELENIUMJAR) + +launchselenium: $(SELENIUMJAR) +ifneq (,$(SELENIUMPID)) + @echo "Selenium server $(SELENIUMJAR) is already running. Process id: $(SELENIUMPID)" +else + @echo "Starting selenium server $(SELENIUMJAR) ..." + java -jar $(SELENIUMJAR) & + +endif + launchapp: ifneq (,$(APPPID)) - @echo "node app.js is already running. Process id: $(APPPID)." + @echo "node app.js is already running. Process id: $(APPPID)" else @echo "Starting node app.js ..." node app.js & endif -test: launchapp +test: launchselenium launchapp mocha test/simple_test.js test/page_test.js -.PHONY: all test launchapp +.PHONY: all test launchapp launchselenium From 00a32a2912d164998d01cdb5601fad108d79268b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 23:16:27 +0100 Subject: [PATCH 016/104] Add log output of env variables. Launch first the simple_test and then the page_test. --- .gitignore | 3 ++- package.json | 2 +- test/page_test.js | 11 +++++---- test/simple_test.js | 55 ++++++++++++++++++++++++++++++--------------- 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index ee10fbf..3bcb9f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_STORE -node_modules \ No newline at end of file +node_modules +*.jar diff --git a/package.json b/package.json index 4ce064e..f35b6e7 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,6 @@ "webdriverjs": "*" }, "scripts": { - "test": "mocha --reporter spec" + "test": "mocha --reporter spec test/simple_test.js test/page_test.js" } } \ No newline at end of file diff --git a/test/page_test.js b/test/page_test.js index d736ae9..1286b6d 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -5,14 +5,17 @@ var assert = chai.assert, // TDD var env = GLOBAL.env = {} var options = {}; +console.log('TRAVIS: %s', env.TRAVIS || 'no'); +console.log('SELENIUM_HOST: %s', env.SELENIUM_HOST || '-'); +console.log('SELENIUM_PORT: %s', env.SELENIUM_PORT || '-'); + if (env.TRAVIS) { var BROWSERNAME = env._BROWSER || env.BROWSER || 'chrome'; var BROWSERVERSION = env._VERSION || env.VERSION || '*'; var BROWSERPLATFORM = env._PLATFORM || env.PLATFORM || 'Linux'; - console.log('BROWSERNAME: ' + BROWSERNAME); - console.log('BROWSERVERSION: ' + BROWSERVERSION); - console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); - console.log('SELENIUM_HOST: ' + env.SELENIUM_HOST); + console.log('BROWSERNAME: %s', BROWSERNAME || '-'); + console.log('BROWSERVERSION: %s', BROWSERVERSION || '-'); + console.log('BROWSERPLATFORM: %s', BROWSERPLATFORM || '-'); var options = { desiredCapabilities: { browserName: BROWSERNAME, diff --git a/test/simple_test.js b/test/simple_test.js index 1975260..6a7653e 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,33 +4,52 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; +console.log('TRAVIS: %s', env.TRAVIS || 'no'); +console.log('SELENIUM_HOST: %s', env.SELENIUM_HOST || '-'); +console.log('SELENIUM_PORT: %s', env.SELENIUM_PORT || '-'); + if (env.TRAVIS) { - client = webdriverjs.remote({ desiredCapabilities: { - browserName: 'chrome', - version: '27', - platform: 'XP', - tags: ['examples'], - name: 'Run single page test using webdriverjs/Selenium.' - }, - // for w/o sauce connect - // host: 'ondemand.saucelabs.com', - // port: 80, - // use with sauce connect: - host: 'localhost', - port: 4445, - user: env.SAUCE_USERNAME, - key: env.SAUCE_ACCESS_KEY, - logLevel: 'silent' - }); + var BROWSERNAME = env._BROWSER || env.BROWSER || 'chrome'; + var BROWSERVERSION = env._VERSION || env.VERSION || '*'; + var BROWSERPLATFORM = env._PLATFORM || env.PLATFORM || 'Linux'; + console.log('BROWSERNAME: ' + BROWSERNAME); + console.log('BROWSERVERSION: ' + BROWSERVERSION); + console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + + var options = { desiredCapabilities: { + browserName: 'chrome', + version: '27', + platform: 'XP', + tags: ['examples'], + name: 'Run single page test using webdriverjs/Selenium.' + }, + // for w/o sauce connect + // host: 'ondemand.saucelabs.com', + // port: 80, + // use with sauce connect: + host: 'localhost', + port: 4445, + user: env.SAUCE_USERNAME, + key: env.SAUCE_ACCESS_KEY, + logLevel: 'silent' + }; } else { - client = webdriverjs.remote({ desiredCapabilities: {browserName: 'chrome'} }); + options = { + desiredCapabilities: { + browserName: 'chrome' + } + }; } describe('Run single page test using webdriverjs/Selenium.', function() { + var client = {}; + before(function(done) { + client = webdriverjs.remote(options); + // Add a helper command client.addCommand('hasText', function(selector, text, callback) { this.getText(selector, function(err, result) { From 6fd99dd34a5247f3f89275eb12d3668444c1d39e Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 23:32:59 +0100 Subject: [PATCH 017/104] Corrected the way to access environment variables in javascript. --- test/page_test.js | 13 ++++--------- test/simple_test.js | 15 ++++++++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 1286b6d..57a4b11 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -2,17 +2,12 @@ var chai = require('chai'); var assert = chai.assert, // TDD expect = chai.expect, // BDD webdriverjs = require('webdriverjs'); -var env = GLOBAL.env = {} var options = {}; -console.log('TRAVIS: %s', env.TRAVIS || 'no'); -console.log('SELENIUM_HOST: %s', env.SELENIUM_HOST || '-'); -console.log('SELENIUM_PORT: %s', env.SELENIUM_PORT || '-'); - -if (env.TRAVIS) { - var BROWSERNAME = env._BROWSER || env.BROWSER || 'chrome'; - var BROWSERVERSION = env._VERSION || env.VERSION || '*'; - var BROWSERPLATFORM = env._PLATFORM || env.PLATFORM || 'Linux'; +if (process.env.TRAVIS) { + var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; + var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; console.log('BROWSERNAME: %s', BROWSERNAME || '-'); console.log('BROWSERVERSION: %s', BROWSERVERSION || '-'); console.log('BROWSERPLATFORM: %s', BROWSERPLATFORM || '-'); diff --git a/test/simple_test.js b/test/simple_test.js index 6a7653e..c469172 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,14 +4,15 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('TRAVIS: %s', env.TRAVIS || 'no'); -console.log('SELENIUM_HOST: %s', env.SELENIUM_HOST || '-'); -console.log('SELENIUM_PORT: %s', env.SELENIUM_PORT || '-'); +console.log('USER: %s', process.env.USER || '-'); +console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); +console.log('SELENIUM_HOST: %s', process.env.SELENIUM_HOST || '-'); +console.log('SELENIUM_PORT: %s', process.env.SELENIUM_PORT || '-'); -if (env.TRAVIS) { - var BROWSERNAME = env._BROWSER || env.BROWSER || 'chrome'; - var BROWSERVERSION = env._VERSION || env.VERSION || '*'; - var BROWSERPLATFORM = env._PLATFORM || env.PLATFORM || 'Linux'; +if (process.env.TRAVIS) { + var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; + var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); From cb5385aaae87add51a7b13e3690e087cfa649a49 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 23:44:36 +0100 Subject: [PATCH 018/104] Added user name to desiredCapabilities as requested by sauce connect error message. --- test/page_test.js | 9 +++------ test/simple_test.js | 12 ++++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 57a4b11..4a51f5b 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -8,16 +8,15 @@ if (process.env.TRAVIS) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; - console.log('BROWSERNAME: %s', BROWSERNAME || '-'); - console.log('BROWSERVERSION: %s', BROWSERVERSION || '-'); - console.log('BROWSERPLATFORM: %s', BROWSERPLATFORM || '-'); var options = { desiredCapabilities: { browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run web app test using webdriverjs/Selenium.' + name: 'Run web app test using webdriverjs/Selenium.', + user: env.SAUCE_USERNAME, + key: env.SAUCE_ACCESS_KEY }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -25,8 +24,6 @@ if (process.env.TRAVIS) { // use with sauce connect: host: 'localhost', port: 4445, - user: env.SAUCE_USERNAME, - key: env.SAUCE_ACCESS_KEY, logLevel: 'silent' }; } diff --git a/test/simple_test.js b/test/simple_test.js index c469172..42f6a62 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -18,11 +18,13 @@ if (process.env.TRAVIS) { console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); var options = { desiredCapabilities: { - browserName: 'chrome', - version: '27', - platform: 'XP', + browserName: BROWSERNAME, + version: BROWSERVERSION, + platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run single page test using webdriverjs/Selenium.' + name: 'Run single page test using webdriverjs/Selenium.', + user: env.SAUCE_USERNAME, + key: env.SAUCE_ACCESS_KEY, }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -30,8 +32,6 @@ if (process.env.TRAVIS) { // use with sauce connect: host: 'localhost', port: 4445, - user: env.SAUCE_USERNAME, - key: env.SAUCE_ACCESS_KEY, logLevel: 'silent' }; } From dcaebf64c9d24a8b961bdd0d132cdd018d7fe1c6 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 11 Jan 2014 23:54:06 +0100 Subject: [PATCH 019/104] Added more infos to desiredCapabilities. --- test/page_test.js | 6 +++--- test/simple_test.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 4a51f5b..4da1f76 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -14,9 +14,7 @@ if (process.env.TRAVIS) { version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run web app test using webdriverjs/Selenium.', - user: env.SAUCE_USERNAME, - key: env.SAUCE_ACCESS_KEY + name: 'Run web app test using webdriverjs/Selenium.' }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -24,6 +22,8 @@ if (process.env.TRAVIS) { // use with sauce connect: host: 'localhost', port: 4445, + user: process.env.SAUCE_USERNAME, + key: process.env.SAUCE_ACCESS_KEY, logLevel: 'silent' }; } diff --git a/test/simple_test.js b/test/simple_test.js index 42f6a62..ecf431d 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -44,7 +44,7 @@ else }; } -describe('Run single page test using webdriverjs/Selenium.', function() { +describe('Run a simple test using webdriverjs/Selenium.', function() { var client = {}; From 247733373b9d22038ba2fb87faee65f22666535a Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 00:01:00 +0100 Subject: [PATCH 020/104] Added more infos to desiredCapabilities. --- test/simple_test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/simple_test.js b/test/simple_test.js index ecf431d..b7201a1 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,10 +4,8 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('USER: %s', process.env.USER || '-'); +console.log('USER: %s/%s', process.env.USER || '-', process.env.SAUCE_USERNAME | '-'); console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); -console.log('SELENIUM_HOST: %s', process.env.SELENIUM_HOST || '-'); -console.log('SELENIUM_PORT: %s', process.env.SELENIUM_PORT || '-'); if (process.env.TRAVIS) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; @@ -18,13 +16,13 @@ if (process.env.TRAVIS) { console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); var options = { desiredCapabilities: { + username: process.env.SAUCE_USERNAME, + access-key: process.env.SAUCE_ACCESS_KEY, browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], name: 'Run single page test using webdriverjs/Selenium.', - user: env.SAUCE_USERNAME, - key: env.SAUCE_ACCESS_KEY, }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -32,6 +30,8 @@ if (process.env.TRAVIS) { // use with sauce connect: host: 'localhost', port: 4445, + user: process.env.SAUCE_USERNAME, + key: process.env.SAUCE_ACCESS_KEY, logLevel: 'silent' }; } From 36c1671f328c089d3c362a9166de05921e3dcf2b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 00:04:53 +0100 Subject: [PATCH 021/104] Corrected infos to desiredCapabilities. --- test/page_test.js | 4 ++-- test/simple_test.js | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 4da1f76..f0b420f 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -14,7 +14,7 @@ if (process.env.TRAVIS) { version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run web app test using webdriverjs/Selenium.' + name: 'Run web app \'page test\' using webdriverjs/Selenium.' }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -37,7 +37,7 @@ else } -describe('Run web app test using webdriverjs/Selenium.', function() { +describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { var client = {}; diff --git a/test/simple_test.js b/test/simple_test.js index b7201a1..880354d 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -16,8 +16,6 @@ if (process.env.TRAVIS) { console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); var options = { desiredCapabilities: { - username: process.env.SAUCE_USERNAME, - access-key: process.env.SAUCE_ACCESS_KEY, browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, From eab3f6e89db863c85d755f460dfa92966b4c1f1b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 00:23:44 +0100 Subject: [PATCH 022/104] Increased time out in before. --- .travis.yml | 4 ++-- test/page_test.js | 1 + test/simple_test.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22d483f..1ac8c3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ env: matrix: - _BROWSER: "chrome" - _PLATFORM: "Windows_8" + _PLATFORM: "Windows 8" _VERSION: "31" - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "25" + _VERSION: "26" diff --git a/test/page_test.js b/test/page_test.js index f0b420f..3666897 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -43,6 +43,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { before(function(done) { // console.log('--before--'); + this.timeout(10000); //client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); client = webdriverjs.remote(options); diff --git a/test/simple_test.js b/test/simple_test.js index 880354d..7e9901a 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,7 +4,7 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('USER: %s/%s', process.env.USER || '-', process.env.SAUCE_USERNAME | '-'); +console.log('USER: %s', process.env.USER || '-'); console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); if (process.env.TRAVIS) { @@ -47,6 +47,7 @@ describe('Run a simple test using webdriverjs/Selenium.', function() { var client = {}; before(function(done) { + this.timeout(10000); client = webdriverjs.remote(options); // Add a helper command From 593dd3d0d7cb2f9d5eaa13980888ff3660f0cc8f Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 00:49:57 +0100 Subject: [PATCH 023/104] Moved starting the app.js to the npm install step so that is started before sauce connect. --- .travis.yml | 7 +++++-- package.json | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ac8c3a..e751796 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,11 @@ node_js: # - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: - #- sudo npm install - is automatically executed when install is missing - - node app.js & +# #- sudo npm install - is automatically executed when install is missing +# - node app.js & + # check that the web app is running: + - wget http://localhost:3000/authors + - cat authors #script: # - echo "$(date +%H:%M:%S.%N) - script begin" diff --git a/package.json b/package.json index f35b6e7..13dbd57 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "webdriverjs": "*" }, "scripts": { - "test": "mocha --reporter spec test/simple_test.js test/page_test.js" + "postinstall" : "node app.js &", + "test": "mocha --reporter spec --timeout 10000 test/simple_test.js test/page_test.js" } } \ No newline at end of file From f0543df0f60d54128cb07383980d50b54694a165 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 12:26:02 +0100 Subject: [PATCH 024/104] Start selenium-server-standalone in before_install step. --- .travis.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index e751796..9a8fe73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,21 +3,26 @@ language: node_js node_js: - '0.10' -# before_install: -# - echo "$(date +%H:%M:%S.%N) - before_install begin" -# - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar -# - java -jar selenium-server-standalone-2.39.0.jar & -# - sleep 10 -# - echo "$(date +%H:%M:%S.%N) - before_install end" +before_install: + # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. + # start this before installation to let the server be up and ready without extra waiting time. + - echo "$(date +%H:%M:%S.%N) - before_install begin" + - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + - java -jar selenium-server-standalone-2.39.0.jar & + #- sleep 10 + - echo "$(date +%H:%M:%S.%N) - before_install end" + before_script: -# #- sudo npm install - is automatically executed when install is missing -# - node app.js & + #- sudo npm install - is automatically executed when install is missing + # node app.js is started in postinstall of npm install + # - node app.js & # check that the web app is running: - wget http://localhost:3000/authors - cat authors #script: +# automatically runs npm test - therefore the call to mocha is described in package.json # - echo "$(date +%H:%M:%S.%N) - script begin" # - mocha --reporter spec From 23a1b22d4c1052d0919da781330c51ec0e39c301 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 13:58:08 +0100 Subject: [PATCH 025/104] Execute the tests locally, too. --- .travis.yml | 25 +++++++++++++++++-------- Makefile | 2 +- README => README.md | 0 package.json | 4 +++- test/page_test.js | 2 +- test/simple_test.js | 4 +++- 6 files changed, 25 insertions(+), 12 deletions(-) rename README => README.md (100%) diff --git a/.travis.yml b/.travis.yml index 9a8fe73..3383080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ before_install: - echo "$(date +%H:%M:%S.%N) - before_install begin" - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - java -jar selenium-server-standalone-2.39.0.jar & + # Download and install the chromedriver to be able to execute the browser tests locally + - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/local/bin && sudo chmod +rx /usr/local/bin/chromedriver #- sleep 10 - echo "$(date +%H:%M:%S.%N) - before_install end" @@ -20,11 +22,15 @@ before_script: # check that the web app is running: - wget http://localhost:3000/authors - cat authors + - cat authors | cut -d'/' -f1 -#script: -# automatically runs npm test - therefore the call to mocha is described in package.json -# - echo "$(date +%H:%M:%S.%N) - script begin" -# - mocha --reporter spec +script: +# automatically runs `npm test` - therefore the call to mocha is located in package.json + - echo "$(date +%H:%M:%S.%N) - script begin" + #- mocha --reporter spec + - export TEST_RUN_LOCAL=true && npm test + - echo "Run the same tests as above, but using the remote browser." + - export TEST_RUN_LOCAL=false && npm test addons: sauce_connect: true @@ -35,9 +41,12 @@ env: - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" matrix: +# - _BROWSER: "chrome" +# _PLATFORM: "Windows 8" +# _VERSION: "31" +# - _BROWSER: "firefox" +# _PLATFORM: "Linux" +# _VERSION: "26" - _BROWSER: "chrome" - _PLATFORM: "Windows 8" - _VERSION: "31" - - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "26" + _VERSION: "30" diff --git a/Makefile b/Makefile index 0eff1f4..01d7ce1 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ else endif test: launchselenium launchapp - mocha test/simple_test.js test/page_test.js + npm test .PHONY: all test launchapp launchselenium diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/package.json b/package.json index 13dbd57..bac6c80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "selenium-example", "version": "1.0.0", + "license": "MIT", "private": true, "dependencies": { "express": "*", @@ -13,6 +14,7 @@ }, "scripts": { "postinstall" : "node app.js &", + "start" : "node app.js &", "test": "mocha --reporter spec --timeout 10000 test/simple_test.js test/page_test.js" } -} \ No newline at end of file +} diff --git a/test/page_test.js b/test/page_test.js index 3666897..a4aada1 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -4,7 +4,7 @@ var assert = chai.assert, // TDD webdriverjs = require('webdriverjs'); var options = {}; -if (process.env.TRAVIS) { +if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; diff --git a/test/simple_test.js b/test/simple_test.js index 7e9901a..351e0bf 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -6,8 +6,10 @@ var client = {}; console.log('USER: %s', process.env.USER || '-'); console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); +console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); -if (process.env.TRAVIS) { + +if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; From dda86e890fb4d6e7abd5f0827523e48403fd1465 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 14:30:03 +0100 Subject: [PATCH 026/104] Added some information to README. --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index e69de29..1d9290b 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,48 @@ +Selenium example +================ + + + +This project provides two complete simple examples written in JavaScript ([node.js](http://nodejs.org/)) +using the Web Application Test Framework [Selenium](http://docs.seleniumhq.org/projects/webdriver/). +A complete description is provided from the initial author [Nathan Oehlman](https://github.com/nathanoehlman) at +[http://unexpectedliteral.com/2012/05/09/automated-functional-testing-with-javascript-using-mocha-and-selenium-part-2/](http://unexpectedliteral.com/2012/05/09/automated-functional-testing-with-javascript-using-mocha-and-selenium-part-2/). + +The used test runner is [Mocha](http://visionmedia.github.io/mocha/). +The two styles of result checking TDD and BDD are shown. Both styles are provided by the [Chai](http://chaijs.com/) Library. + + +Install the prerequisites +======================== + +For locally running tests: + +- Check that node.js and npm are installed, e.g. execute `node --version` and `npm --version`. + If this is not the case install them, e.g. + sudo apt-get install nodejs -y + curl https://npmjs.org/install.sh > install-npm.sh && sudo sh install-npm.sh +- Install the chromedriver in your system, e.g. for Linux + curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip + unzip chromedriver_linux64.zip + sudo mv chromedriver /usr/local/bin + sudo chmod +rx /usr/local/bin/chromedriver +- Install Mocha globally: + sudo npm install -g mocha +- To install the other Javascript related parts just execute + sudo npm install +- Then exceute + make + or install and launch selenium server, e.g. + curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + java -jar selenium-server-standalone-2.39.0.jar & + and start the tests with npm + npm test + + +Executing the examples +====================== + +Just call `mocha`. Mocha will then execute all the scripts in the directory named test. + From b87c88fabb47e0b4fb420451188f9cce217dd143 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 12 Jan 2014 19:21:35 +0100 Subject: [PATCH 027/104] Enable verbose logging in webdriverjs. --- test/page_test.js | 2 +- test/simple_test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index a4aada1..8328606 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -24,7 +24,7 @@ if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { port: 4445, user: process.env.SAUCE_USERNAME, key: process.env.SAUCE_ACCESS_KEY, - logLevel: 'silent' + logLevel: 'verbose' }; } else diff --git a/test/simple_test.js b/test/simple_test.js index 351e0bf..d45bcc6 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -32,7 +32,7 @@ if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { port: 4445, user: process.env.SAUCE_USERNAME, key: process.env.SAUCE_ACCESS_KEY, - logLevel: 'silent' + logLevel: 'verbose' }; } else @@ -44,7 +44,7 @@ else }; } -describe('Run a simple test using webdriverjs/Selenium.', function() { +describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { var client = {}; From 8b74c5b588df57f4c8b0f3636959cc219fbbe8e7 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 18 Jan 2014 01:30:24 +0100 Subject: [PATCH 028/104] Travis: Add the path to the chromedrvier when starting the selenium server. Add log message on uncaught exceptions. --- .travis.yml | 9 +++++---- test/page_test.js | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3383080..9fcac6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,14 @@ node_js: before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - # start this before installation to let the server be up and ready without extra waiting time. - echo "$(date +%H:%M:%S.%N) - before_install begin" + # download selenium server - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - - java -jar selenium-server-standalone-2.39.0.jar & # Download and install the chromedriver to be able to execute the browser tests locally - - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/local/bin && sudo chmod +rx /usr/local/bin/chromedriver - #- sleep 10 + - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + # start this before installation to let the server be up and ready without extra waiting time. + - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & + - sleep 10 - echo "$(date +%H:%M:%S.%N) - before_install end" diff --git a/test/page_test.js b/test/page_test.js index 8328606..9bd092b 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -3,6 +3,10 @@ var assert = chai.assert, // TDD expect = chai.expect, // BDD webdriverjs = require('webdriverjs'); +process.on('uncaughtException', function(e) { + console.log(require('util').inspect(e, {showHidden:true})); +}); + var options = {}; if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; From f72790e7b0a1b0934bc2c88178394b401171e849 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 18 Jan 2014 01:48:31 +0100 Subject: [PATCH 029/104] Travis/Saucelabs: Disable local test run. Try to execute the test on sauce labs, only. --- .travis.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9fcac6b..3f4b19e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,17 @@ language: node_js node_js: - '0.10' -before_install: - # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - - echo "$(date +%H:%M:%S.%N) - before_install begin" - # download selenium server - - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - # Download and install the chromedriver to be able to execute the browser tests locally - - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver - # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & - - sleep 10 - - echo "$(date +%H:%M:%S.%N) - before_install end" +# before_install: +# # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. +# - echo "$(date +%H:%M:%S.%N) - before_install begin" +# # download selenium server +# - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar +# # Download and install the chromedriver to be able to execute the browser tests locally +# - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver +# # start this before installation to let the server be up and ready without extra waiting time. +# - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & +# - sleep 10 +# - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: @@ -29,8 +29,8 @@ script: # automatically runs `npm test` - therefore the call to mocha is located in package.json - echo "$(date +%H:%M:%S.%N) - script begin" #- mocha --reporter spec - - export TEST_RUN_LOCAL=true && npm test - - echo "Run the same tests as above, but using the remote browser." + #- export TEST_RUN_LOCAL=true && npm test + #- echo "Run the same tests as above, but using the remote browser." - export TEST_RUN_LOCAL=false && npm test addons: From b09439f8c27b274955ea335bc8ffcbd82c43c27a Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 15:10:23 +0100 Subject: [PATCH 030/104] Change condition to use SauceLabs options. --- test/simple_test.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/simple_test.js b/test/simple_test.js index d45bcc6..5fe258b 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,12 +4,20 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('USER: %s', process.env.USER || '-'); console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); +process.on('uncaughtException', function(e) { + console.log(require('util').inspect(e, {showHidden:true})); +}); + +console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false))); +console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false))); + +//if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { +if ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false)) { + console.log('running test on SauceLabs using sauce connect...'); -if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; @@ -37,6 +45,7 @@ if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { } else { + console.log('running test locally...'); options = { desiredCapabilities: { browserName: 'chrome' From 191d05a389d4c731f04c8588f015b444a98541ec Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 16:39:02 +0100 Subject: [PATCH 031/104] Change condition to use SauceLabs options. --- test/page_test.js | 3 ++- test/simple_test.js | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 9bd092b..1c3a75e 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -8,7 +8,8 @@ process.on('uncaughtException', function(e) { }); var options = {}; -if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { +//if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { +if (process.env.TRAVIS) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; diff --git a/test/simple_test.js b/test/simple_test.js index 5fe258b..fcf1fe8 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -11,12 +11,17 @@ process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); }); +console.log('(process.env.TRAVIS == true): %s', (process.env.TRAVIS == true)); +console.log('(process.env.TRAVIS === true): %s', (process.env.TRAVIS === true)); +console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === false)); +console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); +console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) === false)); console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false))); console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false))); //if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { -if ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false)) { - console.log('running test on SauceLabs using sauce connect...'); +if (process.env.TRAVIS === true) { + console.log('running tests on SauceLabs using sauce connect...'); var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; @@ -45,11 +50,13 @@ if ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false)) { } else { - console.log('running test locally...'); + console.log('running tests locally...'); options = { desiredCapabilities: { browserName: 'chrome' - } + }, + host: 'localhost', + port: 4444 }; } From a476a2416a0741e245578c600412a5305827a267 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 17:03:48 +0100 Subject: [PATCH 032/104] Change condition to use SauceLabs options. --- test/simple_test.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/simple_test.js b/test/simple_test.js index fcf1fe8..73525bd 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -11,16 +11,21 @@ process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); }); -console.log('(process.env.TRAVIS == true): %s', (process.env.TRAVIS == true)); -console.log('(process.env.TRAVIS === true): %s', (process.env.TRAVIS === true)); -console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === false)); -console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); -console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) === false)); -console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false))); -console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false))); + +console.log('process.env.TRAVIS: %s', process.env.TRAVIS); +console.log('(process.env.TRAVIS == \'true\'): %s', (process.env.TRAVIS == 'true')); +console.log('(process.env.TRAVIS === \'true\'): %s', (process.env.TRAVIS === 'true')); + +//console.log('(process.env.TRAVIS == true): %s', (process.env.TRAVIS == true)); +//console.log('(process.env.TRAVIS === true): %s', (process.env.TRAVIS === true)); +//console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === false)); +//console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); +//console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) === false)); +//console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false))); +//console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false))); //if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { -if (process.env.TRAVIS === true) { +if (process.env.TRAVIS) { console.log('running tests on SauceLabs using sauce connect...'); var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; From ceb908cc1bb8521c235984bade1bc69659ff85c7 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 17:47:27 +0100 Subject: [PATCH 033/104] Change test app to port 80. --- .travis.yml | 4 ++-- app.js | 2 +- test/simple_test.js | 21 ++++++++++----------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f4b19e..025e1b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ before_script: # node app.js is started in postinstall of npm install # - node app.js & # check that the web app is running: - - wget http://localhost:3000/authors - - cat authors + #- wget http://localhost:3000/authors + - wget http://localhost:80/authors - cat authors | cut -d'/' -f1 script: diff --git a/app.js b/app.js index 8e4e676..b67ba66 100644 --- a/app.js +++ b/app.js @@ -11,7 +11,7 @@ var express = require('express') var app = express(); // Configuration -app.set('port', process.env.PORT || 3000); +app.set('port', process.env.PORT || 80); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); diff --git a/test/simple_test.js b/test/simple_test.js index 73525bd..f20fa31 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -13,20 +13,18 @@ process.on('uncaughtException', function(e) { console.log('process.env.TRAVIS: %s', process.env.TRAVIS); -console.log('(process.env.TRAVIS == \'true\'): %s', (process.env.TRAVIS == 'true')); console.log('(process.env.TRAVIS === \'true\'): %s', (process.env.TRAVIS === 'true')); -//console.log('(process.env.TRAVIS == true): %s', (process.env.TRAVIS == true)); -//console.log('(process.env.TRAVIS === true): %s', (process.env.TRAVIS === true)); -//console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === false)); -//console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); -//console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) === false)); -//console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false))); -//console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === true) && (process.env.TEST_RUN_LOCAL === false))); +console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === 'false')); +console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); +console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) !== 'true')); +console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === 'true') && !(process.env.TEST_RUN_LOCAL || false))); +console.log('process.env.TRAVIS === true && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL === 'false'))); //if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { -if (process.env.TRAVIS) { +if ((process.env.TRAVIS === 'true')) { console.log('running tests on SauceLabs using sauce connect...'); + console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; @@ -40,7 +38,7 @@ if (process.env.TRAVIS) { version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run single page test using webdriverjs/Selenium.', + name: 'Run a \'simple test\' using webdriverjs/Selenium.', }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -90,7 +88,8 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { beforeEach(function(done) { this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test - client.url('http://localhost:3000') + //client.url('http://localhost:3000') + client.url('http://localhost:80') .call(done); }); From 2b05071695b1a6728db57d890c09a5d04ab5f0b5 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 17:55:59 +0100 Subject: [PATCH 034/104] Change test app to port 80. --- .travis.yml | 3 ++- app.js | 5 +++-- test/simple_test.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 025e1b8..4e06d08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ before_script: # - node app.js & # check that the web app is running: #- wget http://localhost:3000/authors - - wget http://localhost:80/authors + - wget http://localhost || true + - wget http://localhost/authors || true - cat authors | cut -d'/' -f1 script: diff --git a/app.js b/app.js index b67ba66..e8d47db 100644 --- a/app.js +++ b/app.js @@ -11,7 +11,8 @@ var express = require('express') var app = express(); // Configuration -app.set('port', process.env.PORT || 80); +//app.set('port', process.env.PORT || 3000); +app.set('port', 80); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); @@ -23,7 +24,7 @@ app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only -if ('development' == app.get('env')) { +if ('development' === app.get('env')) { app.use(express.errorHandler()); } diff --git a/test/simple_test.js b/test/simple_test.js index f20fa31..888c07e 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -89,7 +89,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test //client.url('http://localhost:3000') - client.url('http://localhost:80') + client.url('http://localhost') .call(done); }); From a89ed85206853a3a511537fa4271c4d7b3b03186 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 18:14:29 +0100 Subject: [PATCH 035/104] Change test app to port 3000, again. --- .travis.yml | 5 ++--- app.js | 3 +-- test/simple_test.js | 9 +++------ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e06d08..b7501f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,8 @@ before_script: # node app.js is started in postinstall of npm install # - node app.js & # check that the web app is running: - #- wget http://localhost:3000/authors - - wget http://localhost || true - - wget http://localhost/authors || true + - wget http://localhost:3000/authors || true + # show the beginning of the file - the whole file is not displayed within TRAVIS (because line is too long?) - cat authors | cut -d'/' -f1 script: diff --git a/app.js b/app.js index e8d47db..7acf0a9 100644 --- a/app.js +++ b/app.js @@ -11,8 +11,7 @@ var express = require('express') var app = express(); // Configuration -//app.set('port', process.env.PORT || 3000); -app.set('port', 80); +app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.favicon()); diff --git a/test/simple_test.js b/test/simple_test.js index 888c07e..9cb9940 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -16,10 +16,7 @@ console.log('process.env.TRAVIS: %s', process.env.TRAVIS); console.log('(process.env.TRAVIS === \'true\'): %s', (process.env.TRAVIS === 'true')); console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === 'false')); -console.log('(process.env.TEST_RUN_LOCAL || false): %s', (process.env.TEST_RUN_LOCAL || false)); -console.log('((process.env.TEST_RUN_LOCAL || false) === false): %s', ((process.env.TEST_RUN_LOCAL || false) !== 'true')); -console.log('process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === 'true') && !(process.env.TEST_RUN_LOCAL || false))); -console.log('process.env.TRAVIS === true && !(process.env.TEST_RUN_LOCAL || false): %s', ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL === 'false'))); +console.log('process.env.TRAVIS === true && (process.env.TEST_RUN_LOCAL !== true): %s', ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true'))); //if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { if ((process.env.TRAVIS === 'true')) { @@ -38,7 +35,7 @@ if ((process.env.TRAVIS === 'true')) { version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run a \'simple test\' using webdriverjs/Selenium.', + name: 'Run a \'simple test\' using webdriverjs/Selenium.' }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', @@ -89,7 +86,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test //client.url('http://localhost:3000') - client.url('http://localhost') + client.url('https://google.com') .call(done); }); From e513ccf199912e996ce7195d889b4d1f82afe45d Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 18:30:38 +0100 Subject: [PATCH 036/104] Added a test case accessing a page on the internet. --- package.json | 2 +- test/simple_internet.js | 87 +++++++++++++++++++++++++++++++++++++++++ test/simple_test.js | 15 ++----- 3 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 test/simple_internet.js diff --git a/package.json b/package.json index bac6c80..89244ce 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,6 @@ "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 10000 test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 30000 test/simple_internet.js test/simple_test.js test/page_test.js" } } diff --git a/test/simple_internet.js b/test/simple_internet.js new file mode 100644 index 0000000..496edd1 --- /dev/null +++ b/test/simple_internet.js @@ -0,0 +1,87 @@ +var assert = require('chai').assert, + webdriverjs = require('webdriverjs'); +var env = GLOBAL.env = {}; +var client = {}; + +console.log('process.env.TRAVIS: %s', process.env.TRAVIS || 'no'); +console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); + +process.on('uncaughtException', function(e) { + console.log(require('util').inspect(e, {showHidden:true})); +}); + +if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { + console.log('running tests on SauceLabs using sauce connect...'); + console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); + + var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; + var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + console.log('BROWSERNAME: ' + BROWSERNAME); + console.log('BROWSERVERSION: ' + BROWSERVERSION); + console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + + var options = { desiredCapabilities: { + browserName: BROWSERNAME, + version: BROWSERVERSION, + platform: BROWSERPLATFORM, + tags: ['examples'], + name: 'Run a \'simple internet\' test using webdriverjs/Selenium.' + }, + // for w/o sauce connect + // host: 'ondemand.saucelabs.com', + // port: 80, + // use with sauce connect: + host: 'localhost', + port: 4445, + user: process.env.SAUCE_USERNAME, + key: process.env.SAUCE_ACCESS_KEY, + logLevel: 'verbose' + }; +} +else +{ + console.log('running tests locally...'); + options = { + desiredCapabilities: { + browserName: 'chrome' + }, + host: 'localhost', + port: 4444 + }; +} + +describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function() { + + var client = {}; + + before(function(done) { + this.timeout(10000); + client = webdriverjs.remote(options); + + client.init() + .call(done); + }); + + beforeEach(function(done) { + this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. + // Navigate to the URL for each test + client.url('https://google.com') + .call(done); + }); + + it('should be able to view page on internet, checks the title only using TDD style check', function(done) { + // uses helper command getTitle() + client.getTitle(function(err, result) { + assert.strictEqual(err, null); + //console.log('Title was: ' + result); + assert.strictEqual(result, 'Google'); // TDD + }) + .call(done); + }); + + after(function(done) { + client.end().call(done); + }); + +}); diff --git a/test/simple_test.js b/test/simple_test.js index 9cb9940..5788d8b 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,22 +4,14 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('TRAVIS: %s', process.env.TRAVIS || 'no'); +console.log('process.env.TRAVIS: %s', process.env.TRAVIS || '-'); console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); }); - -console.log('process.env.TRAVIS: %s', process.env.TRAVIS); -console.log('(process.env.TRAVIS === \'true\'): %s', (process.env.TRAVIS === 'true')); - -console.log('(process.env.TEST_RUN_LOCAL === false): %s', (process.env.TEST_RUN_LOCAL === 'false')); -console.log('process.env.TRAVIS === true && (process.env.TEST_RUN_LOCAL !== true): %s', ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true'))); - -//if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { -if ((process.env.TRAVIS === 'true')) { +if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { console.log('running tests on SauceLabs using sauce connect...'); console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); @@ -85,8 +77,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { beforeEach(function(done) { this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test - //client.url('http://localhost:3000') - client.url('https://google.com') + client.url('http://localhost:3000') .call(done); }); From d8ace4bd376ff4d75615784e9d18a4bc0f737f0c Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 18:54:40 +0100 Subject: [PATCH 037/104] Added build id and tunnel-identifier. --- test/page_test.js | 21 ++++++++++++++++++--- test/simple_internet.js | 11 +++++++++-- test/simple_test.js | 10 +++++++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 1c3a75e..f11ca91 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -8,18 +8,33 @@ process.on('uncaughtException', function(e) { }); var options = {}; -//if (process.env.TRAVIS && !(process.env.TEST_RUN_LOCAL || false)) { -if (process.env.TRAVIS) { + +process.on('uncaughtException', function(e) { + console.log(require('util').inspect(e, {showHidden:true})); +}); + +if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; + var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; + var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + +// console.log('BROWSERNAME: ' + BROWSERNAME); +// console.log('BROWSERVERSION: ' + BROWSERVERSION); +// console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); +// console.log('BUILDID: ' + BUILDID); +// console.log('TUNNELIDENTIFIER: ' + TUNNELIDENTIFIER); var options = { desiredCapabilities: { browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run web app \'page test\' using webdriverjs/Selenium.' + name: 'Run web app \'page test\' using webdriverjs/Selenium.', + build: BUILDID, + 'tunnel-identifier': TUNNELIDENTIFIER }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', diff --git a/test/simple_internet.js b/test/simple_internet.js index 496edd1..363bc74 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -12,21 +12,28 @@ process.on('uncaughtException', function(e) { if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { console.log('running tests on SauceLabs using sauce connect...'); - console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; + var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; + var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + console.log('BUILDID: ' + BUILDID); + console.log('TUNNELIDENTIFIER: ' + TUNNELIDENTIFIER); var options = { desiredCapabilities: { browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run a \'simple internet\' test using webdriverjs/Selenium.' + name: 'Run a \'simple internet\' test using webdriverjs/Selenium.', + build: BUILDID, + 'tunnel-identifier': TUNNELIDENTIFIER }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', diff --git a/test/simple_test.js b/test/simple_test.js index 5788d8b..9d3a06c 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -18,16 +18,24 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; + var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; + var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); + console.log('BUILDID: ' + BUILDID); + console.log('TUNNELIDENTIFIER: ' + TUNNELIDENTIFIER); var options = { desiredCapabilities: { browserName: BROWSERNAME, version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run a \'simple test\' using webdriverjs/Selenium.' + name: 'Run a \'simple test\' using webdriverjs/Selenium.', + build: BUILDID, + 'tunnel-identifier': TUNNELIDENTIFIER }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', From c507431bfa675f4958186e54855ad53068ee1ba0 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 19:10:40 +0100 Subject: [PATCH 038/104] Corrected the tunnel-identifier. --- test/page_test.js | 3 +-- test/simple_internet.js | 3 +-- test/simple_test.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index f11ca91..32b7a3e 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -18,8 +18,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; - var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; - var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index 363bc74..1e3018c 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -17,8 +17,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; - var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; - var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index 9d3a06c..fcf3d8c 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -19,8 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; - var BUILDNUMBER = process.env.TRAVIS_BUILD_NUMBER || 'unknown-buildnumber'; - var TUNNELIDENTIFIER = 'TRAVIS #' + BUILDNUMBER + ' (' + BUILDID + ')'; + var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From 4038ea948594603f86d94e8d9c6d18944b4017dc Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 19:29:26 +0100 Subject: [PATCH 039/104] Locate the whole test of internet test in a single function. Add Windows test, too. --- .travis.yml | 3 +++ test/simple_internet.js | 37 +++++++++++-------------------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index b7501f1..972e251 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,9 @@ env: - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" matrix: + - _BROWSER: "chrome" + _PLATFORM: "Windows 7" + _VERSION: "31" # - _BROWSER: "chrome" # _PLATFORM: "Windows 8" # _VERSION: "31" diff --git a/test/simple_internet.js b/test/simple_internet.js index 1e3018c..a3eeb7b 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -59,35 +59,20 @@ else describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function() { - var client = {}; - - before(function(done) { - this.timeout(10000); - client = webdriverjs.remote(options); + it('should be able to view page on internet, checks the title only using TDD style check', function(done) { + this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. + var client = webdriverjs.remote(options); client.init() + .url('https://google.com') + // uses helper command getTitle() + .getTitle(function(err, result) { + assert.strictEqual(err, null); + console.log('Title was: ' + result); + assert.strictEqual(result, 'Google'); + }) + .end() .call(done); }); - beforeEach(function(done) { - this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. - // Navigate to the URL for each test - client.url('https://google.com') - .call(done); - }); - - it('should be able to view page on internet, checks the title only using TDD style check', function(done) { - // uses helper command getTitle() - client.getTitle(function(err, result) { - assert.strictEqual(err, null); - //console.log('Title was: ' + result); - assert.strictEqual(result, 'Google'); // TDD - }) - .call(done); - }); - - after(function(done) { - client.end().call(done); - }); - }); From e2f2d17f320f52a28575e60f7bd459d39ad090e1 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 20:08:48 +0100 Subject: [PATCH 040/104] Increased time outs. --- package.json | 2 +- test/page_test.js | 4 ++-- test/simple_internet.js | 2 +- test/simple_test.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 89244ce..7a86ddb 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,6 @@ "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 30000 test/simple_internet.js test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 60000 test/simple_internet.js test/simple_test.js test/page_test.js" } } diff --git a/test/page_test.js b/test/page_test.js index 32b7a3e..bdc102c 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -62,7 +62,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { before(function(done) { // console.log('--before--'); - this.timeout(10000); + this.timeout(60000); //client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); client = webdriverjs.remote(options); @@ -80,7 +80,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { beforeEach(function(done) { //console.log('--beforeEach--'); - this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(30000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); diff --git a/test/simple_internet.js b/test/simple_internet.js index a3eeb7b..096b97b 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -60,7 +60,7 @@ else describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function() { it('should be able to view page on internet, checks the title only using TDD style check', function(done) { - this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. var client = webdriverjs.remote(options); client.init() diff --git a/test/simple_test.js b/test/simple_test.js index fcf3d8c..00c9f14 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -64,7 +64,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { var client = {}; before(function(done) { - this.timeout(10000); + this.timeout(60000); client = webdriverjs.remote(options); // Add a helper command @@ -82,7 +82,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { }); beforeEach(function(done) { - this.timeout(10000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(30000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); From 160e2c439d25dea36b3d12bda2c1ab7d2f3234ce Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 20:20:14 +0100 Subject: [PATCH 041/104] Select a selenium version that is the same as the one used for local tests. --- test/page_test.js | 4 +++- test/simple_internet.js | 5 ++++- test/simple_test.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index bdc102c..9be7f0b 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -19,6 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; + var SELENIUMVERSION = '2.39.0'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); @@ -33,7 +34,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) tags: ['examples'], name: 'Run web app \'page test\' using webdriverjs/Selenium.', build: BUILDID, - 'tunnel-identifier': TUNNELIDENTIFIER + 'tunnel-identifier': TUNNELIDENTIFIER, + 'selenium-version': SELENIUMVERSION }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', diff --git a/test/simple_internet.js b/test/simple_internet.js index 096b97b..eacae5f 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -18,12 +18,14 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; + var SELENIUMVERSION = '2.39.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); console.log('BROWSERPLATFORM: ' + BROWSERPLATFORM); console.log('BUILDID: ' + BUILDID); console.log('TUNNELIDENTIFIER: ' + TUNNELIDENTIFIER); + console.log('SELENIUMVERSION: ' + SELENIUMVERSION); var options = { desiredCapabilities: { browserName: BROWSERNAME, @@ -32,7 +34,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) tags: ['examples'], name: 'Run a \'simple internet\' test using webdriverjs/Selenium.', build: BUILDID, - 'tunnel-identifier': TUNNELIDENTIFIER + 'tunnel-identifier': TUNNELIDENTIFIER, + 'selenium-version': SELENIUMVERSION }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', diff --git a/test/simple_test.js b/test/simple_test.js index 00c9f14..144ccfa 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -20,6 +20,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; + var SELENIUMVERSION = '2.39.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); @@ -34,7 +35,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) tags: ['examples'], name: 'Run a \'simple test\' using webdriverjs/Selenium.', build: BUILDID, - 'tunnel-identifier': TUNNELIDENTIFIER + 'tunnel-identifier': TUNNELIDENTIFIER, + 'selenium-version': SELENIUMVERSION }, // for w/o sauce connect // host: 'ondemand.saucelabs.com', From 88f4bb907625aac75523f46fd175c10e411bd8f3 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 21:08:37 +0100 Subject: [PATCH 042/104] Start selenium server again and add saucelabs to the devDependencies. --- .travis.yml | 31 +++++++++++++++++-------------- package.json | 3 ++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 972e251..bef8506 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,17 @@ language: node_js node_js: - '0.10' -# before_install: -# # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. -# - echo "$(date +%H:%M:%S.%N) - before_install begin" -# # download selenium server -# - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar -# # Download and install the chromedriver to be able to execute the browser tests locally -# - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver -# # start this before installation to let the server be up and ready without extra waiting time. -# - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & -# - sleep 10 -# - echo "$(date +%H:%M:%S.%N) - before_install end" +before_install: + # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. + - echo "$(date +%H:%M:%S.%N) - before_install begin" + # download selenium server + - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + # Download and install the chromedriver to be able to execute the browser tests locally + - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + # start this before installation to let the server be up and ready without extra waiting time. + - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & + - sleep 10 + - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: @@ -42,9 +42,9 @@ env: - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" matrix: - - _BROWSER: "chrome" - _PLATFORM: "Windows 7" - _VERSION: "31" +# - _BROWSER: "chrome" +# _PLATFORM: "Windows 7" +# _VERSION: "31" # - _BROWSER: "chrome" # _PLATFORM: "Windows 8" # _VERSION: "31" @@ -54,3 +54,6 @@ env: - _BROWSER: "chrome" _PLATFORM: "Linux" _VERSION: "30" + - _BROWSER: "firefox" + _PLATFORM: "Linux" + _VERSION: "25" diff --git a/package.json b/package.json index 7a86ddb..aab2533 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "devDependencies": { "mocha": "*", "chai": "*", - "webdriverjs": "*" + "webdriverjs": "*", + "saucelabs": "~0.1.1" }, "scripts": { "postinstall" : "node app.js &", From 4815bb08e90c0b7fdda3342f7b38df20cd093fcd Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 21:22:50 +0100 Subject: [PATCH 043/104] Copied example from webdriverjs. --- test/example_from_webdriverjs.js | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/example_from_webdriverjs.js diff --git a/test/example_from_webdriverjs.js b/test/example_from_webdriverjs.js new file mode 100644 index 0000000..249c799 --- /dev/null +++ b/test/example_from_webdriverjs.js @@ -0,0 +1,39 @@ +var chai = require('chai'), + assert = chai.assert, + expect = chai.expect, + webdriverjs = require('../index'); + +describe('my webdriverjs tests', function(){ + + this.timeout(99999999); + var client = {}; + + before(function(done){ + client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); + client.init(done); + }); + + it('Github test',function(done) { + client + .url('https://github.com/') + .getElementSize('.header-logo-wordmark', function(err, result) { + assert.equal(null, err); + assert.strictEqual(result.height , 32); + assert.strictEqual(result.width, 89); + }) + .getTitle(function(err, title) { + assert.equal(null, err); + assert.strictEqual(title,'GitHub · Build software better, together.'); + }) + .getCssProperty('a[href="/plans"]', 'color', function(err, result){ + assert.equal(null, err); + assert.strictEqual(result, 'rgba(65,131,196,1)'); + }) + .call(done); + }); + + after(function(done) { + client.end(done); + }); +}); + From c19562433659c6441460977d12ddd38fbf9997bc Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 21:31:05 +0100 Subject: [PATCH 044/104] Added test from webdriverjs using phantomjs. --- .travis.yml | 2 ++ package.json | 2 +- test/example_from_webdriverjs.js | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bef8506..e9c311d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ before_install: - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & + # install phantomjs, too: + - sudo apt-get install phantomjs - sleep 10 - echo "$(date +%H:%M:%S.%N) - before_install end" diff --git a/package.json b/package.json index aab2533..94b8b24 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,6 @@ "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 60000 test/simple_internet.js test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 60000 test/example_from_webdriverjs.js test/simple_internet.js test/simple_test.js test/page_test.js" } } diff --git a/test/example_from_webdriverjs.js b/test/example_from_webdriverjs.js index 249c799..02991ed 100644 --- a/test/example_from_webdriverjs.js +++ b/test/example_from_webdriverjs.js @@ -1,7 +1,9 @@ +// for this test phantomjs must be installed, e.g. +// sudo apt-get install phantomjs var chai = require('chai'), assert = chai.assert, expect = chai.expect, - webdriverjs = require('../index'); + webdriverjs = require('webdriverjs'); describe('my webdriverjs tests', function(){ From 25f1d8cea90aeafaeb2756f82d1d30e906354572 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 19 Jan 2014 22:25:52 +0100 Subject: [PATCH 045/104] Added test from webdriverjs using phantomjs. --- test/example_from_webdriverjs.js | 4 ++-- test/simple_internet.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/example_from_webdriverjs.js b/test/example_from_webdriverjs.js index 02991ed..0ebf27d 100644 --- a/test/example_from_webdriverjs.js +++ b/test/example_from_webdriverjs.js @@ -20,12 +20,12 @@ describe('my webdriverjs tests', function(){ .url('https://github.com/') .getElementSize('.header-logo-wordmark', function(err, result) { assert.equal(null, err); - assert.strictEqual(result.height , 32); + assert.strictEqual(result.height, 32); assert.strictEqual(result.width, 89); }) .getTitle(function(err, title) { assert.equal(null, err); - assert.strictEqual(title,'GitHub · Build software better, together.'); + assert.strictEqual(title, 'GitHub · Build software better, together.'); }) .getCssProperty('a[href="/plans"]', 'color', function(err, result){ assert.equal(null, err); diff --git a/test/simple_internet.js b/test/simple_internet.js index eacae5f..4790384 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -62,11 +62,15 @@ else describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function() { + before(function(done){ + client = webdriverjs.remote(options); + client.init(done); + }); + it('should be able to view page on internet, checks the title only using TDD style check', function(done) { this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. - var client = webdriverjs.remote(options); - client.init() + client .url('https://google.com') // uses helper command getTitle() .getTitle(function(err, result) { @@ -74,8 +78,11 @@ describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function( console.log('Title was: ' + result); assert.strictEqual(result, 'Google'); }) - .end() .call(done); }); + after(function(done) { + client.end(done); + }); + }); From c7655d502fa71330ba65ca65bec311700484ad2b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Fri, 24 Jan 2014 21:10:14 +0100 Subject: [PATCH 046/104] Added version numbers and to a new branch of webdriverjs. --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 94b8b24..1bce4dc 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,13 @@ "license": "MIT", "private": true, "dependencies": { - "express": "*", - "jade": ">= 0.0.1" + "express": "~3.4.8", + "jade": "~1.1.5" }, "devDependencies": { - "mocha": "*", - "chai": "*", - "webdriverjs": "*", + "mocha": "~1.17.1", + "chai": "~1.8.1", + "webdriverjs": "camme/webdriverjs#issue-141", "saucelabs": "~0.1.1" }, "scripts": { From 079b081ac0b944e92d16a7e2c975adace0304fd8 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Fri, 24 Jan 2014 22:35:43 +0100 Subject: [PATCH 047/104] Add badges for build status and dependencies. --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1d9290b..01a2efa 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ Selenium example ================ - +[![Build Status](https://travis-ci.org/leutloff/selenium-example.png)](https://travis-ci.org/leutloff/selenium-example) +[![Dependencies](https://gemnasium.com/leutloff/selenium-example.png)](https://gemnasium.com/leutloff/selenium-example) + This project provides two complete simple examples written in JavaScript ([node.js](http://nodejs.org/)) using the Web Application Test Framework [Selenium](http://docs.seleniumhq.org/projects/webdriver/). diff --git a/package.json b/package.json index 1bce4dc..7004f8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "private": true, "dependencies": { From ab52985afacee5bf6a7a94f15c6d6e7cf14fd175 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 25 Jan 2014 17:04:35 +0100 Subject: [PATCH 048/104] Changed dependency to webdriverjs to the released version, again. Minor improvements to README.md --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01a2efa..fd7c43a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Selenium example ================ -[![Build Status](https://travis-ci.org/leutloff/selenium-example.png)](https://travis-ci.org/leutloff/selenium-example) +[![Build Status](https://travis-ci.org/leutloff/selenium-example.png?branch=master)](https://travis-ci.org/leutloff/selenium-example) [![Dependencies](https://gemnasium.com/leutloff/selenium-example.png)](https://gemnasium.com/leutloff/selenium-example) @@ -11,7 +11,7 @@ A complete description is provided from the initial author [Nathan Oehlman](http [http://unexpectedliteral.com/2012/05/09/automated-functional-testing-with-javascript-using-mocha-and-selenium-part-2/](http://unexpectedliteral.com/2012/05/09/automated-functional-testing-with-javascript-using-mocha-and-selenium-part-2/). The used test runner is [Mocha](http://visionmedia.github.io/mocha/). -The two styles of result checking TDD and BDD are shown. Both styles are provided by the [Chai](http://chaijs.com/) Library. +Two styles of result checking TDD and BDD are shown. Both styles are provided by the [Chai](http://chaijs.com/) Library. Install the prerequisites @@ -23,7 +23,7 @@ For locally running tests: If this is not the case install them, e.g. sudo apt-get install nodejs -y curl https://npmjs.org/install.sh > install-npm.sh && sudo sh install-npm.sh -- Install the chromedriver in your system, e.g. for Linux +- Install the chromedriver for your system, e.g. for Linux curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin diff --git a/package.json b/package.json index 7004f8b..2e0bfcf 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "devDependencies": { "mocha": "~1.17.1", "chai": "~1.8.1", - "webdriverjs": "camme/webdriverjs#issue-141", + "webdriverjs": ">=1.3.1", "saucelabs": "~0.1.1" }, "scripts": { From a406b19a5157d8ea09d6e8c35da6ee129a9eb8b0 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 25 Jan 2014 17:27:16 +0100 Subject: [PATCH 049/104] Some cleanup: Change browser tests. Removed phantomjs example from webdriverjs. --- .travis.yml | 20 ++++++---------- package.json | 9 +++---- test/example_from_webdriverjs.js | 41 -------------------------------- test/page_test.js | 1 - test/simple_internet.js | 4 ++-- test/simple_test.js | 4 ++-- 6 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 test/example_from_webdriverjs.js diff --git a/.travis.yml b/.travis.yml index e9c311d..53f257b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,18 +44,12 @@ env: - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" matrix: -# - _BROWSER: "chrome" -# _PLATFORM: "Windows 7" -# _VERSION: "31" -# - _BROWSER: "chrome" -# _PLATFORM: "Windows 8" -# _VERSION: "31" -# - _BROWSER: "firefox" -# _PLATFORM: "Linux" -# _VERSION: "26" - - _BROWSER: "chrome" - _PLATFORM: "Linux" - _VERSION: "30" - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "25" + _VERSION: "26" + - _BROWSER: "ie" + _PLATFORM: "Windows 8.1" + _VERSION: "11" + - _BROWSER: "chrome" + _PLATFORM: "Windows 7" + _VERSION: "31" diff --git a/package.json b/package.json index 2e0bfcf..3fb5445 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,15 @@ "jade": "~1.1.5" }, "devDependencies": { - "mocha": "~1.17.1", "chai": "~1.8.1", - "webdriverjs": ">=1.3.1", - "saucelabs": "~0.1.1" + "mocha": "~1.17.1", + "saucelabs": "~0.1.1", + "util": "~0.10.2", + "webdriverjs": ">=1.3.1" }, "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 60000 test/example_from_webdriverjs.js test/simple_internet.js test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 60000 test/simple_internet.js test/simple_test.js test/page_test.js" } } diff --git a/test/example_from_webdriverjs.js b/test/example_from_webdriverjs.js deleted file mode 100644 index 0ebf27d..0000000 --- a/test/example_from_webdriverjs.js +++ /dev/null @@ -1,41 +0,0 @@ -// for this test phantomjs must be installed, e.g. -// sudo apt-get install phantomjs -var chai = require('chai'), - assert = chai.assert, - expect = chai.expect, - webdriverjs = require('webdriverjs'); - -describe('my webdriverjs tests', function(){ - - this.timeout(99999999); - var client = {}; - - before(function(done){ - client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); - client.init(done); - }); - - it('Github test',function(done) { - client - .url('https://github.com/') - .getElementSize('.header-logo-wordmark', function(err, result) { - assert.equal(null, err); - assert.strictEqual(result.height, 32); - assert.strictEqual(result.width, 89); - }) - .getTitle(function(err, title) { - assert.equal(null, err); - assert.strictEqual(title, 'GitHub · Build software better, together.'); - }) - .getCssProperty('a[href="/plans"]', 'color', function(err, result){ - assert.equal(null, err); - assert.strictEqual(result, 'rgba(65,131,196,1)'); - }) - .call(done); - }); - - after(function(done) { - client.end(done); - }); -}); - diff --git a/test/page_test.js b/test/page_test.js index 9be7f0b..c2a6251 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -66,7 +66,6 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { // console.log('--before--'); this.timeout(60000); - //client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} }); client = webdriverjs.remote(options); // start the session diff --git a/test/simple_internet.js b/test/simple_internet.js index 4790384..1a44e57 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -3,8 +3,8 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('process.env.TRAVIS: %s', process.env.TRAVIS || 'no'); -console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); +//console.log('process.env.TRAVIS: %s', process.env.TRAVIS || 'no'); +//console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); diff --git a/test/simple_test.js b/test/simple_test.js index 144ccfa..f667938 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -4,8 +4,8 @@ var assert = require('chai').assert, var env = GLOBAL.env = {}; var client = {}; -console.log('process.env.TRAVIS: %s', process.env.TRAVIS || '-'); -console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); +//console.log('process.env.TRAVIS: %s', process.env.TRAVIS || '-'); +//console.log('TEST_RUN_LOCAL: %s', process.env.TEST_RUN_LOCAL || '-'); process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); From 9572205db132cccf901273bab7e4f1c0503cfe55 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 27 Jan 2014 19:51:52 +0100 Subject: [PATCH 050/104] Windosw 8.1 seams not work. Add firefox on Win7 to the test matrix. --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53f257b..9bb3956 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,8 +48,11 @@ env: _PLATFORM: "Linux" _VERSION: "26" - _BROWSER: "ie" - _PLATFORM: "Windows 8.1" - _VERSION: "11" + _PLATFORM: "Windows 8" + _VERSION: "10" - _BROWSER: "chrome" _PLATFORM: "Windows 7" _VERSION: "31" + - _BROWSER: "firefox" + _PLATFORM: "Windows 7" + _VERSION: "26" From 4ac6f34e53ba514ce6af0d9333431f92705bc825 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 27 Jan 2014 20:22:25 +0100 Subject: [PATCH 051/104] Platforms must be using underscore instead of a blank. --- .travis.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9bb3956..39abdfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,12 +47,15 @@ env: - _BROWSER: "firefox" _PLATFORM: "Linux" _VERSION: "26" - - _BROWSER: "ie" - _PLATFORM: "Windows 8" - _VERSION: "10" - - _BROWSER: "chrome" - _PLATFORM: "Windows 7" - _VERSION: "31" - _BROWSER: "firefox" - _PLATFORM: "Windows 7" + _PLATFORM: "Windows_7" _VERSION: "26" + - _BROWSER: "chrome" + _PLATFORM: "Windows_7" + _VERSION: "31" + - _BROWSER: "ie" + _PLATFORM: "Windows_8.1" + _VERSION: "11" + - _BROWSER: "ie" + _PLATFORM: "Windows_8" + _VERSION: "10" From fc93524cde472ee7f94b31532e2b9d0a6388e4a1 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 27 Jan 2014 20:43:35 +0100 Subject: [PATCH 052/104] Replace underscores with spaces inside javascript, again. --- .travis.yml | 1 + test/page_test.js | 4 ++-- test/simple_internet.js | 4 ++-- test/simple_test.js | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39abdfc..b4b0255 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,7 @@ env: - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" +# Use underscore for spaces in platfrom and browser names matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" diff --git a/test/page_test.js b/test/page_test.js index c2a6251..c17cde9 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -14,9 +14,9 @@ process.on('uncaughtException', function(e) { }); if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { - var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERNAME = (process.env._BROWSER || process.env.BROWSER || 'chrome').replace(/_/g,' '); var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; - var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; var SELENIUMVERSION = '2.39.0'; diff --git a/test/simple_internet.js b/test/simple_internet.js index 1a44e57..efd332e 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -13,9 +13,9 @@ process.on('uncaughtException', function(e) { if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { console.log('running tests on SauceLabs using sauce connect...'); - var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERNAME = (process.env._BROWSER || process.env.BROWSER || 'chrome').replace(/_/g,' '); var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; - var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; var SELENIUMVERSION = '2.39.0'; diff --git a/test/simple_test.js b/test/simple_test.js index f667938..8bdafba 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -15,9 +15,9 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) console.log('running tests on SauceLabs using sauce connect...'); console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); - var BROWSERNAME = process.env._BROWSER || process.env.BROWSER || 'chrome'; + var BROWSERNAME = (process.env._BROWSER || process.env.BROWSER || 'chrome').replace(/_/g,' '); var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; - var BROWSERPLATFORM = process.env._PLATFORM || process.env.PLATFORM || 'Linux'; + var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; var SELENIUMVERSION = '2.39.0'; From bbec61f143909de1561422dcf4af6ddfc16e8592 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 27 Jan 2014 21:58:10 +0100 Subject: [PATCH 053/104] Corrected name for ie in matrix of Travis for SauceLabs. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b4b0255..a59eb9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ env: - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" -# Use underscore for spaces in platfrom and browser names +# Use underscore for spaces in platfrom and browser names - they are replaced inside js. matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" @@ -54,9 +54,9 @@ env: - _BROWSER: "chrome" _PLATFORM: "Windows_7" _VERSION: "31" - - _BROWSER: "ie" + - _BROWSER: "internet_explorer" _PLATFORM: "Windows_8.1" _VERSION: "11" - - _BROWSER: "ie" + - _BROWSER: "internet_explorer" _PLATFORM: "Windows_8" _VERSION: "10" From 0c3b6f44a14814c81ad59dd4ec61abac5629d9c4 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 17 Mar 2014 19:38:54 +0100 Subject: [PATCH 054/104] Increment version of mocha. Bump version. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3fb5445..3fa61b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "private": true, "dependencies": { @@ -9,7 +9,7 @@ }, "devDependencies": { "chai": "~1.8.1", - "mocha": "~1.17.1", + "mocha": "~1.18.0", "saucelabs": "~0.1.1", "util": "~0.10.2", "webdriverjs": ">=1.3.1" From dff2a389e1d31d7bc00fe3bba6f39e24608400a3 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 30 Mar 2014 20:05:07 +0200 Subject: [PATCH 055/104] Just update the version dependencies. --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3fa61b8..6ded764 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,14 @@ "license": "MIT", "private": true, "dependencies": { - "express": "~3.4.8", - "jade": "~1.1.5" + "express": "~3.5.1", + "jade": "~1.3.0" }, "devDependencies": { - "chai": "~1.8.1", - "mocha": "~1.18.0", + "chai": "~1.9.1", + "mocha": "~1.18.2", "saucelabs": "~0.1.1", - "util": "~0.10.2", + "util": "~0.10.3", "webdriverjs": ">=1.3.1" }, "scripts": { From 9e973d5c285a5065d82a34088dd12b27b13bf036 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 30 Mar 2014 20:30:42 +0200 Subject: [PATCH 056/104] Update version numbers of tested browsers. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a59eb9c..68893d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,16 +47,16 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "26" + _VERSION: "28" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "26" + _VERSION: "28" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "31" + _VERSION: "33" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_8.1" _VERSION: "11" - _BROWSER: "internet_explorer" - _PLATFORM: "Windows_8" + _PLATFORM: "Windows_7" _VERSION: "10" From c9a1f093203c2a4fcdb646b0f6f4d56fd790ad85 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 30 Mar 2014 20:33:00 +0200 Subject: [PATCH 057/104] Increase allowed start up time of browsers. Uses Selenium server from moved location. Use newer selenium server, too. --- .travis.yml | 5 +++-- test/page_test.js | 4 ++-- test/simple_internet.js | 2 +- test/simple_test.js | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68893d8..2f3415b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,12 @@ before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - echo "$(date +%H:%M:%S.%N) - before_install begin" # download selenium server - - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + #- curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar + - curl -O http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar # Download and install the chromedriver to be able to execute the browser tests locally - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.39.0.jar -Dwebdriver.chrome.driver=./chromedriver & + - java -jar selenium-server-standalone-2.41.0.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs - sleep 10 diff --git a/test/page_test.js b/test/page_test.js index c17cde9..842f73e 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -19,7 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.39.0'; + var SELENIUMVERSION = '2.41.0'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); @@ -81,7 +81,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { beforeEach(function(done) { //console.log('--beforeEach--'); - this.timeout(30000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); diff --git a/test/simple_internet.js b/test/simple_internet.js index efd332e..9855485 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -18,7 +18,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.39.0'; + var SELENIUMVERSION = '2.41.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index 8bdafba..7af92a7 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -20,7 +20,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.39.0'; + var SELENIUMVERSION = '2.41.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); @@ -84,7 +84,7 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { }); beforeEach(function(done) { - this.timeout(30000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); From 8d7fedadc2716ca6d7deaef6207d8cc43bc749f2 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 30 Mar 2014 21:44:47 +0200 Subject: [PATCH 058/104] Update to chromedriver 2.9. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2f3415b..a563ecd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,9 @@ before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - echo "$(date +%H:%M:%S.%N) - before_install begin" # download selenium server - #- curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - curl -O http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar # Download and install the chromedriver to be able to execute the browser tests locally - - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + - curl http://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - java -jar selenium-server-standalone-2.41.0.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: From 037625b681541cdd8265ac331c83426e5081d009 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 30 Mar 2014 23:46:31 +0200 Subject: [PATCH 059/104] use a supported version of the selenium version for running on saucelabs. --- test/page_test.js | 3 ++- test/simple_internet.js | 3 ++- test/simple_test.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 842f73e..3becede 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -19,7 +19,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.41.0'; + // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version + var SELENIUMVERSION = '2.40.0'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index 9855485..41350bd 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -18,7 +18,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.41.0'; + // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version + var SELENIUMVERSION = '2.40.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index 7af92a7..6fa1fdc 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -20,7 +20,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - var SELENIUMVERSION = '2.41.0'; + // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version + var SELENIUMVERSION = '2.40.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From dbb07e1cf59f37228fa7701aea98a22fa6453bd3 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Fri, 18 Apr 2014 21:48:39 +0200 Subject: [PATCH 060/104] Updated references to 2.41 selenium server in Makefile, too. --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 01d7ce1..67decfe 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ -SELENIUMJAR=selenium-server-standalone-2.39.0.jar -SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-2.39.0.jar$$' | cut -d ' ' -f 2-3) +SELENIUMVERSION=2.41 +SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).0.jar +SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).0.jar$$' | cut -d ' ' -f 2-3) APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d ' ' -f 2-3) all: test $(SELENIUMJAR): @echo "Getting selenium server $(SELENIUMJAR) ..." - curl -O http://selenium.googlecode.com/files/$(SELENIUMJAR) + curl -O http://selenium-release.storage.googleapis.com/$(SELENIUMVERSION)/$(SELENIUMJAR) launchselenium: $(SELENIUMJAR) ifneq (,$(SELENIUMPID)) @@ -15,7 +16,7 @@ ifneq (,$(SELENIUMPID)) else @echo "Starting selenium server $(SELENIUMJAR) ..." java -jar $(SELENIUMJAR) & - + sleep 5 endif launchapp: From 64651f69a8aa5300b9bda38267e6342f15748c73 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Fri, 18 Apr 2014 21:50:04 +0200 Subject: [PATCH 061/104] version 1.1.0: updated express to version 4.x including a rework main app.js. --- app.js | 26 +++++++++++++------------- package.json | 12 ++++++++---- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app.js b/app.js index 7acf0a9..35ccd5a 100644 --- a/app.js +++ b/app.js @@ -7,31 +7,31 @@ var express = require('express') , routes = require('./routes') , http = require('http') , path = require('path'); - +var serveStatic = require('serve-static'); + var app = express(); // Configuration app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); -app.use(express.favicon()); -app.use(express.logger('dev')); -app.use(express.json()); -app.use(express.urlencoded()); -app.use(express.methodOverride()); -app.use(app.router); -app.use(express.static(path.join(__dirname, 'public'))); - -// development only -if ('development' === app.get('env')) { - app.use(express.errorHandler()); -} +//app.use(favicon(__dirname + '/public/favicon.ico')); - add static-favicon to dependencies, too +//app.use(express.logger('dev')); replaced by morgan +app.use(require('body-parser')()); +app.use(require('method-override')()); // Routes app.get('/', routes.index); app.get('/authors', routes.authors); app.get('/books', routes.books); +app.use(serveStatic(path.join(__dirname, 'public'))); + +// development only +if ('development' === app.get('env')) { + app.use(require('errorhandler')()); +} + http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port %d in %s mode...", app.get('port'), app.get('env')); }); diff --git a/package.json b/package.json index 6ded764..d1d016f 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,22 @@ { "name": "selenium-example", - "version": "1.0.2", + "version": "1.1.0", "license": "MIT", "private": true, "dependencies": { - "express": "~3.5.1", - "jade": "~1.3.0" + "express": "~4.0.0", + "body-parser": "~1.0.2", + "method-override": "~1.0.0", + "serve-static": "~1.0.4", + "errorhandler": "~1.0.0", + "jade": "~1.3.1" }, "devDependencies": { "chai": "~1.9.1", "mocha": "~1.18.2", "saucelabs": "~0.1.1", "util": "~0.10.3", - "webdriverjs": ">=1.3.1" + "webdriverjs": "~1.5.1" }, "scripts": { "postinstall" : "node app.js &", From 7b75100ea421a1066392ee6b2e55d9efcb154018 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 28 Apr 2014 20:14:35 +0200 Subject: [PATCH 062/104] Updated versions of express, static-serve and webdriverjs. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d1d016f..8c70c9a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "selenium-example", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "private": true, "dependencies": { - "express": "~4.0.0", + "express": "~4.1.0", "body-parser": "~1.0.2", "method-override": "~1.0.0", - "serve-static": "~1.0.4", + "serve-static": "~1.1.0", "errorhandler": "~1.0.0", "jade": "~1.3.1" }, @@ -16,7 +16,7 @@ "mocha": "~1.18.2", "saucelabs": "~0.1.1", "util": "~0.10.3", - "webdriverjs": "~1.5.1" + "webdriverjs": "~1.6.1" }, "scripts": { "postinstall" : "node app.js &", From fc6707b3151eb0a5835e6f8c1230f12d21da6e28 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 12 May 2014 18:49:54 +0200 Subject: [PATCH 063/104] Updated the version dependencies. --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8c70c9a..82e784e 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "name": "selenium-example", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "private": true, "dependencies": { - "express": "~4.1.0", "body-parser": "~1.0.2", - "method-override": "~1.0.0", - "serve-static": "~1.1.0", "errorhandler": "~1.0.0", - "jade": "~1.3.1" + "express": "~4.2.0", + "jade": "~1.3.1", + "method-override": "~1.0.0", + "serve-static": "~1.1.0" }, "devDependencies": { "chai": "~1.9.1", From 46f5e5386728956c5bef4bb10a2b7e2d6851cd6f Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 12 May 2014 19:02:40 +0200 Subject: [PATCH 064/104] Updated the browser versions to test. --- .travis.yml | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a563ecd..c161db6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ before_install: - java -jar selenium-server-standalone-2.41.0.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs - - sleep 10 + - sleep 15 - echo "$(date +%H:%M:%S.%N) - before_install end" @@ -47,13 +47,13 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "28" + _VERSION: "29" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "28" + _VERSION: "29" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "33" + _VERSION: "34" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_8.1" _VERSION: "11" diff --git a/package.json b/package.json index 82e784e..0131d27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "private": true, "dependencies": { From 80eb992bfd630e1b4205043f31e76b38d50c81e3 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 12 May 2014 20:08:13 +0200 Subject: [PATCH 065/104] Try to workaround failing IE11. --- views/authors.jade | 5 +++-- views/books.jade | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/views/authors.jade b/views/authors.jade index 80f3b9b..76c7d96 100644 --- a/views/authors.jade +++ b/views/authors.jade @@ -8,5 +8,6 @@ block content li#author2 William Shakespeare li#author3 Eric Flint li#author4 George Orwell - - a#back(href='/') Back \ No newline at end of file + + p + a#back(href='/') Back diff --git a/views/books.jade b/views/books.jade index 8788051..2c9c9d2 100644 --- a/views/books.jade +++ b/views/books.jade @@ -7,6 +7,7 @@ block content li#book1 Wise Man's Fear li#book2 Hamlet li#book3 1632 - li#book4 1984 - - a#back(href='/') Back + li#book4 1984 + + p + a#back(href='/') Back From de6803381aedcb8354bbb9e076e727d74e52d738 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 May 2014 21:14:27 +0200 Subject: [PATCH 066/104] Bumped version of mocha. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0131d27..4ee0409 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.1.3", + "version": "1.1.4", "license": "MIT", "private": true, "dependencies": { @@ -13,7 +13,7 @@ }, "devDependencies": { "chai": "~1.9.1", - "mocha": "~1.18.2", + "mocha": "~1.19.0", "saucelabs": "~0.1.1", "util": "~0.10.3", "webdriverjs": "~1.6.1" From 67aebf850d59793d4cde9628c904021a47b14c96 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 29 May 2014 21:44:03 +0200 Subject: [PATCH 067/104] bumped version numbers. --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4ee0409..5ada939 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,22 @@ { "name": "selenium-example", - "version": "1.1.4", + "version": "1.1.5", "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.0.2", - "errorhandler": "~1.0.0", - "express": "~4.2.0", + "body-parser": "~1.2.0", + "errorhandler": "~1.0.1", + "express": "~4.3.1", "jade": "~1.3.1", - "method-override": "~1.0.0", + "method-override": "~1.0.2", "serve-static": "~1.1.0" }, "devDependencies": { "chai": "~1.9.1", - "mocha": "~1.19.0", + "mocha": "~1.20.0", "saucelabs": "~0.1.1", "util": "~0.10.3", - "webdriverjs": "~1.6.1" + "webdriverjs": "~1.7.1" }, "scripts": { "postinstall" : "node app.js &", From 2ac23f7f1cd7346813cea69a833e13d0902fc39b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 2 Jun 2014 20:59:50 +0200 Subject: [PATCH 068/104] Weekly version bump. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5ada939..3eeef79 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "name": "selenium-example", - "version": "1.1.5", + "version": "1.1.6", "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.2.0", + "body-parser": "~1.3.0", "errorhandler": "~1.0.1", - "express": "~4.3.1", + "express": "~4.4.0", "jade": "~1.3.1", "method-override": "~1.0.2", - "serve-static": "~1.1.0" + "serve-static": "~1.2.0" }, "devDependencies": { "chai": "~1.9.1", From 6bf4cf62cdbb5a614701d42676a68e4b46908681 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 2 Jun 2014 21:18:52 +0200 Subject: [PATCH 069/104] Weekly version bump - overlooked a package. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3eeef79..140c1bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.1.6", + "version": "1.1.7", "license": "MIT", "private": true, "dependencies": { @@ -8,7 +8,7 @@ "errorhandler": "~1.0.1", "express": "~4.4.0", "jade": "~1.3.1", - "method-override": "~1.0.2", + "method-override": "~2.0.0", "serve-static": "~1.2.0" }, "devDependencies": { From 414f14cdd00eb9e2c940be4e295d3a30f4a5e54d Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 01:02:18 +0200 Subject: [PATCH 070/104] Updated all the javascript packages and used tools to latest versions. --- .travis.yml | 15 +++++++++------ Makefile | 2 +- README.md | 6 +++--- package.json | 20 ++++++++++---------- test/page_test.js | 2 +- test/simple_internet.js | 2 +- test/simple_test.js | 2 +- 7 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index c161db6..3800572 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,11 @@ before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - echo "$(date +%H:%M:%S.%N) - before_install begin" # download selenium server - - curl -O http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar + - curl -O http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar # Download and install the chromedriver to be able to execute the browser tests locally - - curl http://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + - curl https://chromedriver.storage.googleapis.com/index.html?path=2.15/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.41.0.jar -Dwebdriver.chrome.driver=./chromedriver & + - java -jar selenium-server-standalone-2.45.0.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs - sleep 15 @@ -47,13 +47,16 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "29" + _VERSION: "37" + - _BROWSER: "firefox" + _PLATFORM: "Linux" + _VERSION: "dev" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "29" + _VERSION: "37" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "34" + _VERSION: "43" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_8.1" _VERSION: "11" diff --git a/Makefile b/Makefile index 67decfe..684fd54 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -SELENIUMVERSION=2.41 +SELENIUMVERSION=2.45 SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).0.jar SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).0.jar$$' | cut -d ' ' -f 2-3) APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d ' ' -f 2-3) diff --git a/README.md b/README.md index fd7c43a..6d4ac53 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ For locally running tests: sudo apt-get install nodejs -y curl https://npmjs.org/install.sh > install-npm.sh && sudo sh install-npm.sh - Install the chromedriver for your system, e.g. for Linux - curl http://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip > chromedriver_linux64.zip + curl https://chromedriver.storage.googleapis.com/index.html?path=2.15/chromedriver_linux64.zip > chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin sudo chmod +rx /usr/local/bin/chromedriver @@ -35,8 +35,8 @@ For locally running tests: - Then exceute make or install and launch selenium server, e.g. - curl -O http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar - java -jar selenium-server-standalone-2.39.0.jar & + curl -O https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar + java -jar selenium-server-standalone-2.45.0.jar & and start the tests with npm npm test diff --git a/package.json b/package.json index 140c1bd..1ace6a5 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,22 @@ { "name": "selenium-example", - "version": "1.1.7", + "version": "1.2.0", "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.3.0", - "errorhandler": "~1.0.1", - "express": "~4.4.0", - "jade": "~1.3.1", - "method-override": "~2.0.0", - "serve-static": "~1.2.0" + "body-parser": "~1.12.4", + "errorhandler": "~1.3.6", + "express": "~4.12.4", + "jade": "~1.10.0", + "method-override": "~2.3.3", + "serve-static": "~1.9.3" }, "devDependencies": { - "chai": "~1.9.1", - "mocha": "~1.20.0", + "chai": "~2.3.0", + "mocha": "~2.2.5", "saucelabs": "~0.1.1", "util": "~0.10.3", - "webdriverjs": "~1.7.1" + "webdriverjs": "~1.7.5" }, "scripts": { "postinstall" : "node app.js &", diff --git a/test/page_test.js b/test/page_test.js index 3becede..dd033f7 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -20,7 +20,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.40.0'; + var SELENIUMVERSION = '2.45.0'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index 41350bd..1f7c123 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -19,7 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.40.0'; + var SELENIUMVERSION = '2.45.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index 6fa1fdc..e0d0dc2 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -21,7 +21,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.40.0'; + var SELENIUMVERSION = '2.45.0'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From 1cd2f94387ee57a60280a0acb6a395e925faad2a Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 01:17:58 +0200 Subject: [PATCH 071/104] Fix chromedriver download path. --- .travis.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3800572..92abd41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: # download selenium server - curl -O http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar # Download and install the chromedriver to be able to execute the browser tests locally - - curl https://chromedriver.storage.googleapis.com/index.html?path=2.15/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + - curl https://chromedriver.storage.googleapis.com/2.15/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - java -jar selenium-server-standalone-2.45.0.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: diff --git a/README.md b/README.md index 6d4ac53..7abea22 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ For locally running tests: sudo apt-get install nodejs -y curl https://npmjs.org/install.sh > install-npm.sh && sudo sh install-npm.sh - Install the chromedriver for your system, e.g. for Linux - curl https://chromedriver.storage.googleapis.com/index.html?path=2.15/chromedriver_linux64.zip > chromedriver_linux64.zip + curl https://chromedriver.storage.googleapis.com/2.15/chromedriver_linux64.zip > chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin sudo chmod +rx /usr/local/bin/chromedriver From ce743a2ed1fbb9bc48598ff5dfc2a1eaa3f863b9 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 01:32:02 +0200 Subject: [PATCH 072/104] Remove deprecated body-parser call. Target dev fails, so try beta instead. --- .travis.yml | 2 +- app.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92abd41..5a623c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ env: _VERSION: "37" - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "dev" + _VERSION: "beta" - _BROWSER: "firefox" _PLATFORM: "Windows_7" _VERSION: "37" diff --git a/app.js b/app.js index 35ccd5a..8699e9d 100644 --- a/app.js +++ b/app.js @@ -17,7 +17,8 @@ app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); //app.use(favicon(__dirname + '/public/favicon.ico')); - add static-favicon to dependencies, too //app.use(express.logger('dev')); replaced by morgan -app.use(require('body-parser')()); +//deprecated: app.use(require('body-parser')()); +app.use(bodyParser.urlencoded()); app.use(require('method-override')()); // Routes From 4cae70c3f0962003e37ecf6e955077c1a204dcca Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 01:50:39 +0200 Subject: [PATCH 073/104] Updated chai version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1ace6a5..1101a38 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "serve-static": "~1.9.3" }, "devDependencies": { - "chai": "~2.3.0", + "chai": "~3.0.0", "mocha": "~2.2.5", "saucelabs": "~0.1.1", "util": "~0.10.3", From 2a95d30327e464f4f13f4cbc3fa1977c6c113ab9 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 11:20:09 +0200 Subject: [PATCH 074/104] Fix deprecated warning for body-parser. --- app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 8699e9d..0bb7145 100644 --- a/app.js +++ b/app.js @@ -7,6 +7,7 @@ var express = require('express') , routes = require('./routes') , http = require('http') , path = require('path'); +var bodyParser = require('body-parser'); var serveStatic = require('serve-static'); var app = express(); @@ -18,7 +19,7 @@ app.set('view engine', 'jade'); //app.use(favicon(__dirname + '/public/favicon.ico')); - add static-favicon to dependencies, too //app.use(express.logger('dev')); replaced by morgan //deprecated: app.use(require('body-parser')()); -app.use(bodyParser.urlencoded()); +app.use(bodyParser.json()) app.use(require('method-override')()); // Routes From 0222ae9e4e99a9f02230ce51d023b98df10a1fd7 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 4 Jun 2015 23:49:36 +0200 Subject: [PATCH 075/104] Try a slightly different URL to avoid different page title on dev channel. --- test/simple_internet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simple_internet.js b/test/simple_internet.js index 1f7c123..aced4b6 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -72,7 +72,7 @@ describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function( this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. client - .url('https://google.com') + .url('https://www.google.com') // uses helper command getTitle() .getTitle(function(err, result) { assert.strictEqual(err, null); From fe602d1481d0eb520267abfc7e456fea5dbdbda1 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sat, 6 Jun 2015 01:42:38 +0200 Subject: [PATCH 076/104] Remove firefox dev from Matrix - fails to connect to internet page. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a623c1..8115eaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,9 +48,6 @@ env: - _BROWSER: "firefox" _PLATFORM: "Linux" _VERSION: "37" - - _BROWSER: "firefox" - _PLATFORM: "Linux" - _VERSION: "beta" - _BROWSER: "firefox" _PLATFORM: "Windows_7" _VERSION: "37" From 1cc0c96cc6008f6dbee5c11d39c08e917e069f30 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 12:04:06 +0200 Subject: [PATCH 077/104] Updated the browser/platform matrix. --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8115eaf..fc30b7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,20 +43,20 @@ env: - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" -# Use underscore for spaces in platfrom and browser names - they are replaced inside js. +# Use underscore for spaces in platform and browser names - they are replaced inside js. matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "37" + _VERSION: "40" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "37" + _VERSION: "40" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "43" - - _BROWSER: "internet_explorer" - _PLATFORM: "Windows_8.1" - _VERSION: "11" + _VERSION: "44" + - _BROWSER: "edge" + _PLATFORM: "Windows_10" + _VERSION: "20" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_7" - _VERSION: "10" + _VERSION: "11" From ed6dce6b123e2eb69e88beec09cd8a4d5772fdef Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 12:12:29 +0200 Subject: [PATCH 078/104] Updated the selenium server and chrome driver. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc30b7b..d30cb1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,11 @@ before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - echo "$(date +%H:%M:%S.%N) - before_install begin" # download selenium server - - curl -O http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar + - curl -O http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar # Download and install the chromedriver to be able to execute the browser tests locally - - curl https://chromedriver.storage.googleapis.com/2.15/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + - curl https://chromedriver.storage.googleapis.com/2.19/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.45.0.jar -Dwebdriver.chrome.driver=./chromedriver & + - java -jar selenium-server-standalone-2.47.1.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs - sleep 15 From 76a8d171b1d90ecb029f22ad0d5b2e84fc67f8d4 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 12:25:13 +0200 Subject: [PATCH 079/104] Adds some more time to wait for saucelabs connection comming up. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d30cb1e..af4213f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,8 @@ before_install: - java -jar selenium-server-standalone-2.47.1.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs - - sleep 15 + #- sleep 15 works only on Win7/chrome44 and Win7/ie11 + - sleep 30 - echo "$(date +%H:%M:%S.%N) - before_install end" From 1492ef4ad9058c8f2e839a83e4361fa3c5aeb9d4 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 12:41:50 +0200 Subject: [PATCH 080/104] Saucelabs: be more specific with the used browser versions. --- .travis.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index af4213f..22e5100 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_install: # install phantomjs, too: - sudo apt-get install phantomjs #- sleep 15 works only on Win7/chrome44 and Win7/ie11 - - sleep 30 + - sleep 15 - echo "$(date +%H:%M:%S.%N) - before_install end" @@ -44,20 +44,22 @@ env: - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" +# Use platform configurator https://docs.saucelabs.com/reference/platforms-configurator +# Get the names and versions from the node.js tab in the section "COPY CODE". # Use underscore for spaces in platform and browser names - they are replaced inside js. matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "40" + _VERSION: "40.0" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "40" + _VERSION: "40.0" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "44" - - _BROWSER: "edge" + _VERSION: "44.0" + - _BROWSER: "microsoftedge" _PLATFORM: "Windows_10" - _VERSION: "20" + _VERSION: "20.10240" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_7" - _VERSION: "11" + _VERSION: "11.0" From 1cdb77259504085a988167ba23e4a8864de6bfa5 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 14:14:41 +0200 Subject: [PATCH 081/104] Updating the selenium version in the test files, too. Latest browser/platform versions are not supported by the older selenium versions. --- .travis.yml | 2 +- test/page_test.js | 4 ++-- test/simple_internet.js | 4 ++-- test/simple_test.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22e5100..0a3a79b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ node_js: before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - echo "$(date +%H:%M:%S.%N) - before_install begin" - # download selenium server + # download selenium server - when updating the jar: adapt the SELENIUMVERSION in the test files, too - curl -O http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar # Download and install the chromedriver to be able to execute the browser tests locally - curl https://chromedriver.storage.googleapis.com/2.19/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver diff --git a/test/page_test.js b/test/page_test.js index dd033f7..ed15eb9 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -19,8 +19,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.45.0'; + // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version + var SELENIUMVERSION = '2.47.1'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index aced4b6..148a588 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -18,8 +18,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.45.0'; + // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version + var SELENIUMVERSION = '2.47.1'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index e0d0dc2..d2cce08 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -20,8 +20,8 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BROWSERPLATFORM = (process.env._PLATFORM || process.env.PLATFORM || 'Linux').replace(/_/g,' '); var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; - // select selenium version - for available versions see https://saucelabs.com/docs/additional-config#selenium-version - var SELENIUMVERSION = '2.45.0'; + // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version + var SELENIUMVERSION = '2.47.1'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From 69c6f13d7db5077d8babbd745e1b609e7a23453a Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 14:54:10 +0200 Subject: [PATCH 082/104] Add pause to wait for edge to load the page. --- test/page_test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/page_test.js b/test/page_test.js index ed15eb9..d961afa 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -122,6 +122,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { assert.strictEqual(result, 'Library'); }) .click('#authors') + .pause(1000) // wait required for Win10/edge, TODO reduce time to wait .getTitle(function(err, title) { assert.strictEqual(err, null); assert.strictEqual(title, 'Authors'); From 363c376f78feb9270fb16b4cf49b2ae0292676a7 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 14:59:18 +0200 Subject: [PATCH 083/104] Reduce time to wait for edge loading the page. --- test/page_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/page_test.js b/test/page_test.js index d961afa..709a6ed 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -122,7 +122,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { assert.strictEqual(result, 'Library'); }) .click('#authors') - .pause(1000) // wait required for Win10/edge, TODO reduce time to wait + .pause(100) // wait required for Win10/edge, TODO reduce time to wait, 1000 working .getTitle(function(err, title) { assert.strictEqual(err, null); assert.strictEqual(title, 'Authors'); From b44ab02fefda448c0469134ebc3b844ec0289c8f Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Sep 2015 15:05:38 +0200 Subject: [PATCH 084/104] Restore working pause. --- test/page_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/page_test.js b/test/page_test.js index 709a6ed..d6056f6 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -122,7 +122,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { assert.strictEqual(result, 'Library'); }) .click('#authors') - .pause(100) // wait required for Win10/edge, TODO reduce time to wait, 1000 working + .pause(1000) // wait required for Win10/edge, TODO reduce time to wait, 1000 working, 100 not; rework to use waitFor from webdriverio 3.x .getTitle(function(err, title) { assert.strictEqual(err, null); assert.strictEqual(title, 'Authors'); From ec8f30af8b0228d7921c6de2fba271b96d763d8e Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 18 Oct 2015 22:06:08 +0200 Subject: [PATCH 085/104] Updated dependencies in package.json to latest versions. --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1101a38..571f124 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { "name": "selenium-example", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.12.4", - "errorhandler": "~1.3.6", - "express": "~4.12.4", - "jade": "~1.10.0", - "method-override": "~2.3.3", - "serve-static": "~1.9.3" + "body-parser": "~1.14.1", + "errorhandler": "~1.4.2", + "express": "~4.13.3", + "jade": "~1.11.0", + "method-override": "~2.3.5", + "serve-static": "~1.10.0" }, "devDependencies": { - "chai": "~3.0.0", - "mocha": "~2.2.5", - "saucelabs": "~0.1.1", + "chai": "~3.3.0", + "mocha": "~2.3.3", + "saucelabs": "~1.0.1", "util": "~0.10.3", "webdriverjs": "~1.7.5" }, From 82d431b9765584440c9d66a06a66a52f8dd2e0b1 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:14:18 +0200 Subject: [PATCH 086/104] Updated the versions of dependencies and tools. Updated from webdriverjs to webdriverio. --- .travis.yml | 10 +++---- Makefile | 6 ++-- package.json | 2 +- test/page_test.js | 65 ++++++++++++++++++++--------------------- test/simple_internet.js | 26 ++++++++--------- test/simple_test.js | 34 +++++++++------------ 6 files changed, 67 insertions(+), 76 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a3a79b..75b7e7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,14 @@ node_js: before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - - echo "$(date +%H:%M:%S.%N) - before_install begin" # download selenium server - when updating the jar: adapt the SELENIUMVERSION in the test files, too - - curl -O http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar + # Lastest version: http://www.seleniumhq.org/download/ + - curl -O http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar # Download and install the chromedriver to be able to execute the browser tests locally - - curl https://chromedriver.storage.googleapis.com/2.19/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver + # Latest version: https://sites.google.com/a/chromium.org/chromedriver/downloads + - curl https://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.47.1.jar -Dwebdriver.chrome.driver=./chromedriver & + - java -jar selenium-server-standalone-2.48.2.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - sudo apt-get install phantomjs #- sleep 15 works only on Win7/chrome44 and Win7/ie11 @@ -30,7 +31,6 @@ before_script: script: # automatically runs `npm test` - therefore the call to mocha is located in package.json - - echo "$(date +%H:%M:%S.%N) - script begin" #- mocha --reporter spec #- export TEST_RUN_LOCAL=true && npm test #- echo "Run the same tests as above, but using the remote browser." diff --git a/Makefile b/Makefile index 684fd54..acf305d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -SELENIUMVERSION=2.45 -SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).0.jar -SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).0.jar$$' | cut -d ' ' -f 2-3) +SELENIUMVERSION=2.48 +SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).2.jar +SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).2.jar$$' | cut -d ' ' -f 2-3) APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d ' ' -f 2-3) all: test diff --git a/package.json b/package.json index 571f124..2b86e91 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "mocha": "~2.3.3", "saucelabs": "~1.0.1", "util": "~0.10.3", - "webdriverjs": "~1.7.5" + "webdriverio": "~3.2.5" }, "scripts": { "postinstall" : "node app.js &", diff --git a/test/page_test.js b/test/page_test.js index d6056f6..8f2c311 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -1,7 +1,7 @@ var chai = require('chai'); var assert = chai.assert, // TDD expect = chai.expect, // BDD - webdriverjs = require('webdriverjs'); + webdriverio = require('webdriverio'); process.on('uncaughtException', function(e) { console.log(require('util').inspect(e, {showHidden:true})); @@ -33,7 +33,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run web app \'page test\' using webdriverjs/Selenium.', + name: 'Run web app \'page test\' using webdriverio/Selenium.', build: BUILDID, 'tunnel-identifier': TUNNELIDENTIFIER, 'selenium-version': SELENIUMVERSION @@ -59,7 +59,7 @@ else } -describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { +describe('Run web app \'page test\' using webdriverio/Selenium.', function() { var client = {}; @@ -67,7 +67,7 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { // console.log('--before--'); this.timeout(60000); - client = webdriverjs.remote(options); + client = webdriverio.remote(options); // start the session client.init() @@ -89,21 +89,20 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { }); it('checks the title only - using TDD style check', function(done) { - // uses helper command getTitle() - client.getTitle(function(err, result) { - assert.strictEqual(err, null); - //console.log('1 Title was: ' + result); - assert.strictEqual(result, 'Library'); // TDD + // uses property getTitle() + client + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Library'); // TDD }) .call(done); }); it('checks the title only, a second time - but using BDD style check', function(done) { client - .getTitle(function(err, result) { - if (err) throw err; - //console.log('1 Title was: ' + result); - expect(result).to.have.string('Library'); // BDD + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + expect(title).to.have.string('Library'); // BDD }) // uses underlying protocol function title() .title(function(err, result) { @@ -116,41 +115,41 @@ describe('Run web app \'page test\' using webdriverjs/Selenium.', function() { it('should be able to navigate between the pages', function(done) { client - .getTitle(function(err, result) { - assert.strictEqual(err, null); - //console.log('Title was: ' + result); - assert.strictEqual(result, 'Library'); + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Library'); }) .click('#authors') - .pause(1000) // wait required for Win10/edge, TODO reduce time to wait, 1000 working, 100 not; rework to use waitFor from webdriverio 3.x - .getTitle(function(err, title) { - assert.strictEqual(err, null); + //.waitForExist('#author1', 1000) + .getTitle().then(function(title) { + //console.log('Title was: ' + title); assert.strictEqual(title, 'Authors'); }) - .getText('#author1', function(err, result) { - if (err) throw err; + .getText('#author1').then(function(result) { //console.log('#author1: ' + result); expect(result).to.have.string('Patrick Rothfuss'); }) .click('#back') - .getTitle(function(err, result) { - assert.strictEqual(err, null); - assert.strictEqual(result, 'Library'); + //.waitForExist('#books', 1000) + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Library'); }) .click('#books') - .getTitle(function(err, result) { - assert.strictEqual(err, null); - assert.strictEqual(result, 'Books'); + //.waitForExist('#book1', 1000) + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Books'); }) - .getText('#book1', function(err, result) { - assert.strictEqual(err, null); + .getText('#book1').then(function(result) { //console.log('#book1: ' + result); assert.strictEqual(result, 'Wise Man\'s Fear'); }) .click('#back') - .getTitle(function(err, result) { - assert.strictEqual(err, null); - assert.strictEqual(result, 'Library'); + //.waitForExist('#author1', 1000) + .getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Library'); }) .call(done); }); diff --git a/test/simple_internet.js b/test/simple_internet.js index 148a588..aefc8fd 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -1,5 +1,5 @@ var assert = require('chai').assert, - webdriverjs = require('webdriverjs'); + webdriverio = require('webdriverio'); var env = GLOBAL.env = {}; var client = {}; @@ -11,7 +11,7 @@ process.on('uncaughtException', function(e) { }); if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { - console.log('running tests on SauceLabs using sauce connect...'); + console.log('running tests (simple internet) on SauceLabs using sauce connect...'); var BROWSERNAME = (process.env._BROWSER || process.env.BROWSER || 'chrome').replace(/_/g,' '); var BROWSERVERSION = process.env._VERSION || process.env.VERSION || '*'; @@ -33,7 +33,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run a \'simple internet\' test using webdriverjs/Selenium.', + name: 'Run a \'simple internet\' test using webdriverio/Selenium.', build: BUILDID, 'tunnel-identifier': TUNNELIDENTIFIER, 'selenium-version': SELENIUMVERSION @@ -51,7 +51,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) } else { - console.log('running tests locally...'); + console.log('running tests (simple internet) locally...'); options = { desiredCapabilities: { browserName: 'chrome' @@ -61,11 +61,12 @@ else }; } -describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function() { +describe('Run a \'simple internet\' test using webdriverio/Selenium.', function() { before(function(done){ - client = webdriverjs.remote(options); - client.init(done); + this.timeout(6000);// 2000 too fast + client = webdriverio.remote(options); + client.init().call(done); }); it('should be able to view page on internet, checks the title only using TDD style check', function(done) { @@ -73,17 +74,16 @@ describe('Run a \'simple internet\' test using webdriverjs/Selenium.', function( client .url('https://www.google.com') - // uses helper command getTitle() - .getTitle(function(err, result) { - assert.strictEqual(err, null); - console.log('Title was: ' + result); - assert.strictEqual(result, 'Google'); + // uses property getTitle() + .getTitle().then(function(title) { + console.log('Title was: ' + title); + assert.strictEqual(title, 'Google'); }) .call(done); }); after(function(done) { - client.end(done); + client.end().call(done); }); }); diff --git a/test/simple_test.js b/test/simple_test.js index d2cce08..04d4910 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -1,6 +1,6 @@ var assert = require('chai').assert, expect = require('chai').expect, - webdriverjs = require('webdriverjs'); + webdriverio = require('webdriverio'); var env = GLOBAL.env = {}; var client = {}; @@ -12,7 +12,7 @@ process.on('uncaughtException', function(e) { }); if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) { - console.log('running tests on SauceLabs using sauce connect...'); + console.log('running tests (simple_test) on SauceLabs using sauce connect...'); console.log('TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'); var BROWSERNAME = (process.env._BROWSER || process.env.BROWSER || 'chrome').replace(/_/g,' '); @@ -34,7 +34,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) version: BROWSERVERSION, platform: BROWSERPLATFORM, tags: ['examples'], - name: 'Run a \'simple test\' using webdriverjs/Selenium.', + name: 'Run a \'simple test\' using webdriverio/Selenium.', build: BUILDID, 'tunnel-identifier': TUNNELIDENTIFIER, 'selenium-version': SELENIUMVERSION @@ -52,7 +52,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) } else { - console.log('running tests locally...'); + console.log('running tests (simple_test) locally...'); options = { desiredCapabilities: { browserName: 'chrome' @@ -62,24 +62,11 @@ else }; } -describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { - - var client = {}; +describe('Run a \'simple test\' using webdriverio/Selenium.', function() { before(function(done) { this.timeout(60000); - client = webdriverjs.remote(options); - - // Add a helper command - client.addCommand('hasText', function(selector, text, callback) { - this.getText(selector, function(err, result) { - assert.strictEqual(err, null); - assert.strictEqual(result, text); // TDD - expect(result).to.have.string(text); // BDD - }) - .call(callback); - }); - + client = webdriverio.remote(options); client.init() .call(done); }); @@ -92,12 +79,17 @@ describe('Run a \'simple test\' using webdriverjs/Selenium.', function() { }); it('should be able to view the home page', function(done) { - client.hasText('#title', 'Library') + client.getTitle().then(function(title) { + //console.log('Title was: ' + title); + assert.strictEqual(title, 'Library'); // TDD + expect(title).to.have.string('Library'); // BDD + }) .call(done); }); after(function(done) { - client.end().call(done); + client.end() + .call(done); }); }); From a11ce3bbe6cd1aee94b97a256005157852745af9 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:15:32 +0200 Subject: [PATCH 087/104] Added local copies of the chrome driver to .gitignore. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3bcb9f6..75954ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .DS_STORE node_modules *.jar +chromedriver +chromedriver_linux64.zip From 5ce002684840aa37fab4f93f6eeaed7505e28b05 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:26:33 +0200 Subject: [PATCH 088/104] Increase time out for the page test - windows systems are requiring more than 6 s. --- test/page_test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/page_test.js b/test/page_test.js index 8f2c311..19b0134 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -114,6 +114,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { }); it('should be able to navigate between the pages', function(done) { + this.timeout(12000); client .getTitle().then(function(title) { //console.log('Title was: ' + title); From 2c007a970bd60737be7b5c5cf26a99cdfd22486b Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:29:35 +0200 Subject: [PATCH 089/104] Updated the firefox and chrome versions. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 75b7e7f..0885220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,13 +50,13 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "40.0" + _VERSION: "41.0" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "40.0" + _VERSION: "41.0" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "44.0" + _VERSION: "46.0" - _BROWSER: "microsoftedge" _PLATFORM: "Windows_10" _VERSION: "20.10240" From ed5f7b6c49db260b4181c2a726abe79c33a4d293 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:40:56 +0200 Subject: [PATCH 090/104] Increase time out for the simple internet - windows systems are requiring more than 6 s. --- test/simple_internet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simple_internet.js b/test/simple_internet.js index aefc8fd..79d9d5b 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -64,7 +64,7 @@ else describe('Run a \'simple internet\' test using webdriverio/Selenium.', function() { before(function(done){ - this.timeout(6000);// 2000 too fast + this.timeout(12000);// 6000 too fast on windows systems client = webdriverio.remote(options); client.init().call(done); }); From f21a0520963e0d4110817309238423998a128007 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:50:36 +0200 Subject: [PATCH 091/104] Added some wait for on page navigation. This may made it work on MS Edge, too. --- test/page_test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/page_test.js b/test/page_test.js index 19b0134..c9d3709 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -121,7 +121,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { assert.strictEqual(title, 'Library'); }) .click('#authors') - //.waitForExist('#author1', 1000) + .waitForExist('#back', 1000) .getTitle().then(function(title) { //console.log('Title was: ' + title); assert.strictEqual(title, 'Authors'); @@ -131,13 +131,13 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { expect(result).to.have.string('Patrick Rothfuss'); }) .click('#back') - //.waitForExist('#books', 1000) + .waitForExist('#books', 1000) .getTitle().then(function(title) { //console.log('Title was: ' + title); assert.strictEqual(title, 'Library'); }) .click('#books') - //.waitForExist('#book1', 1000) + .waitForExist('#back', 1000) .getTitle().then(function(title) { //console.log('Title was: ' + title); assert.strictEqual(title, 'Books'); @@ -147,7 +147,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { assert.strictEqual(result, 'Wise Man\'s Fear'); }) .click('#back') - //.waitForExist('#author1', 1000) + .waitForExist('#authors', 1000) .getTitle().then(function(title) { //console.log('Title was: ' + title); assert.strictEqual(title, 'Library'); From 6f3a8c1e654717eb9909e2b9c355519a9c749564 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Mon, 19 Oct 2015 00:58:33 +0200 Subject: [PATCH 092/104] Disabled the MS Edge because page navigation is not working as exepected. --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0885220..5fd76e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,9 +57,10 @@ env: - _BROWSER: "chrome" _PLATFORM: "Windows_7" _VERSION: "46.0" - - _BROWSER: "microsoftedge" - _PLATFORM: "Windows_10" - _VERSION: "20.10240" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_7" _VERSION: "11.0" +# navigation on the 'page test' does not work - no idea why 8-( +# - _BROWSER: "microsoftedge" +# _PLATFORM: "Windows_10" +# _VERSION: "20.10240" From f231334ef286339a6b8067b1144876b573fe40fb Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 25 Oct 2015 22:28:13 +0100 Subject: [PATCH 093/104] Updated the seleniumDriver version to 2.48.2 as suggested by Sauce Labs. Updated chai version, too. --- .travis.yml | 4 ++-- package.json | 2 +- test/page_test.js | 2 +- test/simple_internet.js | 2 +- test/simple_test.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5fd76e4..0bb1bb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,11 @@ before_install: - curl https://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - java -jar selenium-server-standalone-2.48.2.jar -Dwebdriver.chrome.driver=./chromedriver & - # install phantomjs, too: + # install phantomjs, too: - TODO: try the existing one from the CI environment - sudo apt-get install phantomjs #- sleep 15 works only on Win7/chrome44 and Win7/ie11 - sleep 15 - - echo "$(date +%H:%M:%S.%N) - before_install end" + #- echo "$(date +%H:%M:%S.%N) - before_install end" before_script: diff --git a/package.json b/package.json index 2b86e91..495a3c9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "serve-static": "~1.10.0" }, "devDependencies": { - "chai": "~3.3.0", + "chai": "~3.4.0", "mocha": "~2.3.3", "saucelabs": "~1.0.1", "util": "~0.10.3", diff --git a/test/page_test.js b/test/page_test.js index c9d3709..37ea661 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -20,7 +20,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.47.1'; + var SELENIUMVERSION = '2.48.2'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index 79d9d5b..4a20cde 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -19,7 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.47.1'; + var SELENIUMVERSION = '2.48.2'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index 04d4910..e3d3eb1 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -21,7 +21,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.47.1'; + var SELENIUMVERSION = '2.48.2'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From 15a8afe5e3e5c208a1b3ed4c56dbb9f83cba328e Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 25 Oct 2015 22:32:28 +0100 Subject: [PATCH 094/104] Try Edge on Win10, once more. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0bb1bb1..91406e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,6 @@ env: _PLATFORM: "Windows_7" _VERSION: "11.0" # navigation on the 'page test' does not work - no idea why 8-( -# - _BROWSER: "microsoftedge" -# _PLATFORM: "Windows_10" -# _VERSION: "20.10240" + - _BROWSER: "microsoftedge" + _PLATFORM: "Windows_10" + _VERSION: "20.10240" From bfb02d026aa374622ef9807e61ac04333fdfec02 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Sun, 25 Oct 2015 23:00:01 +0100 Subject: [PATCH 095/104] The 'page test' still doesn't work with Edge on Win10. Disabled the platform, again. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91406e5..0bb1bb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,6 @@ env: _PLATFORM: "Windows_7" _VERSION: "11.0" # navigation on the 'page test' does not work - no idea why 8-( - - _BROWSER: "microsoftedge" - _PLATFORM: "Windows_10" - _VERSION: "20.10240" +# - _BROWSER: "microsoftedge" +# _PLATFORM: "Windows_10" +# _VERSION: "20.10240" From bfc36887fb7f1dbe2456374ed2dd20ad5b4fc7e5 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Tue, 2 Feb 2016 22:08:12 +0100 Subject: [PATCH 096/104] Updated used javascript modules in package.json. Update to use the selenium server v1.50.1 and chrome driver 2.21. Updated the used browsers, too. --- .travis.yml | 16 ++++++++-------- Makefile | 8 ++++---- README.md | 15 ++++++++++++--- package.json | 14 +++++++------- test/page_test.js | 2 +- test/simple_internet.js | 2 +- test/simple_test.js | 2 +- 7 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0bb1bb1..cc326ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,12 @@ before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. # download selenium server - when updating the jar: adapt the SELENIUMVERSION in the test files, too # Lastest version: http://www.seleniumhq.org/download/ - - curl -O http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar + - curl -O https://selenium-release.storage.googleapis.com/2.50/selenium-server-standalone-2.50.1.jar # Download and install the chromedriver to be able to execute the browser tests locally # Latest version: https://sites.google.com/a/chromium.org/chromedriver/downloads - curl https://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - - java -jar selenium-server-standalone-2.48.2.jar -Dwebdriver.chrome.driver=./chromedriver & + - java -jar selenium-server-standalone-2.50.1.jar -Dwebdriver.chrome.driver=./chromedriver & # install phantomjs, too: - TODO: try the existing one from the CI environment - sudo apt-get install phantomjs #- sleep 15 works only on Win7/chrome44 and Win7/ie11 @@ -50,17 +50,17 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "41.0" + _VERSION: "43.0" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "41.0" + _VERSION: "43.0" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "46.0" + _VERSION: "47.0" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_7" _VERSION: "11.0" # navigation on the 'page test' does not work - no idea why 8-( -# - _BROWSER: "microsoftedge" -# _PLATFORM: "Windows_10" -# _VERSION: "20.10240" + - _BROWSER: "microsoftedge" + _PLATFORM: "Windows_10" + _VERSION: "20.10240" diff --git a/Makefile b/Makefile index acf305d..6cb1975 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -SELENIUMVERSION=2.48 -SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).2.jar -SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).2.jar$$' | cut -d ' ' -f 2-3) +SELENIUMVERSION=2.50 +SELENIUMJAR=selenium-server-standalone-$(SELENIUMVERSION).1.jar +SELENIUMPID=$(shell ps -ef | grep 'selenium-server-standalone-$(SELENIUMVERSION).1.jar$$' | cut -d ' ' -f 2-3) APPPID=$(shell ps -ef | grep 'node app.js$$' | cut -d ' ' -f 2-3) all: test $(SELENIUMJAR): @echo "Getting selenium server $(SELENIUMJAR) ..." - curl -O http://selenium-release.storage.googleapis.com/$(SELENIUMVERSION)/$(SELENIUMJAR) + curl -O https://selenium-release.storage.googleapis.com/$(SELENIUMVERSION)/$(SELENIUMJAR) launchselenium: $(SELENIUMJAR) ifneq (,$(SELENIUMPID)) diff --git a/README.md b/README.md index 7abea22..23538f5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ For locally running tests: sudo apt-get install nodejs -y curl https://npmjs.org/install.sh > install-npm.sh && sudo sh install-npm.sh - Install the chromedriver for your system, e.g. for Linux - curl https://chromedriver.storage.googleapis.com/2.15/chromedriver_linux64.zip > chromedriver_linux64.zip + curl https://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip > chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin sudo chmod +rx /usr/local/bin/chromedriver @@ -35,8 +35,8 @@ For locally running tests: - Then exceute make or install and launch selenium server, e.g. - curl -O https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar - java -jar selenium-server-standalone-2.45.0.jar & + curl -O https://selenium-release.storage.googleapis.com/2.50/selenium-server-standalone-2.50.1.jar + java -jar selenium-server-standalone-2.50.1.jar & and start the tests with npm npm test @@ -46,3 +46,12 @@ Executing the examples Just call `mocha`. Mocha will then execute all the scripts in the directory named test. + +Troubleshooting +=============== + +1) The test 'simple internet' fails and there is this message shown: + Only local connections are allowed. + +Ensure that the chromedriver is matching the selenium-server, e.g. try +upgrade both to the latest releases. \ No newline at end of file diff --git a/package.json b/package.json index 495a3c9..e9794bd 100644 --- a/package.json +++ b/package.json @@ -4,19 +4,19 @@ "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.14.1", - "errorhandler": "~1.4.2", - "express": "~4.13.3", + "body-parser": "~1.14.2", + "errorhandler": "~1.4.3", + "express": "~4.13.4", "jade": "~1.11.0", "method-override": "~2.3.5", - "serve-static": "~1.10.0" + "serve-static": "~1.10.2" }, "devDependencies": { - "chai": "~3.4.0", - "mocha": "~2.3.3", + "chai": "~3.5.0", + "mocha": "~2.4.5", "saucelabs": "~1.0.1", "util": "~0.10.3", - "webdriverio": "~3.2.5" + "webdriverio": "~3.4.0" }, "scripts": { "postinstall" : "node app.js &", diff --git a/test/page_test.js b/test/page_test.js index 37ea661..1155736 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -20,7 +20,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.48.2'; + var SELENIUMVERSION = '2.50.1'; // console.log('BROWSERNAME: ' + BROWSERNAME); // console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_internet.js b/test/simple_internet.js index 4a20cde..e30edad 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -19,7 +19,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.48.2'; + var SELENIUMVERSION = '2.50.1'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); diff --git a/test/simple_test.js b/test/simple_test.js index e3d3eb1..637a112 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -21,7 +21,7 @@ if ((process.env.TRAVIS === 'true') && (process.env.TEST_RUN_LOCAL !== 'true')) var BUILDID = process.env.TRAVIS_BUILD_ID || 'unknown-buildid'; var TUNNELIDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'unknown-jobnumber'; // select selenium version - for available versions see https://docs.saucelabs.com/reference/test-configuration/#specifying-a-selenium-version - var SELENIUMVERSION = '2.48.2'; + var SELENIUMVERSION = '2.50.1'; console.log('BROWSERNAME: ' + BROWSERNAME); console.log('BROWSERVERSION: ' + BROWSERVERSION); From 80889021f00a267b3a134cd6ed51f431d9967a3e Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Tue, 2 Feb 2016 22:23:31 +0100 Subject: [PATCH 097/104] travis: removed installation of phantomjs. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc326ff..17b0b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,6 @@ before_install: - curl https://chromedriver.storage.googleapis.com/2.20/chromedriver_linux64.zip > chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo cp chromedriver /usr/local/bin && sudo chmod +rx chromedriver /usr/local/bin/chromedriver # start this before installation to let the server be up and ready without extra waiting time. - java -jar selenium-server-standalone-2.50.1.jar -Dwebdriver.chrome.driver=./chromedriver & - # install phantomjs, too: - TODO: try the existing one from the CI environment - - sudo apt-get install phantomjs #- sleep 15 works only on Win7/chrome44 and Win7/ie11 - sleep 15 #- echo "$(date +%H:%M:%S.%N) - before_install end" From 30a7e125df8b8a521b10424884c39b7bd66f6888 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Tue, 2 Feb 2016 22:29:37 +0100 Subject: [PATCH 098/104] Saucelabs: Edge still doesn't work as the other browsers. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17b0b0e..8b14f70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,6 @@ env: _PLATFORM: "Windows_7" _VERSION: "11.0" # navigation on the 'page test' does not work - no idea why 8-( - - _BROWSER: "microsoftedge" - _PLATFORM: "Windows_10" - _VERSION: "20.10240" +# - _BROWSER: "microsoftedge" +# _PLATFORM: "Windows_10" +# _VERSION: "20.10240" From 371020174eee758b2b0d9d816b336118ef142873 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Tue, 23 Feb 2016 21:44:29 +0100 Subject: [PATCH 099/104] Updated the used browsers and the used javascript libraries. --- .travis.yml | 10 +++++----- package.json | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b14f70..8cd1e74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ node_js: before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. - # download selenium server - when updating the jar: adapt the SELENIUMVERSION in the test files, too - # Lastest version: http://www.seleniumhq.org/download/ + # download selenium server - when updating the jar: adapt the SELENIUMVERSION in the test files, too. + # Latest version: http://www.seleniumhq.org/download/ - curl -O https://selenium-release.storage.googleapis.com/2.50/selenium-server-standalone-2.50.1.jar # Download and install the chromedriver to be able to execute the browser tests locally # Latest version: https://sites.google.com/a/chromium.org/chromedriver/downloads @@ -48,13 +48,13 @@ env: matrix: - _BROWSER: "firefox" _PLATFORM: "Linux" - _VERSION: "43.0" + _VERSION: "44.0" - _BROWSER: "firefox" _PLATFORM: "Windows_7" - _VERSION: "43.0" + _VERSION: "44.0" - _BROWSER: "chrome" _PLATFORM: "Windows_7" - _VERSION: "47.0" + _VERSION: "48.0" - _BROWSER: "internet_explorer" _PLATFORM: "Windows_7" _VERSION: "11.0" diff --git a/package.json b/package.json index e9794bd..5878470 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "selenium-example", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "private": true, "dependencies": { - "body-parser": "~1.14.2", + "body-parser": "~1.15.0", "errorhandler": "~1.4.3", "express": "~4.13.4", "jade": "~1.11.0", @@ -14,9 +14,9 @@ "devDependencies": { "chai": "~3.5.0", "mocha": "~2.4.5", - "saucelabs": "~1.0.1", + "saucelabs": "~1.2.0", "util": "~0.10.3", - "webdriverio": "~3.4.0" + "webdriverio": "~4.0.3" }, "scripts": { "postinstall" : "node app.js &", From f19a28cc262a2623b8acf696332e9c75fd0fb62e Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Mar 2016 09:42:08 +0100 Subject: [PATCH 100/104] Try newer node versions --- .travis.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8cd1e74..1484850 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,11 @@ language: node_js node_js: - - '0.10' + - "node" + - "4.1" + - "5.7" + # last working: + - "0.10" before_install: # download and start selenium server - thought that it is not necessary, but without the website is not available within SauceLabs. @@ -28,7 +32,8 @@ before_script: - cat authors | cut -d'/' -f1 script: -# automatically runs `npm test` - therefore the call to mocha is located in package.json + - which node && node -v && npm version || true + # automatically runs `npm test` - therefore the call to mocha is located in package.json #- mocha --reporter spec #- export TEST_RUN_LOCAL=true && npm test #- echo "Run the same tests as above, but using the remote browser." @@ -41,7 +46,6 @@ env: global: - secure: "EvQvxbIQRYDF2NvRDlC8tLeoKabuhi9D+d9y89jsVniyAkMd6HXzU6N+/rsKWnLSYg4fDzadHvXUN+ge9BP1JwMFsH1OOCifBCQQLfnrZQ1phnQEhwl8LDQHVZbRv9Wsk474+NcGkGiDOrjUjbadR6YCrisPt3CHAB1XQw4zIzE=" - secure: "sAGCSM9rCbANjWeeLnF8i2y450c4EPGUuhlOeFCxnlisduDkiQ6sZgusOlL2NiPQwmHTCcVNn7reBcuUGg1NZJfRt4NMju9OtqzS/JLk2RW9+J3zUkDrx5tQhaivWlThakRAIpNeHpCBEL9tWk68pDZw+Bfc1e1Jh4H3ji91KtI=" - # Use platform configurator https://docs.saucelabs.com/reference/platforms-configurator # Get the names and versions from the node.js tab in the section "COPY CODE". # Use underscore for spaces in platform and browser names - they are replaced inside js. @@ -59,6 +63,6 @@ env: _PLATFORM: "Windows_7" _VERSION: "11.0" # navigation on the 'page test' does not work - no idea why 8-( -# - _BROWSER: "microsoftedge" -# _PLATFORM: "Windows_10" -# _VERSION: "20.10240" + - _BROWSER: "microsoftedge" + _PLATFORM: "Windows_10" + _VERSION: "20.10240" From 3fb211e0a1167ed7e007e56b0dd7373e6af42dd8 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Mar 2016 11:05:29 +0100 Subject: [PATCH 101/104] Add some more waiting time and increase time out to make more test cases work. --- .travis.yml | 4 +++- package.json | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1484850..f52e14d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_install: - java -jar selenium-server-standalone-2.50.1.jar -Dwebdriver.chrome.driver=./chromedriver & #- sleep 15 works only on Win7/chrome44 and Win7/ie11 - sleep 15 - #- echo "$(date +%H:%M:%S.%N) - before_install end" + - echo "$(date +%H:%M:%S.%N) - before_install end" before_script: @@ -32,6 +32,8 @@ before_script: - cat authors | cut -d'/' -f1 script: + - echo "$(date +%H:%M:%S.%N) - script begin" + - sleep 15 - which node && node -v && npm version || true # automatically runs `npm test` - therefore the call to mocha is located in package.json #- mocha --reporter spec diff --git a/package.json b/package.json index 5878470..8b00c5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.3.1", + "version": "1.3.2", "license": "MIT", "private": true, "dependencies": { @@ -21,6 +21,6 @@ "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 60000 test/simple_internet.js test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 100000 test/simple_internet.js test/simple_test.js test/page_test.js" } } From a181f91e69ea5ce1eabb2e63660b3977773c2a74 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Mar 2016 22:46:26 +0100 Subject: [PATCH 102/104] Set timeouts to 5 min to ensure that these are not the problems for the failing tests on Win10. --- package.json | 4 ++-- test/page_test.js | 6 +++--- test/simple_internet.js | 4 ++-- test/simple_test.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8b00c5b..8efbad1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.3.2", + "version": "1.3.3", "license": "MIT", "private": true, "dependencies": { @@ -21,6 +21,6 @@ "scripts": { "postinstall" : "node app.js &", "start" : "node app.js &", - "test": "mocha --reporter spec --timeout 100000 test/simple_internet.js test/simple_test.js test/page_test.js" + "test": "mocha --reporter spec --timeout 300000 test/simple_internet.js test/simple_test.js test/page_test.js" } } diff --git a/test/page_test.js b/test/page_test.js index 1155736..8637a6a 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -65,7 +65,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { before(function(done) { // console.log('--before--'); - this.timeout(60000); + this.timeout(300000); client = webdriverio.remote(options); @@ -82,7 +82,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { beforeEach(function(done) { //console.log('--beforeEach--'); - this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(300000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); @@ -121,7 +121,7 @@ describe('Run web app \'page test\' using webdriverio/Selenium.', function() { assert.strictEqual(title, 'Library'); }) .click('#authors') - .waitForExist('#back', 1000) + .waitForExist('#back', 10000) .getTitle().then(function(title) { //console.log('Title was: ' + title); assert.strictEqual(title, 'Authors'); diff --git a/test/simple_internet.js b/test/simple_internet.js index e30edad..34a0314 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -64,13 +64,13 @@ else describe('Run a \'simple internet\' test using webdriverio/Selenium.', function() { before(function(done){ - this.timeout(12000);// 6000 too fast on windows systems + this.timeout(300000);// 6000 too fast on windows systems client = webdriverio.remote(options); client.init().call(done); }); it('should be able to view page on internet, checks the title only using TDD style check', function(done) { - this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(300000); // some time is needed for the browser start up, on my system 3000 should work, too. client .url('https://www.google.com') diff --git a/test/simple_test.js b/test/simple_test.js index 637a112..7c442f8 100644 --- a/test/simple_test.js +++ b/test/simple_test.js @@ -65,14 +65,14 @@ else describe('Run a \'simple test\' using webdriverio/Selenium.', function() { before(function(done) { - this.timeout(60000); + this.timeout(300000); client = webdriverio.remote(options); client.init() .call(done); }); beforeEach(function(done) { - this.timeout(60000); // some time is needed for the browser start up, on my system 3000 should work, too. + this.timeout(300000); // some time is needed for the browser start up, on my system 3000 should work, too. // Navigate to the URL for each test client.url('http://localhost:3000') .call(done); From 8b420005d21e8bf8d216f10081125341cd65c4e6 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Wed, 2 Mar 2016 23:57:25 +0100 Subject: [PATCH 103/104] Set the timeouts on another location. --- package.json | 2 +- test/page_test.js | 2 +- test/simple_internet.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8efbad1..f216ba6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "selenium-example", - "version": "1.3.3", + "version": "1.3.4", "license": "MIT", "private": true, "dependencies": { diff --git a/test/page_test.js b/test/page_test.js index 8637a6a..caf277b 100644 --- a/test/page_test.js +++ b/test/page_test.js @@ -60,7 +60,7 @@ else describe('Run web app \'page test\' using webdriverio/Selenium.', function() { - + this.timeout(300000); var client = {}; before(function(done) { diff --git a/test/simple_internet.js b/test/simple_internet.js index 34a0314..3a8ea2d 100644 --- a/test/simple_internet.js +++ b/test/simple_internet.js @@ -62,6 +62,7 @@ else } describe('Run a \'simple internet\' test using webdriverio/Selenium.', function() { + this.timeout(300000);// 6000 too fast on windows systems before(function(done){ this.timeout(300000);// 6000 too fast on windows systems From d20157d3175f98089ddf564e8838c91dba28b4e8 Mon Sep 17 00:00:00 2001 From: Christian Leutloff Date: Thu, 24 Mar 2016 00:06:33 +0100 Subject: [PATCH 104/104] Updated webdriverio. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f216ba6..c2549c2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "mocha": "~2.4.5", "saucelabs": "~1.2.0", "util": "~0.10.3", - "webdriverio": "~4.0.3" + "webdriverio": "~4.0.5" }, "scripts": { "postinstall" : "node app.js &",