first post

This commit is contained in:
2012-05-25 09:03:56 -04:00
commit 6a753904b7
609 changed files with 252648 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# nodeunit test
wd = require '../../lib/main'
should = require 'should'
assert = require 'assert'
runTestWith = (remoteWdConfig, desired) ->
remoteWdConfig = remoteWdConfig() if typeof remoteWdConfig is 'function'
browser = null
{
remote: (test) ->
browser = wd.remote remoteWdConfig
should.exist browser
browser.on "status", (info) ->
console.log "\u001b[36m%s\u001b[0m", info
browser.on "command", (meth, path) ->
console.log " > \u001b[33m%s\u001b[0m: %s", meth, path
test.done()
init: (test) ->
browser.init desired, ->
test.done()
browsing:
'getting page': (test) ->
browser.get "http://saucelabs.com/test/guinea-pig", ->
browser.title (err, title) ->
assert.ok ~title.indexOf("I am a page title - Sauce Labs"), "Wrong title!"
test.done()
clicking: (test) ->
browser.elementById "submit", (err, el) ->
browser.clickElement el, ->
browser.eval "window.location.href", (err, title) ->
assert.ok ~title.indexOf("#"), "Wrong title!"
test.done()
leaving: (test) ->
browser.quit ->
test.done()
}
exports.runTestWith = runTestWith

View File

@@ -0,0 +1,64 @@
// Generated by CoffeeScript 1.3.2
(function() {
var assert, runTestWith, should, wd;
wd = require('../../lib/main');
should = require('should');
assert = require('assert');
runTestWith = function(remoteWdConfig, desired) {
var browser;
if (typeof remoteWdConfig === 'function') {
remoteWdConfig = remoteWdConfig();
}
browser = null;
return {
remote: function(test) {
browser = wd.remote(remoteWdConfig);
should.exist(browser);
browser.on("status", function(info) {
return console.log("\u001b[36m%s\u001b[0m", info);
});
browser.on("command", function(meth, path) {
return console.log(" > \u001b[33m%s\u001b[0m: %s", meth, path);
});
return test.done();
},
init: function(test) {
return browser.init(desired, function() {
return test.done();
});
},
browsing: {
'getting page': function(test) {
return browser.get("http://saucelabs.com/test/guinea-pig", function() {
return browser.title(function(err, title) {
assert.ok(~title.indexOf("I am a page title - Sauce Labs"), "Wrong title!");
return test.done();
});
});
},
clicking: function(test) {
return browser.elementById("submit", function(err, el) {
return browser.clickElement(el, function() {
return browser["eval"]("window.location.href", function(err, title) {
assert.ok(~title.indexOf("#"), "Wrong title!");
return test.done();
});
});
});
}
},
leaving: function(test) {
return browser.quit(function() {
return test.done();
});
}
};
};
exports.runTestWith = runTestWith;
}).call(this);

View File

@@ -0,0 +1,3 @@
config.coffee
config.js

View File

@@ -0,0 +1,5 @@
In order to run the saucelabs tests, first copy config-sample.coffee
to config.coffee, and then configure your sauce username and access-key in
config.coffee.
config.coffee and config.js are in .gitignore.

View File

@@ -0,0 +1,31 @@
# nodeunit test
{runTestWith} = require '../common/basic-test-base'
configHelper = require './config-helper'
remoteWdConfig= configHelper.getRemoteWdConfig()
nameBase = "saucelabs basic test - ";
chromeDesired =
name: nameBase + 'chrome'
browserName:'chrome'
firefoxDesired =
name: nameBase + 'firefox'
browserName:'firefox'
explorerDesired =
name: nameBase + 'explorer'
browserName:'iexplore'
version:'9'
platform:'Windows 2008'
exports.wd =
chrome: runTestWith( remoteWdConfig , chromeDesired)
firefox: runTestWith(remoteWdConfig, firefoxDesired)
explorer: runTestWith(remoteWdConfig, explorerDesired)

View File

@@ -0,0 +1,36 @@
// Generated by CoffeeScript 1.3.2
(function() {
var chromeDesired, configHelper, explorerDesired, firefoxDesired, nameBase, remoteWdConfig, runTestWith;
runTestWith = require('../common/basic-test-base').runTestWith;
configHelper = require('./config-helper');
remoteWdConfig = configHelper.getRemoteWdConfig();
nameBase = "saucelabs basic test - ";
chromeDesired = {
name: nameBase + 'chrome',
browserName: 'chrome'
};
firefoxDesired = {
name: nameBase + 'firefox',
browserName: 'firefox'
};
explorerDesired = {
name: nameBase + 'explorer',
browserName: 'iexplore',
version: '9',
platform: 'Windows 2008'
};
exports.wd = {
chrome: runTestWith(remoteWdConfig, chromeDesired),
firefox: runTestWith(remoteWdConfig, firefoxDesired),
explorer: runTestWith(remoteWdConfig, explorerDesired)
};
}).call(this);

