Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing examples, docs + some copy&edit. Bumping to 0.2.5

  • Loading branch information...
commit 08e0e80ce325675984fd87c76ecd7a039035c01e 1 parent b7085e7
@santiycr santiycr authored
View
6 History.md
@@ -1,4 +1,10 @@
+2.2.5 / 2011-12-02
+==================
+
+ * Fixed chaining to let users send further commands during chain end
+ * Added support job URL generation
+
2.2.4 / 2011-05-27
==================
View
4 Makefile
@@ -6,7 +6,7 @@ test:
docs:
dox \
--title "Soda" \
- --desc "The _Selenium Node Adapter_ or __Soda__ provides a unified client to both [Selenium RC](http://seleniumhq.org/projects/remote-control/) and [Saucelabs OnDemand](http://saucelabs.com/ondemand)." \
+ --desc "The _Selenium Node Adapter_ or __Soda__ provides a unified client to both [Selenium RC](http://seleniumhq.org/projects/remote-control/) and [Sauce Labs OnDemand](http://saucelabs.com/ondemand)." \
--ribbon "http://github.com/learnboost/soda" \
--private \
lib/soda/*.js > api.html
@@ -14,4 +14,4 @@ docs:
docclean:
rm -f api.html
-.PHONY: test docs docclean
+.PHONY: test docs docclean
View
38 Readme.md
@@ -1,7 +1,7 @@
# Soda
- Selenium Node Adapter. A light-weight Selenium RC client for [NodeJS](http://nodejs.org), with additional [Saucelabs](http://saucelabs.com) integration for acceptance testing in the cloud.
+Selenium Node Adapter. A light-weight Selenium RC client for [NodeJS](http://nodejs.org), with additional [Sauce Labs](http://saucelabs.com) integration for acceptance testing in the cloud.
## Installation
@@ -46,10 +46,11 @@ Because nested callbacks can quickly become overwhelming, Soda has optional chai
.session()
.open('/')
.type('q', 'Hello World')
- .testComplete()
.end(function(err){
- if (err) throw err;
- console.log('done');
+ browser.testComplete(function() {
+ console.log('done');
+ if(err) throw err;
+ });
});
When chaining successful commands may receive a callback, which is useful for custom assertions:
@@ -61,9 +62,11 @@ When chaining successful commands may receive a callback, which is useful for cu
.getTitle(function(title){
assert.equal('Hello World', title);
})
- .testComplete()
.end(function(err){
- if (err) throw err;
+ browser.testComplete(function() {
+ console.log('done');
+ if(err) throw err;
+ });
})
With the `.and()` method you can add additional commands to the queue. The callback accepts the client instance, which is also the value of "this".
@@ -92,7 +95,10 @@ With this helper function we can now re-use this logic in several places, an exp
.and(login('someone', 'else'))
.assertTitle('Someone else')
.end(function(err){
- if (err) throw err;
+ browser.testComplete(function() {
+ console.log('done');
+ if(err) throw err;
+ });
});
## Sauce Labs Videos & Logs
@@ -101,6 +107,7 @@ When a job is complete, you can request the log or flv video from Sauce Labs. To
...
.end(function(err){
+ console.log(this.jobUrl)
console.log(this.videoUrl)
console.log(this.logUrl)
})
@@ -130,10 +137,11 @@ Sauce Labs also provides a script that you may embed in your CI server to displa
.getTitle(function(title){
assert.ok(~title.indexOf('Hello World'))
})
- .testComplete()
.end(function(err){
- if (err) throw err;
- console.log('done');
+ browser.testComplete(function() {
+ console.log('done');
+ if(err) throw err;
+ });
});
@@ -171,8 +179,12 @@ Sauce Labs also provides a script that you may embed in your CI server to displa
.clickAndWait('link=Log out')
.testComplete()
.end(function(err){
- if (err) throw err;
- console.log('done');
+ browser.setContext('sauce:job-info={"passed": ' + (err === null) + '}', function(){
+ browser.testComplete(function(){
+ console.log(browser.jobUrl);
+ if (err) throw err;
+ });
+ });
});
## Creating Helpers
@@ -195,7 +207,7 @@ Keep in mind you can extend the prototype as needed for your test. An example of
## More Information
- - Sauce Labs [Supported Browsers](http://saucelabs.com/products/docs/sauce-ondemand/browsers)
+ - Sauce Labs [Supported Browsers](http://saucelabs.com/docs/ondemand/browsers/env/js/se1/mac)
- Introduction to [Selenese](http://seleniumhq.org/docs/02_selenium_basics.html)
- Selenium [Command Reference](http://release.seleniumhq.org/selenium-core/1.0.1/reference.html).
View
14 examples/google.js
@@ -22,16 +22,18 @@ browser
.session()
.open('/')
.type('q', 'Hello World')
- .clickAndWait('btnG')
+ .click('btnG')
+ .waitForTextPresent('Hello World')
.getTitle(function(title){
- assert.ok(~title.indexOf('Hello World'), 'Title did not include the query');
+ assert.ok(~title.indexOf('hello world'), 'Title did not include the query: ' + title);
})
- .clickAndWait('link=Advanced search')
+ .click('link=Advanced search')
.waitForPageToLoad(2000)
.assertText('css=#gen-query', 'Hello World')
.assertAttribute('as_q@value', 'Hello World')
- .testComplete()
.end(function(err){
- if (err) throw err;
- console.log('done');
+ browser.testComplete(function(){
+ console.log('done');
+ if (err) throw err;
+ });
});
View
12 examples/google.nested.js
@@ -15,11 +15,13 @@ var browser = soda.createClient({
browser.session(function(err){
browser.open('/', function(err, body){
browser.type('q', 'Hello World', function(err, body){
- browser.clickAndWait('btnG', function(err, body){
- browser.assertTitle('Hello World - Google Search', function(err, body){
- if (err) throw err;
- browser.testComplete(function(err, body){
- console.log('done');
+ browser.click('btnG', function(err, body){
+ browser.waitForTextPresent('Hello World', function(err, body){
+ browser.assertTitle('hello world - Google Search', function(err, body){
+ if (err) throw err;
+ browser.testComplete(function(err, body){
+ console.log('done');
+ });
});
});
});
View
7 examples/learnboost.js
@@ -25,8 +25,9 @@ browser
.clickAndWait('//input[@value="Save"]')
.assertTextPresent('Account info updated')
.clickAndWait('link=Log out')
- .testComplete()
.end(function(err){
- if (err) throw err;
- console.log('done');
+ browser.testComplete(function(){
+ console.log('done');
+ if (err) throw err;
+ });
});
View
6 lib/soda/sauce.js
@@ -16,7 +16,7 @@ var Client = require('./client');
*
* Options:
*
- * - `username` Saucelabs username
+ * - `username` Sauce Labs username
* - `access-key` Account access key
* - `os` Operating system ex "Linux"
* - `browser` Browser name, ex "firefox"
@@ -25,8 +25,8 @@ var Client = require('./client');
*
* Environment Variables:
*
- * - `SAUCE_HOST` Defaulting to "saucelabs.com"
- * - `SAUCE_PORT` Defaulting to 4444
+ * - `SAUCE_HOST` Defaulting to "ondemand.saucelabs.com"
+ * - `SAUCE_PORT` Defaulting to 80
* - `SAUCE_OS`
* - `SAUCE_BROWSER`
* - `SAUCE_USERNAME`
View
4 package.json
@@ -1,8 +1,8 @@
{
"name": "soda",
- "description": "Selenium RC Node Adapter (with Saucelabs support)",
+ "description": "Selenium RC Node Adapter (with Sauce Labs support)",
"keywords": ["selenium", "saucelabs", "testing", "test", "tests"],
- "version": "0.2.4",
+ "version": "0.2.5",
"author": "TJ Holowaychuk <tj@learnboost.com>",
"main": "./lib/soda/index.js",
"engines": { "node": ">= 0.2.0" },
Please sign in to comment.
Something went wrong with that request. Please try again.