Skip to content

Commit

Permalink
Fixing examples, docs + some copy&edit. Bumping to 0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
santiycr committed Dec 2, 2011
1 parent b7085e7 commit 08e0e80
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 34 deletions.
6 changes: 6 additions & 0 deletions 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 2.2.4 / 2011-05-27
================== ==================


Expand Down
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -6,12 +6,12 @@ test:
docs: docs:
dox \ dox \
--title "Soda" \ --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" \ --ribbon "http://github.com/learnboost/soda" \
--private \ --private \
lib/soda/*.js > api.html lib/soda/*.js > api.html


docclean: docclean:
rm -f api.html rm -f api.html


.PHONY: test docs docclean .PHONY: test docs docclean
38 changes: 25 additions & 13 deletions Readme.md
@@ -1,7 +1,7 @@


# Soda # 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 ## Installation


Expand Down Expand Up @@ -46,10 +46,11 @@ Because nested callbacks can quickly become overwhelming, Soda has optional chai
.session() .session()
.open('/') .open('/')
.type('q', 'Hello World') .type('q', 'Hello World')
.testComplete()
.end(function(err){ .end(function(err){
if (err) throw err; browser.testComplete(function() {
console.log('done'); console.log('done');
if(err) throw err;
});
}); });


When chaining successful commands may receive a callback, which is useful for custom assertions: When chaining successful commands may receive a callback, which is useful for custom assertions:
Expand All @@ -61,9 +62,11 @@ When chaining successful commands may receive a callback, which is useful for cu
.getTitle(function(title){ .getTitle(function(title){
assert.equal('Hello World', title); assert.equal('Hello World', title);
}) })
.testComplete()
.end(function(err){ .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". 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".
Expand Down Expand Up @@ -92,7 +95,10 @@ With this helper function we can now re-use this logic in several places, an exp
.and(login('someone', 'else')) .and(login('someone', 'else'))
.assertTitle('Someone else') .assertTitle('Someone else')
.end(function(err){ .end(function(err){
if (err) throw err; browser.testComplete(function() {
console.log('done');
if(err) throw err;
});
}); });


## Sauce Labs Videos & Logs ## Sauce Labs Videos & Logs
Expand All @@ -101,6 +107,7 @@ When a job is complete, you can request the log or flv video from Sauce Labs. To


... ...
.end(function(err){ .end(function(err){
console.log(this.jobUrl)
console.log(this.videoUrl) console.log(this.videoUrl)
console.log(this.logUrl) console.log(this.logUrl)
}) })
Expand Down Expand Up @@ -130,10 +137,11 @@ Sauce Labs also provides a script that you may embed in your CI server to displa
.getTitle(function(title){ .getTitle(function(title){
assert.ok(~title.indexOf('Hello World')) assert.ok(~title.indexOf('Hello World'))
}) })
.testComplete()
.end(function(err){ .end(function(err){
if (err) throw err; browser.testComplete(function() {
console.log('done'); console.log('done');
if(err) throw err;
});
}); });




Expand Down Expand Up @@ -171,8 +179,12 @@ Sauce Labs also provides a script that you may embed in your CI server to displa
.clickAndWait('link=Log out') .clickAndWait('link=Log out')
.testComplete() .testComplete()
.end(function(err){ .end(function(err){
if (err) throw err; browser.setContext('sauce:job-info={"passed": ' + (err === null) + '}', function(){
console.log('done'); browser.testComplete(function(){
console.log(browser.jobUrl);
if (err) throw err;
});
});
}); });


## Creating Helpers ## Creating Helpers
Expand All @@ -195,7 +207,7 @@ Keep in mind you can extend the prototype as needed for your test. An example of


## More Information ## 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) - 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). - Selenium [Command Reference](http://release.seleniumhq.org/selenium-core/1.0.1/reference.html).


Expand Down
14 changes: 8 additions & 6 deletions examples/google.js
Expand Up @@ -22,16 +22,18 @@ browser
.session() .session()
.open('/') .open('/')
.type('q', 'Hello World') .type('q', 'Hello World')
.clickAndWait('btnG') .click('btnG')
.waitForTextPresent('Hello World')
.getTitle(function(title){ .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) .waitForPageToLoad(2000)
.assertText('css=#gen-query', 'Hello World') .assertText('css=#gen-query', 'Hello World')
.assertAttribute('as_q@value', 'Hello World') .assertAttribute('as_q@value', 'Hello World')
.testComplete()
.end(function(err){ .end(function(err){
if (err) throw err; browser.testComplete(function(){
console.log('done'); console.log('done');
if (err) throw err;
});
}); });
12 changes: 7 additions & 5 deletions examples/google.nested.js
Expand Up @@ -15,11 +15,13 @@ var browser = soda.createClient({
browser.session(function(err){ browser.session(function(err){
browser.open('/', function(err, body){ browser.open('/', function(err, body){
browser.type('q', 'Hello World', function(err, body){ browser.type('q', 'Hello World', function(err, body){
browser.clickAndWait('btnG', function(err, body){ browser.click('btnG', function(err, body){
browser.assertTitle('Hello World - Google Search', function(err, body){ browser.waitForTextPresent('Hello World', function(err, body){
if (err) throw err; browser.assertTitle('hello world - Google Search', function(err, body){
browser.testComplete(function(err, body){ if (err) throw err;
console.log('done'); browser.testComplete(function(err, body){
console.log('done');
});
}); });
}); });
}); });
Expand Down
7 changes: 4 additions & 3 deletions examples/learnboost.js
Expand Up @@ -25,8 +25,9 @@ browser
.clickAndWait('//input[@value="Save"]') .clickAndWait('//input[@value="Save"]')
.assertTextPresent('Account info updated') .assertTextPresent('Account info updated')
.clickAndWait('link=Log out') .clickAndWait('link=Log out')
.testComplete()
.end(function(err){ .end(function(err){
if (err) throw err; browser.testComplete(function(){
console.log('done'); console.log('done');
if (err) throw err;
});
}); });
6 changes: 3 additions & 3 deletions lib/soda/sauce.js
Expand Up @@ -16,7 +16,7 @@ var Client = require('./client');
* *
* Options: * Options:
* *
* - `username` Saucelabs username * - `username` Sauce Labs username
* - `access-key` Account access key * - `access-key` Account access key
* - `os` Operating system ex "Linux" * - `os` Operating system ex "Linux"
* - `browser` Browser name, ex "firefox" * - `browser` Browser name, ex "firefox"
Expand All @@ -25,8 +25,8 @@ var Client = require('./client');
* *
* Environment Variables: * Environment Variables:
* *
* - `SAUCE_HOST` Defaulting to "saucelabs.com" * - `SAUCE_HOST` Defaulting to "ondemand.saucelabs.com"
* - `SAUCE_PORT` Defaulting to 4444 * - `SAUCE_PORT` Defaulting to 80
* - `SAUCE_OS` * - `SAUCE_OS`
* - `SAUCE_BROWSER` * - `SAUCE_BROWSER`
* - `SAUCE_USERNAME` * - `SAUCE_USERNAME`
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{ {
"name": "soda", "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"], "keywords": ["selenium", "saucelabs", "testing", "test", "tests"],
"version": "0.2.4", "version": "0.2.5",
"author": "TJ Holowaychuk <tj@learnboost.com>", "author": "TJ Holowaychuk <tj@learnboost.com>",
"main": "./lib/soda/index.js", "main": "./lib/soda/index.js",
"engines": { "node": ">= 0.2.0" }, "engines": { "node": ">= 0.2.0" },
Expand Down

0 comments on commit 08e0e80

Please sign in to comment.