Skip to content

Commit

Permalink
Merge pull request #8 from saadtazi/pre-0.1.2
Browse files Browse the repository at this point in the history
Pre 0.1.2
  • Loading branch information
saadtazi committed Nov 7, 2013
2 parents 7e9e8cd + bfb98ae commit 5690117
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -3,6 +3,7 @@
[![Build Status](https://travis-ci.org/saadtazi/firefox-profile-js.png)](https://travis-ci.org/saadtazi/firefox-profile-js)
[![Coverage Status](https://coveralls.io/repos/saadtazi/firefox-profile-js/badge.png)](https://coveralls.io/r/saadtazi/firefox-profile-js)
[![Dependency Status](https://david-dm.org/saadtazi/firefox-profile-js.png)](https://david-dm.org/saadtazi/firefox-profile-js)
[![Selenium Test Status](https://saucelabs.com/buildstatus/saadtazi)](https://saucelabs.com/u/saadtazi)

[![NPM](https://nodei.co/npm/firefox-profile.png)](https://nodei.co/npm/firefox-profile/)

Expand Down
5 changes: 3 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "firefox-profile",
"version": "0.1.1",
"version": "0.1.2",
"description": "firefox profile for selenium WebDriverJs, admc/wd or any other node selenium driver that supports capabilities",
"main": "lib/firefox_profile",
"directories": {
Expand Down Expand Up @@ -42,7 +42,8 @@
"grunt-apidox": "~0.1.3",
"wd": "~0.2.0",
"chai-as-promised": "~4.1.0",
"grunt-mocha-cov": "0.0.7"
"grunt-mocha-cov": "0.0.7",
"request": "~2.27.0"
},
"dependencies": {
"wrench": "~1.5.1",
Expand Down
39 changes: 27 additions & 12 deletions test/spec/extension.spec.js
Expand Up @@ -5,6 +5,7 @@
var chai = require('chai'),
chaiAsPromised = require('chai-as-promised'),
wd = require('wd'),
request = require('request'),
browser,

FirefoxProfile = require('../../lib/firefox_profile'),
Expand All @@ -13,8 +14,9 @@ var chai = require('chai'),
chai.use(chaiAsPromised);
chai.should();

var username = process.env.SAUCE_USERNAME || 'SAUCE_USERNAME';
var accessKey = process.env.SAUCE_ACCESS_KEY || 'SAUCE_ACCESS_KEY';
var username = process.env.SAUCE_USERNAME || 'SAUCE_USERNAME',
accessKey = process.env.SAUCE_ACCESS_KEY || 'SAUCE_ACCESS_KEY',
jobId = process.env.TRAVIS_JOB_ID || 'JOB_ID';

// console.log(username, accessKey);
// having browser init in before() generates this error... Why?
Expand All @@ -27,10 +29,23 @@ var accessKey = process.env.SAUCE_ACCESS_KEY || 'SAUCE_ACCESS_KEY';

// also the browser quits when running locally, not in saucelabs
// so adding this... didn't help...
after(function() {
browser && browser.quit();
after(function(done) {
this.timeout(0);
browser && browser.quit().then(done);
});

function sendStatusToSauceLabs(sessionID, passed, cb) {
var url = 'http://' + username + ':' + accessKey + '@saucelabs.com/rest/v1/' + username + '/jobs/' + sessionID;
console.log('url::', url);
request.put({
url: url,
json: {passed: passed, public: 'public'}
}, function(err, response, body) {
//console.log('request:: ', body);
cb();
});
}

describe('install extension', function() {
this.timeout(0);

Expand Down Expand Up @@ -60,23 +75,23 @@ describe('install extension', function() {
.init({
browserName:'firefox',
firefox_profile: zippedProfile,
name: 'firefox-profile-js'
name: 'firefox-profile-js',
build: process.env.TRAVIS_JOB_ID
})
.get('http://saadtazi.com')
.sleep(1000)
// see http://getfirebug.com/wiki/index.php/Command_Line_API
// dirxml, $$ ... and console.table are defined by firebug
// but only console.table is available from js (not in console)
// because table method is probably added to the regular console
.eval('console.table')
.should.eventually.include('function').then(function() {
browser.quit();
done();
.eval('console.table').then(function(res) {
res.should.contain('function');
sendStatusToSauceLabs(browser.sessionID, true, function() { done(); });
})
.fail(function(err) {
browser.quit();
done(err);
});
sendStatusToSauceLabs(browser.sessionID, true, function() { done(err); });
})
.done();
});
});
});
Expand Down

0 comments on commit 5690117

Please sign in to comment.