View File

@@ -0,0 +1,99 @@
# nodeunit test
wd = require '../../lib/main'
should = require 'should'
configHelper = require './config-helper'
remoteWdConfig= configHelper.getRemoteWdConfig()
exports.wd =
'browser init test':
default: (test) ->
browser = wd.remote remoteWdConfig
browser.defaultCapabilities.should.eql {
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'VISTA' }
browser.init (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'firefox'
browser.quit (err) ->
should.not.exist err
test.done()
'using browser.defaultCapabilities': (test) ->
browser = wd.remote remoteWdConfig
browser.defaultCapabilities.browserName = 'chrome'
browser.defaultCapabilities.platform = 'LINUX'
browser.defaultCapabilities.javascriptEnabled = false
browser.defaultCapabilities.name = 'browser init using defaultCapabilities'
browser.defaultCapabilities.tags = ['wd','test']
browser.defaultCapabilities.should.eql {
browserName: 'chrome',
version: '',
javascriptEnabled: false,
platform: 'LINUX',
name: 'browser init using defaultCapabilities'
tags: ['wd','test']
}
browser.init (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'chrome'
capabilities.platform.should.equal 'LINUX'
browser.quit (err) ->
should.not.exist err
test.done()
'desired only': (test) ->
browser = wd.remote remoteWdConfig
browser.defaultCapabilities.should.eql {
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'VISTA' }
desired =
browserName:'iexplore'
platform: 'Windows 2008'
name: 'browser init using desired'
tags: ['wd','test']
browser.init desired, (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.include 'explorer'
capabilities.platform.should.equal 'WINDOWS'
browser.quit (err) ->
should.not.exist err
test.done()
'desired overiding defaultCapabilities': (test) ->
browser = wd.remote remoteWdConfig
browser.defaultCapabilities.browserName = 'chrome'
browser.defaultCapabilities.name = 'browser init overide'
browser.defaultCapabilities.tags = ['wd','test']
browser.defaultCapabilities.should.eql {
browserName: 'chrome',
version: '',
javascriptEnabled: true,
platform: 'VISTA',
name: 'browser init overide'
tags: ['wd','test']
}
browser.init {browserName: 'firefox'}, (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'firefox'
browser.quit (err) ->
should.not.exist err
test.done()

View File

@@ -0,0 +1,124 @@
// Generated by CoffeeScript 1.3.2
(function() {
var configHelper, remoteWdConfig, should, wd;
wd = require('../../lib/main');
should = require('should');
configHelper = require('./config-helper');
remoteWdConfig = configHelper.getRemoteWdConfig();
exports.wd = {
'browser init test': {
"default": function(test) {
var browser;
browser = wd.remote(remoteWdConfig);
browser.defaultCapabilities.should.eql({
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'VISTA'
});
return browser.init(function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('firefox');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'using browser.defaultCapabilities': function(test) {
var browser;
browser = wd.remote(remoteWdConfig);
browser.defaultCapabilities.browserName = 'chrome';
browser.defaultCapabilities.platform = 'LINUX';
browser.defaultCapabilities.javascriptEnabled = false;
browser.defaultCapabilities.name = 'browser init using defaultCapabilities';
browser.defaultCapabilities.tags = ['wd', 'test'];
browser.defaultCapabilities.should.eql({
browserName: 'chrome',
version: '',
javascriptEnabled: false,
platform: 'LINUX',
name: 'browser init using defaultCapabilities',
tags: ['wd', 'test']
});
return browser.init(function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('chrome');
capabilities.platform.should.equal('LINUX');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'desired only': function(test) {
var browser, desired;
browser = wd.remote(remoteWdConfig);
browser.defaultCapabilities.should.eql({
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'VISTA'
});
desired = {
browserName: 'iexplore',
platform: 'Windows 2008',
name: 'browser init using desired',
tags: ['wd', 'test']
};
return browser.init(desired, function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.include('explorer');
capabilities.platform.should.equal('WINDOWS');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'desired overiding defaultCapabilities': function(test) {
var browser;
browser = wd.remote(remoteWdConfig);
browser.defaultCapabilities.browserName = 'chrome';
browser.defaultCapabilities.name = 'browser init overide';
browser.defaultCapabilities.tags = ['wd', 'test'];
browser.defaultCapabilities.should.eql({
browserName: 'chrome',
version: '',
javascriptEnabled: true,
platform: 'VISTA',
name: 'browser init overide',
tags: ['wd', 'test']
});
return browser.init({
browserName: 'firefox'
}, function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('firefox');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
}
}
};
}).call(this);

View File

@@ -0,0 +1,17 @@
should = require 'should'
try config = require './config' catch err
exports.getRemoteWdConfig = ->
should.exist config, \
"""
Missing config!
You need to copy config-sample.coffee to config.coffee,
and then configure your sauce username and access-key in
config.coffee
"""
{
host: "ondemand.saucelabs.com"
port: 80
username: config.saucelabs?.username
accessKey: config.saucelabs?.accessKey
}

View File

@@ -0,0 +1,24 @@
// Generated by CoffeeScript 1.3.2
(function() {
var config, should;
should = require('should');
try {
config = require('./config');
} catch (err) {
}
exports.getRemoteWdConfig = function() {
var _ref, _ref1;
should.exist(config, "Missing config!\nYou need to copy config-sample.coffee to config.coffee,\nand then configure your sauce username and access-key in\nconfig.coffee");
return {
host: "ondemand.saucelabs.com",
port: 80,
username: (_ref = config.saucelabs) != null ? _ref.username : void 0,
accessKey: (_ref1 = config.saucelabs) != null ? _ref1.accessKey : void 0
};
};
}).call(this);

View File

@@ -0,0 +1,5 @@
module.exports =
saucelabs:
username: '<USERNAME>'
accessKey: '<KEY>'

View File

@@ -0,0 +1,11 @@
// Generated by CoffeeScript 1.3.2
(function() {
module.exports = {
saucelabs: {
username: '<USERNAME>',
accessKey: '<KEY>'
}
};
}).call(this);

View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>TEST PAGE</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="elementByClassName">Hello World!</div>
<div id="elementByCssSelector">Hello World!</div>
<div id="elementById">Hello World!</div>
<div name="elementByName">Hello World!</div>
<div id="elementByLinkText"><a>click elementByLinkText</a></div>
<div id="elementByPartialLinkText"><a>click elementByPartialLinkText</a></div>
<div id="elementByTagName"><span>Hello World!</span></div>
<div id="elementByXPath"/><input></div>
<div id="elementByCss">Hello World!</div>
<div>
<div class="elementsByClassName">Hello World!</div>
<div class="elementsByClassName">Hello World!</div>
<div class="elementsByClassName">Hello World!</div>
</div>
<div>
<div id="elementsByCssSelector">Hello World!</div>
<div id="elementsByCssSelector">Hello World!</div>
<div id="elementsByCssSelector">Hello World!</div>
</div>
<div>
<div id="elementsById">Hello World!</div>
<div id="elementsById">Hello World!</div>
<div id="elementsById">Hello World!</div>
</div>
<div>
<div name="elementsByName">Hello World!</div>
<div name="elementsByName">Hello World!</div>
<div name="elementsByName">Hello World!</div>
</div>
<div>
<div id="elementsByLinkText"><a>click elementsByLinkText</a></div>
<div id="elementsByLinkText"><a>click elementsByLinkText</a></div>
<div id="elementsByLinkText"><a>click elementsByLinkText</a></div>
</div>
<div>
<div id="elementsByPartialLinkText"><a>click elementsByPartialLinkText</a></div>
<div id="elementsByPartialLinkText"><a>click elementsByPartialLinkText</a></div>
<div id="elementsByPartialLinkText"><a>click elementsByPartialLinkText</a></div>
</div>
<div id="elementsByTagName">
<span>Hello World!</span>
<span>Hello World!</span>
<span>Hello World!</span>
</div>
<div id="elementsByXPath"/>
<input>
<input>
<input>
</div>
<div>
<div id="elementsByCss">Hello World!</div>
<div id="elementsByCss">Hello World!</div>
<div id="elementsByCss">Hello World!</div>
</div>
<div id="getAttribute" weather="sunny">Hi</div>
<div id="getValue">
<input class="input-text" type="text" value="Hello getValueTest!">
<textarea>Hello getValueTest2!</textarea>
</div>
<div id="text"><div>text content</div></div>
<div id="type"><input class="input-text" type="text"></div>
<div id="keys"><input class="input-text" type="text"></div>
<div id="eval"><ul><li>line 1</li><li>line 2</li></ul></div>
<div id="setWaitTimeout"></div>
<div id="clickElement"><a href="#">not clicked</a></div>
<div id="moveTo">
<a class="a1" href="#">a1</a><br>
<a class="a2" href="#">a2</a><br>
<div class='current'></div>
</div>
<div id="click"><a href="#">not clicked</a></div>
<div id="doubleclick"><a href="#">not clicked</a></div>
<div id="clear"><input class="input-text" type="text" value="not cleared"></div>
<div id="textPresent">weather is sunny</div>
<div id="acceptAlert"><a>click me</a></div>
<div id="dismissAlert"><a>click me</a></div>
<div id="active">
<input class="i1" type="text" value="input 1">
<input class="i2" type="text" value="input 2">
</div>
<div id="mouseButton"><a>hold me</a><div></div></div>
<div id="waitForCondition"></div>
<div id="waitForConditionInBrowser"></div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
# nodeunit test
{runTestWith} = require '../common/basic-test-base'
exports.wd =
'basic test':
chrome: (runTestWith {}, {browserName:'chrome'})
firefox: (runTestWith {}, {browserName:'firefox'})

View File

@@ -0,0 +1,18 @@
// Generated by CoffeeScript 1.3.2
(function() {
var runTestWith;
runTestWith = require('../common/basic-test-base').runTestWith;
exports.wd = {
'basic test': {
chrome: runTestWith({}, {
browserName: 'chrome'
}),
firefox: runTestWith({}, {
browserName: 'firefox'
})
}
};
}).call(this);

View File

@@ -0,0 +1,78 @@
# nodeunit test
wd = require '../../lib/main'
should = require 'should'
exports.wd =
'browser init test':
default: (test) ->
browser = wd.remote()
browser.defaultCapabilities.should.eql {
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'ANY' }
browser.init (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'firefox'
browser.quit (err) ->
should.not.exist err
test.done()
'using browser.defaultCapabilities': (test) ->
browser = wd.remote()
browser.defaultCapabilities.browserName = 'chrome'
browser.defaultCapabilities.javascriptEnabled = false
browser.defaultCapabilities.should.eql {
browserName: 'chrome',
version: '',
javascriptEnabled: false,
platform: 'ANY',
}
browser.init (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'chrome'
browser.quit (err) ->
should.not.exist err
test.done()
'desired only': (test) ->
browser = wd.remote()
browser.defaultCapabilities.should.eql {
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'ANY' }
browser.init {browserName: 'chrome'}, (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'chrome'
browser.quit (err) ->
should.not.exist err
test.done()
'desired overiding defaultCapabilities': (test) ->
browser = wd.remote()
browser.defaultCapabilities.browserName = 'chrome'
browser.defaultCapabilities.should.eql {
browserName: 'chrome',
version: '',
javascriptEnabled: true,
platform: 'ANY' }
browser.init {browserName: 'firefox'}, (err) ->
should.not.exist err
browser.sessionCapabilities (err, capabilities) ->
should.not.exist err
capabilities.browserName.should.equal 'firefox'
browser.quit (err) ->
should.not.exist err
test.done()

View File

@@ -0,0 +1,105 @@
// Generated by CoffeeScript 1.3.2
(function() {
var should, wd;
wd = require('../../lib/main');
should = require('should');
exports.wd = {
'browser init test': {
"default": function(test) {
var browser;
browser = wd.remote();
browser.defaultCapabilities.should.eql({
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'ANY'
});
return browser.init(function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('firefox');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'using browser.defaultCapabilities': function(test) {
var browser;
browser = wd.remote();
browser.defaultCapabilities.browserName = 'chrome';
browser.defaultCapabilities.javascriptEnabled = false;
browser.defaultCapabilities.should.eql({
browserName: 'chrome',
version: '',
javascriptEnabled: false,
platform: 'ANY'
});
return browser.init(function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('chrome');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'desired only': function(test) {
var browser;
browser = wd.remote();
browser.defaultCapabilities.should.eql({
browserName: 'firefox',
version: '',
javascriptEnabled: true,
platform: 'ANY'
});
return browser.init({
browserName: 'chrome'
}, function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('chrome');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
},
'desired overiding defaultCapabilities': function(test) {
var browser;
browser = wd.remote();
browser.defaultCapabilities.browserName = 'chrome';
browser.defaultCapabilities.should.eql({
browserName: 'chrome',
version: '',
javascriptEnabled: true,
platform: 'ANY'
});
return browser.init({
browserName: 'firefox'
}, function(err) {
should.not.exist(err);
return browser.sessionCapabilities(function(err, capabilities) {
should.not.exist(err);
capabilities.browserName.should.equal('firefox');
return browser.quit(function(err) {
should.not.exist(err);
return test.done();
});
});
});
}
}
};
}).call(this);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,110 @@
# nodeunit test
wd = require '../../lib/main'
should = require 'should'
exports.wd =
'remote init test':
default: (test) ->
browser = wd.remote()
browser.options.host.should.equal '127.0.0.1'
browser.options.port.should.equal 4444
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
params:
'host, port': (test) ->
browser = wd.remote('localhost', 8888)
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
'host, port, username, accesskey': (test) ->
browser = wd.remote('localhost', 8888 , 'mickey', 'mouse' )
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
browser.username.should.equal 'mickey'
browser.accessKey.should.equal 'mouse'
test.done()
options:
empty: (test) ->
browser = wd.remote( {} )
browser.options.host.should.equal '127.0.0.1'
browser.options.port.should.equal 4444
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
'host, port': (test) ->
browser = wd.remote({host:'localhost', port:8888})
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
'host, port, username, accesskey': (test) ->
browser = wd.remote({
host:'localhost'
port:8888
username:'mickey'
accessKey:'mouse'
})
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/wd/hub/session'
browser.basePath.should.equal '/wd/hub'
browser.username.should.equal 'mickey'
browser.accessKey.should.equal 'mouse'
test.done()
'path': (test) ->
browser = wd.remote( {path:'/taiwan'} )
browser.options.host.should.equal '127.0.0.1'
browser.options.port.should.equal 4444
browser.options.path.should.equal '/taiwan/session'
browser.basePath.should.equal '/taiwan'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
'host, port, path': (test) ->
browser = wd.remote({host:'localhost', port:8888, path:'/'})
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/session'
browser.basePath.should.equal '/'
should.not.exist browser.username
should.not.exist browser.accessKey
test.done()
'host, port, username, accesskey, path': (test) ->
browser = wd.remote({
host:'localhost'
port:8888
username:'mickey'
accessKey:'mouse'
path:'/asia/taiwan'
})
browser.options.host.should.equal 'localhost'
browser.options.port.should.equal 8888
browser.options.path.should.equal '/asia/taiwan/session'
browser.basePath.should.equal '/asia/taiwan'
browser.username.should.equal 'mickey'
browser.accessKey.should.equal 'mouse'
test.done()

View File

@@ -0,0 +1,137 @@
// Generated by CoffeeScript 1.3.2
(function() {
var should, wd;
wd = require('../../lib/main');
should = require('should');
exports.wd = {
'remote init test': {
"default": function(test) {
var browser;
browser = wd.remote();
browser.options.host.should.equal('127.0.0.1');
browser.options.port.should.equal(4444);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
params: {
'host, port': function(test) {
var browser;
browser = wd.remote('localhost', 8888);
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
'host, port, username, accesskey': function(test) {
var browser;
browser = wd.remote('localhost', 8888, 'mickey', 'mouse');
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
browser.username.should.equal('mickey');
browser.accessKey.should.equal('mouse');
return test.done();
}
},
options: {
empty: function(test) {
var browser;
browser = wd.remote({});
browser.options.host.should.equal('127.0.0.1');
browser.options.port.should.equal(4444);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
'host, port': function(test) {
var browser;
browser = wd.remote({
host: 'localhost',
port: 8888
});
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
'host, port, username, accesskey': function(test) {
var browser;
browser = wd.remote({
host: 'localhost',
port: 8888,
username: 'mickey',
accessKey: 'mouse'
});
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/wd/hub/session');
browser.basePath.should.equal('/wd/hub');
browser.username.should.equal('mickey');
browser.accessKey.should.equal('mouse');
return test.done();
},
'path': function(test) {
var browser;
browser = wd.remote({
path: '/taiwan'
});
browser.options.host.should.equal('127.0.0.1');
browser.options.port.should.equal(4444);
browser.options.path.should.equal('/taiwan/session');
browser.basePath.should.equal('/taiwan');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
'host, port, path': function(test) {
var browser;
browser = wd.remote({
host: 'localhost',
port: 8888,
path: '/'
});
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/session');
browser.basePath.should.equal('/');
should.not.exist(browser.username);
should.not.exist(browser.accessKey);
return test.done();
},
'host, port, username, accesskey, path': function(test) {
var browser;
browser = wd.remote({
host: 'localhost',
port: 8888,
username: 'mickey',
accessKey: 'mouse',
path: '/asia/taiwan'
});
browser.options.host.should.equal('localhost');
browser.options.port.should.equal(8888);
browser.options.path.should.equal('/asia/taiwan/session');
browser.basePath.should.equal('/asia/taiwan');
browser.username.should.equal('mickey');
browser.accessKey.should.equal('mouse');
return test.done();
}
}
}
};
}).call(this);