TeamCity: PhantomJS have not captured in 60000 ms, killing - angularjs

I'm encountering an issue when running tests in my CI environment. The configuration works fine on MacOS 10.11.6 (El Capitan), with Node v6.0.0 / npm 3.8.6, but on a TeamCity 9.1.6 agent running Windows with Node v4.2.2 / npm 2.14.7, it fails miserably with an error of PhantomJS have not captured in 60000 ms.
Here's an example stacktrace on TeamCity:
[08:58:40][exec] 02 11 2016 08:58:41.095:DEBUG [config]: autoWatch set to false, because of singleRun
[08:58:40][exec] 02 11 2016 08:58:41.102:DEBUG [plugin]: Loading plugin karma-jasmine.
[08:58:40][exec] 02 11 2016 08:58:41.107:DEBUG [plugin]: Loading plugin karma-chrome-launcher.
[08:58:40][exec] 02 11 2016 08:58:41.121:DEBUG [plugin]: Loading plugin karma-firefox-launcher.
[08:58:40][exec] 02 11 2016 08:58:41.128:DEBUG [plugin]: Loading plugin karma-phantomjs-launcher.
[08:58:40][exec] 02 11 2016 08:58:41.263:DEBUG [web-server]: Instantiating middleware
[08:58:41][exec] 02 11 2016 08:58:41.595:INFO [karma]: Karma v1.3.0 server started at http://localhost:9877/
[08:58:41][exec] 02 11 2016 08:58:41.596:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
[08:58:41][exec] 02 11 2016 08:58:41.616:INFO [launcher]: Starting browser PhantomJS
[08:58:41][exec] 02 11 2016 08:58:41.618:DEBUG [temp-dir]: Creating temp dir at E:\TCA\3\temp\buildTmp\karma-47802965
[08:58:41][exec] 02 11 2016 08:58:41.631:DEBUG [launcher]: E:\TCA\3\work\f900f2fe23d6c9b0\Preview\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs E:\TCA\3\temp\buildTmp\karma-47802965/capture.js
[08:59:41][exec] 02 11 2016 08:59:41.621:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
[08:59:43][exec] 02 11 2016 08:59:43.624:WARN [launcher]: PhantomJS was not killed in 2000 ms, sending SIGKILL.
[08:59:45][exec] 02 11 2016 08:59:45.627:WARN [launcher]: PhantomJS was not killed by SIGKILL in 2000 ms, continuing.
[08:59:45][exec] 02 11 2016 08:59:45.628:DEBUG [launcher]: Process PhantomJS exited with code -1
[08:59:45][exec] 02 11 2016 08:59:45.629:DEBUG [temp-dir]: Cleaning temp dir E:\TCA\3\temp\buildTmp\karma-47802965
[08:59:45][exec] 02 11 2016 08:59:45.637:DEBUG [launcher]: PhantomJS failed (timeout). Not restarting.
[08:59:45][exec] 02 11 2016 08:59:45.638:DEBUG [karma]: Run complete, exiting.
[08:59:45][exec] 02 11 2016 08:59:45.639:DEBUG [launcher]: Disconnecting all browsers
[08:59:45][exec] Warning: Task "karma:unit" failed. Use --force to continue.
[08:59:45][exec]
[08:59:45][exec] Aborted due to warnings.
[08:59:45][exec] npm ERR! Test failed. See above for more details.
Here's a snippet of package.json:
"devDependencies": {
"bower": "latest",
"grunt": "^1.0.1",
"grunt-cli": "^1.2.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-istanbul-coverage": "^0.1.4",
"grunt-karma": "^2.0.0",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"jasmine-core": "^2.5.2",
"matchdep": "^1.0.1"
},
"scripts": {
"postinstall": "node ./node_modules/bower/bin/bower install",
"test": "node ./node_modules/.bin/grunt default"
}
And here's a snippet of karma.conf.js:
module.exports = function (config) {
'use strict';
config.set({
frameworks: ['jasmine'],
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher'
],
files: [
<...>
],
exclude: [],
preprocessors: {
},
reporters: ['progress']
port: 9877,
runnerPort: 9101,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['PhantomJS'],
captureTimeout: 60000,
singleRun: true
});

