Install Latest Version of Firefox on Travis And Run with Protractor - firefox

Travis installs Firefox 31.0esr by default, but we want to always use the latest version. The reference here says it should be pretty straight forward, but it doesn't seem to actually install, rather it just seems to download the tar file. Protractor still uses Firefox version 31.0esr when it runs.
travis.yml
addons:
firefox: "latest"
protractor.conf.js
capabilities: {
'browserName': 'firefox'
}
Logs:
Initial Firefox install still happens:
[34m[1mInstalled Firefox version[0m
firefox 31.0esr
... the addon section kicks in and downloads the file fine, before the before_install section as expected:
[0Ktravis_fold:start:install_firefox
[0K$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64'
[33;1mInstalling Firefox latest[0m
travis_time:start:0dff0345
[0K$ wget -O /tmp/firefox-latest.tar.bz2 $FIREFOX_SOURCE_URL
--2016-01-04 23:29:18-- https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64
Resolving download.mozilla.org (download.mozilla.org)... 52.20.26.65
Connecting to download.mozilla.org (download.mozilla.org)|52.20.26.65|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2 [following]
--2016-01-04 23:29:18-- http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 23.0.160.35, 23.0.160.65
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|23.0.160.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 52525181 (50M) [application/x-bzip2]
Saving to: `/tmp/firefox-latest.tar.bz2'
0% [ ] 0 --.-K/s
33% [============> ] 17,618,150 84.0M/s
67% [=========================> ] 35,556,926 84.7M/s
100%[======================================>] 52,525,181 83.6M/s in 0.6s
2016-01-04 23:29:18 (83.6 MB/s) - `/tmp/firefox-latest.tar.bz2' saved [52525181/52525181]
travis_time:end:0dff0345:start=1451950158289192377,finish=1451950158979104185,duration=689911808
[0Ktravis_fold:end:install_firefox
... then when protractor starts:
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.17.1.120:39697/wd/hub
Browser details:
Platform: LINUX
Browser Name: firefox
Browser Version: 31.0
I have a sneaking suspicion that even though the Travis docs says the addon section installs the file too, there is no indication this actually happens so I don't think it does.
For interests sake, this is how we print out the system information when protractor starts:
this.getBrowserCapabilities = function() {
return browser.getCapabilities().then(function (s) {
var browserCapabilities = {
browserName: '',
browserVersion: '',
platform: ''
};
browserCapabilities.platform = s.caps_.platform;
browserCapabilities.browserName = s.caps_.browserName;
browserCapabilities.browserVersion = s.caps_.version;
return browserCapabilities;
});
};

I stumbled over the same issue myself and I can confirm that Travis only downloads the specified firefox version.
This is what I did in my build script to use the downloaded version (in my example 43.0).
First, configure the addon in your .travis.yml file:
addons:
firefox: "43.0"
Now before runing your tests execute these steps:
echo "Extracting firefox and setting PATH variable..."
tar -xjf /tmp/firefox-43.0.tar.bz2 --directory /tmp
export PATH="/tmp/firefox:$PATH"
echo "Using firefox version `firefox --version`"
For a working example see also:
https://github.com/astehlik/typo3-extension-news_richteaser/blob/master/.travis.yml
I'm using Selenium in my case but I guess it should work no different with protractor.

Related

WebdriverIO: couldn't find executable for firefox browser using default runner (devtools:puppeteer)

I'm using webdriverIO for some automation testing and have recently migrated from 'selenium-standalone' service to default wdio devtools protocol.
wdio v.7.16.12
firefox v.95.0.2
From that point I can't start testing with firefox browser:
INFO #wdio/cli:launcher: Run onPrepare hook
INFO #wdio/cli:launcher: Run onWorkerStart hook
INFO #wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.js
INFO #wdio/local-runner: Run worker command: run
...
INFO devtools:puppeteer: Initiate new session using the DevTools protocol
ERROR #wdio/runner: Error: Couldn't find executable for browser
...
INFO #wdio/cli:launcher: Run onComplete hook
I've tried different combinations of options with 'wdio:devtoolsOptions' and 'moz:firefoxOptions'.
Plus checked whether could help dumpio: true, and 'moz:debuggerAddress': true options.
Also I've tried substitution browserName with product and adding binary and executablePath to capabilities.
When passing binary: 'path.to.firefox' to 'moz:firefoxOptions' options, the error message changes to:
ERROR #wdio/runner: Error: Only Nightly release channel is supported in Devtools/Puppeteer for Firefox. Refer to the following issue:
...
Any ideas how it could be fixed in webdriverIO (without installing separately puppeteer or puppeteer-firefox)?
Thanks!
Seems that I took desired for real.
wdio + devtools:puppeteer still work with Firefox Nightly only – https://github.com/webdriverio/webdriverio/discussions/7916

geckodriver not launching firefox

I am using firefox v 48.0.2 and am trying to get my selenium (selenium-server v2.53) remotedriver automated tests to run on firefox, I have geckodriver 0.9.0 installed and when i go through the documentation on the github readme and run this command: (on mac osx 10.11.3)
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
i get this error message:
thread '< main >' panicked at 'called Result::unwrap() on an Err value: Io(Error { repr: Os { code: 48, message: "Address already in use" } })', ../src/libcore/result.rs:746
note: Run with RUST_BACKTRACE=1 for a backtrace.
ive tried ignoring this step but when i run my tests firefox does not launch, i have ensured that my webdriver capabilities include marrionette: true
WebDriver:
browser: 'firefox'
clear_cookies: false
restart: false
window_size: 414x736
marionette: true
other than that i can not find any documentation to lead me in the correct direction, did i perhaps over look something? any help is greatly appreciated!
I am also using codeception to handle my tests (php)
EDIT
I was able to get this command to work after killing the process that was listening on port 4444:
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
But even with that running Firefox is still not launching

Can't start protractor with firefox

When I start protractor firefox opens, but my tests does not execute. After a while I get time out Error. Can you help me where is the problem? (Works fine with chrome).
OS: Windows 8.1 x64
protractor --version
Version 4.0.2
firefox version 48.0
protractor.config.js:
exports.config = {
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['*.spec.js'],
baseUrl: 'http://localhost:9876',
capabilities: {
'browserName': 'firefox'
}
};
First i start webdriver:
>webdriver-manager start
Then in other cmd, I run protractor:
>protractor protractor.conf.js
Output:
X:\e2e>protractor protractor.conf.js
[15:38:25] I/direct - Using FirefoxDriver directly...
[15:38:25] I/launcher - Running 1 instances of WebDriver
[15:39:11] E/launcher - Timed out waiting for the WebDriver server at http://127
.0.0.1:55485/hub
[15:39:11] E/launcher - Error: Timed out waiting for the WebDriver server at htt
p://127.0.0.1:55485/hub
at Error (native)
at onError (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_
modules\selenium-webdriver\http\util.js:87:11)
at ManagedPromise.invokeCallback_ (C:\Users\<USER>\AppData\Roaming\npm\node_m
odules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protr
actor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:2775:27
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\s
elenium-webdriver\lib\promise.js:639:7
at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
at Function.createSession (C:\Users\<USER>\AppData\Roaming\npm\node_modules\p
rotractor\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Driver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_m
odules\selenium-webdriver\firefox\index.js:386:38)
at Direct.getNewDriver (C:\Users\<USER>\AppData\Roaming\npm\node_modules\prot
ractor\built\driverProviders\direct.js:75:26)
at Runner.createBrowser (C:\Users\<USER>\AppData\Roaming\npm\node_modules\pro
tractor\built\runner.js:187:43)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\built\runner.j
s:261:30
at _fulfilled (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\no
de_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\<USER>\AppData\Roaming\npm\node_module
s\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\<USER>\AppData\Roaming\npm\node_
modules\protractor\node_modules\q\q.js:796:13)
at C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\node_modules\q
\q.js:556:49
at runSingle (C:\Users\<USER>\AppData\Roaming\npm\node_modules\protractor\nod
e_modules\q\q.js:137:13)
[15:39:11] E/launcher - Process exited with error code 199
Firefox 48 is not yet supported by latest version of protractor , please downgrade your firefox to 47.0.1 and try it would certainly work!
Install the latest version of Firefox and protractor .
Open the command line in admin mode if you have installed Firefox inside of program files to avoid potential access errors .
Use the below mentioned capabilities in your conf.js
exports.config = {
framework: 'jasmine',
directConnect: false, //Start protractor without start the selenium server using webdriver-manager start. default value is fales
//This is only for chrome and firefox and use drivers instead of selenium server
capabilities: {
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe'
//Need to start cmd via admin mode to avoid permission error
}
},
//set to true So each spec will be executed in own browser instance. default value is false
//restartBrowserBetweenTests: true,
jasmineNodeOpts: {
//Jasmine provides only one timeout option timeout in milliseconds don't add ;
defaultTimeoutInterval: 180000
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/com/sam/scriptjs/iframes.spec.js']
}

Protractor + Jasmine 2

I have config and specs files at shared folder of remote server. I run tests from local machine via console:
C:\Users\User>protractor \remoteServer\AutoSPA\config\protractor.conf.js
With jasmine framework all works good, but if I set framework: 'jasmine2' in protractor.conf.js tests don`t run:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.17.175.168:50910/wd/hub
Started
No specs found
Finished in 0.001 seconds
Uncaught exception: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
[launcher] Process exited with error code 1
EXAMPLE:
conf.js:
exports.config = {
specs: ['./test.js'],
capabilities : {'browserName' : 'chrome'},
framework: 'jasmine2',
jasmineNodeOpts: {showColors: true}
};
test.js in the same folder:
describe("test", function(){
it("navigate", function(){
browser.get("https://angularjs.org/")
})
});
if it's local folder it works correctly, but if it's remote folder it doesn't find spec test.js.
I investigated and debug a little bit more and found out that Jasmine 1.3 used FS and Path for specs search, but Jasmine 2 used GLOB. Glob doesn't work with remote paths.

phantomjs does not capture

I set up a standard yeoman/angular installation on Mac OS X 10.8.3 using npm. I created a new angular project using the yo generator. I installed phantomjs via npm install -g phantomjs. I configured karma to unly use phantomjs (all other browsers work fine). When running tests with grunt test, phantomjs does not capture at all, even if I set a very long timeout (50000ms). This is the log output:
Running "karma:unit" (karma) task
DEBUG [reporter]: Using reporter "progress".
INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
DEBUG [launcher]: Creating temp dir at /var/folders/6j/gz50dm2d3xv1hnz7s1t4lhn40000gp/T/testacular-79891032
DEBUG [launcher]: /usr/local/bin/phantomjs /var/folders/6j/gz50dm2d3xv1hnz7s1t4lhn40000gp/T/testacular-79891032/capture.js
WARN [watcher]: Pattern "/Users/alexanderwalter/Development/angularSeed/test/mock/**/*.js" does not match any file.
DEBUG [watcher]: Resolved files:
/Users/alexanderwalter/Development/angularSeed/node_modules/grunt-karma/node_modules/karma/adapter/lib/jasmine.js
/Users/alexanderwalter/Development/angularSeed/node_modules/grunt-karma/node_modules/karma/adapter/jasmine.js
/Users/alexanderwalter/Development/angularSeed/app/components/angular/angular.js
/Users/alexanderwalter/Development/angularSeed/app/components/angular-mocks/angular-mocks.js
/Users/alexanderwalter/Development/angularSeed/app/scripts/app.js
/Users/alexanderwalter/Development/angularSeed/app/scripts/controllers/add.js
/Users/alexanderwalter/Development/angularSeed/app/scripts/controllers/main.js
/Users/alexanderwalter/Development/angularSeed/test/spec/controllers/add.js
/Users/alexanderwalter/Development/angularSeed/test/spec/controllers/main.js
DEBUG [web server]: serving: /Users/alexanderwalter/Development/angularSeed/node_modules/grunt-karma/node_modules/karma/static/client.html
DEBUG [web server]: serving: /Users/alexanderwalter/Development/angularSeed/node_modules/grunt-karma/node_modules/karma/static/testacular.js
DEBUG [karma]: New browser has connected on socket wxBffi5IEZn9zQvoTm0J
WARN [launcher]: PhantomJS have not captured in 50000 ms, killing.
DEBUG [launcher]: Process PhantomJS exitted with code 1
ERROR [launcher]: Cannot start PhantomJS
As I said, it works for all other browsers. Phantomjs also works if I pass it a simple test script which prints hello world to the console.
I had the same issue and found out it was a problem with nodejs 0.10.8/0.10.9: https://github.com/karma-runner/karma/issues/558
Downgrading to nodejs 0.10.7 solved the problem for me.
In case you want to go with node 0.10.11, the Proxy option worked for me (Mac 10.6.8, Karma 0.8.5, and node 0.10.11 or 0.10.7. Node 0.10.8/9/10 didn't work.).
Inside the karma.conf.js file:
proxies = {
'/': 'http://localhost:9000'
};
urlRoot = '/__unit/';
Inside the karma-e2e.conf.js file:
proxies = {
'/': 'http://localhost:9000'
};
urlRoot = '/__e2e/';
I upgraded to the latest stable version of Node.js. This solved it for me. currently v.10.20.

Resources