mirror of
https://github.com/sstent/node.git
synced 2026-01-27 07:33:13 +00:00
first post
This commit is contained in:
48
Nodejs-Socketio-Mysql-Demo/node_modules/wd/test/common/basic-test-base.coffee
generated
vendored
Normal file
48
Nodejs-Socketio-Mysql-Demo/node_modules/wd/test/common/basic-test-base.coffee
generated
vendored
Normal 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
|
||||
|
||||
|
||||
64
Nodejs-Socketio-Mysql-Demo/node_modules/wd/test/common/basic-test-base.js
generated
vendored
Normal file
64
Nodejs-Socketio-Mysql-Demo/node_modules/wd/test/common/basic-test-base.js
generated
vendored
Normal 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);
|
||||
Reference in New Issue
Block a user