Issue solved! In our CI environment, we aren't getting the node modules by running npm install - we are zipping the node_modules directory locally and adding it to our source code.
Zipping it on a Mac and exploding it on Windows and attempting to use those modules, especially phantomjs-prebuilt, is the reason why it wasn't capturing.
I zipped it from Windows instead and it worked perfectly.

I've had the PhantomJS have not captured in 60000 ms, killing problem locally and after some experimenting it turned out that it may have been caused by:
Clash between PhantomJS available from classpath vs
phatomjs-prebuilt downloaded to project's node_modules. I just removed the globally available one.
Missing PHANTOMJS_CDNURL environment (system) variable, pointing to a maven repository, check where to get PhantomJS.

Related

Error "Property 'mock' does not exist on"... when running gulp client tests

So im trying to run some tests in my project and this is the error I get when I run gulp test:client.
I couldn't find much information about it and I really don't get why this is happening. My project is based on the Angular Fullstack Generator 4.2.0.
Node version is 6.10 and npm 4.5.
Any hint is really appreciated.
Thanks!
pablos-mbp:widget pablo$ gulp test:client
31 08 2017 11:02:14.747:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket xrwLxHjkTkNLJhc3AAAA with id 5085667
31 08 2017 11:02:14.747:DEBUG [launcher]: PhantomJS (id 5085667) captured in 1.392 secs
31 08 2017 11:02:14.753:DEBUG [phantomjs.launcher]:
31 08 2017 11:02:14.755:DEBUG [web-server]: serving: /Users/pablo/workspace/widget/node_modules/karma/static/context.html
31 08 2017 11:02:14.758:DEBUG [middleware:source-files]: Requesting /base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?73bc53d3671677e6a093fc74e4f9bcde57e5f7ad /
31 08 2017 11:02:14.758:DEBUG [middleware:source-files]: Fetching /Users/pablo/workspace/widget/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
31 08 2017 11:02:14.759:DEBUG [web-server]: serving (cached): /Users/pablo/workspace/widget/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
31 08 2017 11:02:14.760:DEBUG [middleware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/boot.js?945a38bf4e45ad2770eb94868231905a04a0bd3e /
31 08 2017 11:02:14.760:DEBUG [middleware:source-files]: Fetching /Users/pablo/workspace/widget/node_modules/karma-jasmine/lib/boot.js
31 08 2017 11:02:14.761:DEBUG [web-server]: serving (cached): /Users/pablo/workspace/widget/node_modules/karma-jasmine/lib/boot.js
31 08 2017 11:02:14.761:DEBUG [middleware:source-files]: Requesting /base/spec.js?7a69f03490a6f80f910cff86fc37abc9ee7cd0f6 /
31 08 2017 11:02:14.762:DEBUG [middleware:source-files]: Fetching /Users/pablo/workspace/widget/spec.js
31 08 2017 11:02:14.762:DEBUG [middleware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/adapter.js?7a813cc290d592e664331c573a1a796192cdd1ad /
31 08 2017 11:02:14.762:DEBUG [middleware:source-files]: Fetching /Users/pablo/workspace/widget/node_modules/karma-jasmine/lib/adapter.js
31 08 2017 11:02:14.762:DEBUG [web-server]: serving (cached): /Users/pablo/workspace/widget/spec.js
31 08 2017 11:02:14.819:DEBUG [web-server]: serving (cached): /Users/pablo/workspace/widget/node_modules/karma-jasmine/lib/adapter.js
Component: MainComponent
✓ should attach a list of things to the controller
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 1 of 1 SUCCESS (0.003 secs / 0.035 secs)
TOTAL: 1 SUCCESS
31 08 2017 11:02:15.022:DEBUG [karma]: Run complete, exiting.
31 08 2017 11:02:15.022:DEBUG [launcher]: Disconnecting all browsers
31 08 2017 11:02:15.029:DEBUG [coverage]: Writing coverage to /Users/pablo/workspace/widget/coverage/client
31 08 2017 11:02:15.114:DEBUG [coverage]: Writing coverage to /Users/pablo/workspace/widget/coverage
31 08 2017 11:02:15.126:DEBUG [launcher]: Process PhantomJS exited with code 0
31 08 2017 11:02:15.126:DEBUG [temp-dir]: Cleaning temp dir /var/folders/n5/31jf7x153xx_b_yqskjlj5m00000gn/T/karma-5085667
31 08 2017 11:02:15.135:DEBUG [launcher]: Finished all browsers
[11:02:15] Finished 'test:client' after 6.12 s
pablos-mbp:widget pablo$ [default] /Users/pablo/workspace/widget/client/app/main/main.component.spec.ts:9:22
Property 'mock' does not exist on type 'IAngularStatic'.
[default] /Users/pablo/workspace/widget/client/app/main/main.component.spec.ts:10:22
Property 'mock' does not exist on type 'IAngularStatic'.
[default] /Users/pablo/workspace/widget/client/app/main/main.component.spec.ts:18:14
Cannot find name 'inject'.

karma chrome not loading.its giving up after two attempts

I'm integrating Jasmine and karma for unit testing my ionic app.
I'm following this blog.
When i run the karma start command i keep getting this result.
23 02 2017 16:39:18.508:WARN [karma]: No captured browser, open
23 02 2017 16:39:18.517:INFO [karma]: Karma v1.5.0 server started at http://0.0.0.0:9876/
23 02 2017 16:39:18.517:INFO [launcher]: Launching browser Chrome with unlimited concurrency
23 02 2017 16:39:18.536:INFO [launcher]: Starting browser Chrome
23 02 2017 16:40:18.537:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
23 02 2017 16:40:18.910:INFO [launcher]: Trying to start Chrome again (1/2).
23 02 2017 16:41:18.911:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
23 02 2017 16:41:19.357:INFO [launcher]: Trying to start Chrome again (2/2).
Tried with PhantomJS also
Same error
Launching browser PhantomJS with unlimited concurrency
23 02 2017 17:44:30.214:INFO [launcher]: Starting browser PhantomJS
23 02 2017 17:45:30.215:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
23 02 2017 17:45:30.238:INFO [launcher]: Trying to start PhantomJS again (1/2).
23 02 2017 17:46:30.239:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
23 02 2017 17:46:30.246:INFO [launcher]: Trying to start PhantomJS again (2/2).
23 02 2017 17:47:30.247:WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
23 02 2017 17:47:30.254:ERROR [launcher]: PhantomJS failed 2 times (timeout). Giving up.
Config
// Karma configuration
// Generated on Thu Feb 23 2017 10:39:27 GMT+0530 (IST)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'../www/lib/ionic/js/ionic.bundle.js',
'../www/js/**/*.js',
'../tests/unit-tests/**/*.js',
'../node_modules/angular-mocks/angular-mocks.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// browsers: ['PhantomJS'],
browsers: ['Chrome'],
// customLaunchers: {
// Chrome_no_sandbox: {
// base: 'Chrome',
// flags: ['--no-sandbox']
// }
// },
plugins:[
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-chrome-launcher'
],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
})
}
Please help
Thanks!
This is the top Google result for this question, so even though it's old I hope my answer helps someone.
In our case the issue was caused by multiple files importing from the wrong library. This seems strange since you would think that Karma would throw an error rather than just refusing to open Chrome, but altering our import statements got us past the issue.
import { ChangeDetectionStrategy } from "#angular/core";
NOT AS OUR FILES HAD IT: import { ChangeDetectionStrategy } from "#angular/compiler/src/core";
This says you should try add the below code to karma.conf.js file:
browsers: ['Chrome_no_sandbox'],
customLaunchers: {
Chrome_no_sandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
Try increasing browserDisconnectTolerance. Reasons could be different, from the wrong path in karma.config to some flaky npm run.

PhantomJS not captured when ran via build server

I am using Karma and PhantomJS with Jasmine to test my AngularJS. When I run my gulp test locally it works fine, launches PhantomJS and runs all my tests, but when the tests get run on the build server it fails with the following errors:
Note that I am using VSTS and using their built in cloud build system (hosted agent). Having said that its pretty much a task runner and I only use it to run gulp tasks (build, test etc) on checkin
[32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/
[32m13 07 2016 15:21:32.262:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
[32m13 07 2016 15:21:32.284:INFO [launcher]: [39mStarting browser PhantomJS
[33m13 07 2016 15:22:32.285:WARN [launcher]: [39mPhantomJS have not captured in 60000 ms, killing.
[33m13 07 2016 15:22:34.287:WARN [launcher]: [39mPhantomJS was not killed in 2000 ms, sending SIGKILL.
[33m13 07 2016 15:22:36.288:WARN [launcher]: [39mPhantomJS was not killed by SIGKILL in 2000 ms, continuing.
My Karma config is:
var configuration = {
basePath: "",
files: listFiles(),
singleRun: true,
autoWatch: false,
//usePolling: true,
//transports: ["xhr-polling", "jsonp-polling"],
frameworks: ["jasmine", "angular-filesort"],
angularFilesort: {
whitelist: [path.join(conf.paths.src, "/**/!(*.html|*.spec|*.mock).js")]
},
ngHtml2JsPreprocessor: {
stripPrefix: "src/",
moduleName: "veriApp"
},
browsers: ["PhantomJS"],
//browsers: ["Chrome"],
plugins: [
"karma-chrome-launcher",
"karma-phantomjs-launcher",
"karma-angular-filesort",
"karma-jasmine",
"karma-ng-html2js-preprocessor"
],
preprocessors: {
"src/**/*.html": ["ng-html2js"]
}
};
Here are the relevant parts of my package.json. Note that an NPM install is performed before the test is run
"karma": "1.1.1",
"karma-angular-filesort": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-ng-html2js-preprocessor": "1.0.0",
"phantomjs-prebuilt": "2.1.4",
"karma-phantomjs-launcher": "1.0.0",
"karma-chrome-launcher": "1.0.1",
I've tried following advice from various answers regarding this but none seem to work! Perhaps I am missing something?
So... the solution is pretty easy but took a while to find:
Under the Variables tab of the build setup, add an environment variable:
PHANTOMJS_BIN C:\NPM\Modules\PhantomJS.cmd
Thanks to this link and this link.

Karma Jasmine NPM config

karma config errors
I'm trying to configure my test environment, and getting the following bugs when I try to run karma.
karma start
06 10 2015 13:13:36.859:DEBUG [plugin]: Loading plugin karma-jasmine.
06 10 2015 13:13:36.917:DEBUG [karma]: List of files has changed, trying to execute
06 10 2015 13:13:36.918:WARN [karma]: No captured browser, open http://localhost:9876/
06 10 2015 13:13:36.922:DEBUG [watcher]: Watching ".../representative-summary/node_modules/angular"
06 10 2015 13:13:36.922:DEBUG [watcher]: Watching ".../representative-summary/node_modules/angular-resource"
06 10 2015 13:13:36.923:DEBUG [watcher]: Watching ".../representative-summary/spec"
06 10 2015 13:13:36.927:WARN [launcher]: Can not load "karma-chrome-launcher", it is not registered!
Perhaps you are missing some plugin?
06 10 2015 13:13:36.927:WARN [launcher]: Can not load "karma-firefox-launcher", it is not registered!
Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-safari-launcher", it is not registered!
Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-ie-launcher", it is not registered!
Perhaps you are missing some plugin?
06 10 2015 13:13:36.928:WARN [launcher]: Can not load "karma-phantomjs-launcher", it is not registered!
Perhaps you are missing some plugin?
karma.conf.js
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
{pattern: 'node_modules/angular/*.js', included: true},
{pattern: 'node_modules/angular-resource/*.js', included: true},
{pattern: 'spec/*.spec.js', included: true}
],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
//config.LOG_INFO,
autoWatch: true,
browsers: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-safari-launcher',
'karma-phantomjs-launcher'
],
plugins: ['karma-jasmine'],
singleRun: false
})
};
I'm on OSX Yosemite 10.10.5, and yes there is a standalone test in there "expect true to be true" just to get it up and running by itself. The app I am writing is Angular, but I haven't touched any of the tests for that yet. I want just the basic test runner to be working right first.
Any help would be great. Thanks.
Browsers in karma come in English format (Chrome, Firefox, PhantomJS), not as their respective plugin names. The plugins just have to be installed with npm install --save.
ALSO: Karma will "magically" load any library in your node_modules directory starting with karma-, so you don't need to declare plugins: at all in your configuration file.

'Angular could not be found' when integrating Travis/Sauce Labs

I'm working to get Travis CI to run Protractor tests using Sauce Labs. The tunneling works fine, and my Express server clearly starts and stays up at http://localhost:9000, but my Protractor tests quickly fail with the error Error: Angular could not be found on the page http://localhost:9000/ : retries looking for angular exceeded. All the suggestions on the Internet usually involve not using Angular 1.0 (using 1.3), extending time outs (doing that), or forcing Protractor to look at <html> for the ng-app directive (doing that). I'm out of ideas.
Relevant config:
protractor.conf.js
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
baseUrl: 'http://localhost:9000',
specs: ['e2e/**/*.spec.js'],
framework: 'jasmine',
maxSessions: 1,
allScriptsTimeout: 30000,
rootElement: 'html',
multiCapabilities: [
{'browserName': 'chrome'},
{'browserName': 'firefox'},
{'name': 'diplomacy'},
{'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER ? process.env.TRAVIS_JOB_NUMBER : null},
{'build': process.env.TRAVIS_BUILD_NUMBER ? process.env.TRAVIS_BUILD_NUMBER : null}
],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 360000,
includeStackTrace: true
}
}
main.spec.js
'use strict';
describe('Home page', function() {
var page;
beforeEach(function() {
browser.get(browser.baseUrl);
});
it('should pass', function() {
expect(true).toBe(true);
});
});
Travis log
Go here for the complete log. The highlights:
Extracting Sauce Connect
Waiting for Sauce Connect readyfile
08 Mar 16:30:00 - Sauce Connect 4.3.6, build 1628 8a5c837
08 Mar 16:30:00 - Using CA certificate bundle /etc/ssl/certs/ca-certificates.crt.
08 Mar 16:30:00 - Starting up; pid 3519
08 Mar 16:30:00 - Command line arguments: sc-4.3.6-linux//bin/sc -i 42.1 -f sauce-connect-ready-21801 -l /home/travis/sauce-connect.log
08 Mar 16:30:00 - Using no proxy for connecting to Sauce Labs REST API.
08 Mar 16:30:00 - Resolving saucelabs.com to 162.222.73.28 took 17 ms.
08 Mar 16:30:01 - Started scproxy on port 37246.
08 Mar 16:30:01 - Please wait for 'you may start your tests' to start your tests.
08 Mar 16:30:01 - Starting secure remote tunnel VM...
08 Mar 16:30:11 - Secure remote tunnel VM provisioned.
08 Mar 16:30:11 - Tunnel ID: 3cc5fd5b59984957831d125617c7d4f6
08 Mar 16:30:11 - Secure remote tunnel VM is now: booting
08 Mar 16:30:14 - Secure remote tunnel VM is now: running
08 Mar 16:30:14 - Remote tunnel host is: maki76159.miso.saucelabs.com
08 Mar 16:30:14 - Using no proxy for connecting to tunnel VM.
08 Mar 16:30:14 - Resolving maki76159.miso.saucelabs.com to 162.222.76.159 took 48 ms.
08 Mar 16:30:14 - Starting Selenium listener...
08 Mar 16:30:14 - Establishing secure TLS connection to tunnel...
08 Mar 16:30:14 - Selenium listener started on port 4445.
08 Mar 16:30:16 - Sauce Connect is up, you may start your tests.
08 Mar 16:30:16 - Connection established.
[unit tests here...all passing!]
[chrome #1] PID: 3621
[chrome #1] Specs: /home/travis/build/spamguy/diplomacy/e2e/main/main.spec.js
[chrome #1]
[chrome #1] Using SauceLabs selenium server at http://ondemand.saucelabs.com:80/wd/hub
[chrome #1] [31mF[0m
[chrome #1]
[chrome #1] Failures:
[chrome #1]
[chrome #1] 1) Home page should pass
[chrome #1] Message:
[chrome #1] [31mError: Angular could not be found on the page http://localhost:9000/ : retries looking for angular exceeded[0m
[chrome #1] Stacktrace:
[chrome #1] Error: Angular could not be found on the page http://localhost:9000/ : retries looking for angular exceeded
[chrome #1] ==== async task ====
[chrome #1] Protractor.get(http://localhost:9000/) - test for angular
[chrome #1] at [object Object].<anonymous> (/home/travis/build/spamguy/diplomacy/e2e/main/main.spec.js:7:13)
[chrome #1] ==== async task ====
[chrome #1] Asynchronous test function: beforeEach()
[chrome #1] Error
[chrome #1] at [object Object].<anonymous> (/home/travis/build/spamguy/diplomacy/e2e/main/main.spec.js:6:3)
[chrome #1] at Object.<anonymous> (/home/travis/build/spamguy/diplomacy/e2e/main/main.spec.js:3:1)
[chrome #1]
[chrome #1] Finished in 11.877 seconds
[chrome #1] [31m1 test, 2 assertions, 1 failure
[0m[chrome #1]
[chrome #1] SauceLabs results available at http://saucelabs.com/jobs/c0eed61d95044f77b200a7b21d2443a3
[launcher] 1 instance(s) of WebDriver still running
[two more WebDriver instances fail with similar errors]
FWIW, I eventually got everything working correctly. There is no 'one fix' I made so I can't really clarify the solution easily. The following files are from my repository with which I set up continuous integration.
protractor-travis.conf.js
exports.config = {
// sauce plz
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
baseUrl: 'http://localhost',
specs: ['e2e/**/*.po.js', 'e2e/**/*.spec.js'],
framework: 'jasmine',
maxSessions: 1,
allScriptsTimeout: 40000,
getPageTimeout: 40000,
rootElement: 'html',
multiCapabilities: [
capabilitiesForBrowser('chrome', '41'),
capabilitiesForBrowser('firefox'),
capabilitiesForBrowser('safari')
],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 360000,
includeStackTrace: true
}
};
function capabilitiesForBrowser(browserName, browserVersion) {
var capabilities = {
'browserName': browserName,
'build': process.env.TRAVIS_BUILD_NUMBER,
'name': 'dipl.io'
};
if (browserVersion)
capabilities.version = browserVersion;
return capabilities;
}
Gruntfile.js
protractor: {
travis: {
options: {
configFile: 'protractor-travis.conf.js',
args: {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY
}
}
},
local: {
options: {
configFile: 'protractor-local.conf.js'
//,debug: true
}
}
}
.travis.yml
language: node_js
node_js:
- '0.12'
services:
- mongodb
env:
global:
- secure: ioYHs4gjuL9iuwxamtKCkERvvSiBlAgxhLZ1Ry4xrZhNWe3e4pett3249hWovDYzG/eEHTA20/NDvZ1JIMYODFzY4gURVHNtUkoYNokLSDguTH1OPXGMmtQzJGersxYQOjRj3gSss7Z0joUrcfPQJsG1Vt0eHR/ewN7Qbm8NBn0=
- secure: NH3WbHM2Ir95csdWAdd7/ISYVvnYFQe7Rv4rCoYu9V6V2M9AzlARYTAvBqoK7PdD/RV0KR41t6OVeUxBVhuzT26NvBVZVyLcvfjK29AoKCDCU7VD7nQa/RQ9KyDr5DAHfyQQ5AQMhsla5qPTaFZb82F83lL44nDzrvYzE8CEaGw=
before_install:
- npm install -g bower
- bower install
- sed -i 's/git#github.com:/https:\/\/github.com\//' .gitmodules
- git submodule update --init --recursive
- npm install -g grunt-cli
script:
- grunt test:protractor-travis
I'm having the same problem here. Except here's a difference:
When I start up a SauceConnect tunnel manually, as described here:
https://docs.saucelabs.com/reference/sauce-connect/#when-should-i-use-sauce-connect-
Then everything runs smoothly, and my build passses.
But I don't want to have to start up SauceConnect manually every time, I want that to happen automatically during the build process. So I updated the travis.yml file as instructed here:
http://docs.travis-ci.com/user/sauce-connect/
In this case, the tunnel is opened automatically. Here's a bit of the log, too long to paste all, but I can assure you that the tunnel is opened.
Starting Sauce Connect
25.96s$ travis_start_sauce_connect
Using temp dir /tmp/sc.hHct
/tmp/sc.hHct ~/build/Diobox/diobox_stateful
Downloading Sauce Connect
--2015-06-11 17:13:21-- http://saucelabs.com/downloads/sc-4.3.6-linux.tar.gz
Resolving saucelabs.com (saucelabs.com)... 162.222.73.28
Connecting to saucelabs.com (saucelabs.com)|162.222.73.28|:80... connected.
HTTP request sent, awaiting response... 200 OK
....
11 Jun 17:13:23 - Starting up; pid 3524
11 Jun 17:13:23 - Command line arguments: sc-4.3.6-linux//bin/sc -i 25.1 -f sauce-connect-ready-29337 -l /home/travis/sauce-connect.log
11 Jun 17:13:23 - Using no proxy for connecting to Sauce Labs REST API.
11 Jun 17:13:23 - Resolving saucelabs.com to 162.222.73.28 took 1 ms.
11 Jun 17:13:24 - ***********************************************************
11 Jun 17:13:24 - A newer version of Sauce Connect (build 1671) is available!
11 Jun 17:13:24 - Download it here:
11 Jun 17:13:24 - https://saucelabs.com/downloads/sc-4.3.8-linux.tar.gz
11 Jun 17:13:24 - ***********************************************************
11 Jun 17:13:24 - Started scproxy on port 50965.
11 Jun 17:13:24 - Please wait for 'you may start your tests' to start your tests.
11 Jun 17:13:24 - Starting secure remote tunnel VM...
11 Jun 17:13:24 - Shutting down named tunnel 25.1 (b7f004bfd8174ac6be612082b1654367).
11 Jun 17:13:32 - Secure remote tunnel VM provisioned.
11 Jun 17:13:32 - Tunnel ID: 6f295a34dfe14b639b78438e59307ae3
11 Jun 17:13:32 - Secure remote tunnel VM is now: booting
11 Jun 17:13:46 - Secure remote tunnel VM is now: running
11 Jun 17:13:46 - Remote tunnel host is: maki78107.miso.saucelabs.com
11 Jun 17:13:46 - Using no proxy for connecting to tunnel VM.
11 Jun 17:13:46 - Resolving maki78107.miso.saucelabs.com to 162.222.78.107 took 8 ms.
11 Jun 17:13:46 - Starting Selenium listener...
11 Jun 17:13:46 - Establishing secure TLS connection to tunnel...
11 Jun 17:13:46 - Selenium listener started on port 4445.
11 Jun 17:13:47 - Sauce Connect is up, you may start your tests.
11 Jun 17:13:47 - Connection established.
But then once the connection is opened, and build gets to the point where tests should be running, I get the same Angular errors you listed above.

Resources