-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from paypal/develop
merge develop (0.3.x) to master
- Loading branch information
Showing
6 changed files
with
146 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ For a holistic guide to using Nemo as an overall automation solution, [please st | |
add the following to package.json devDependencies (assuming mocha is already integrated to your project): | ||
|
||
```javascript | ||
"nemo": "^0.2.1", | ||
"nemo": "^0.3.1", | ||
``` | ||
|
||
Then `npm install` | ||
|
@@ -38,7 +38,7 @@ var Nemo = require("../"); | |
process.env.nemoData = JSON.stringify({ | ||
targetBrowser: "firefox", | ||
targetServer: "localhost", | ||
serverProps: {"port": 4444}, | ||
localServer: true, | ||
seleniumJar: "/usr/bin/selenium-server-standalone.jar", | ||
targetBaseUrl: "https://www.paypal.com" | ||
}); | ||
|
@@ -48,9 +48,7 @@ var config = { | |
nemoData: { | ||
targetBrowser: "firefox", | ||
targetServer: "localhost", | ||
serverProps: { | ||
"port": 4444 | ||
}, | ||
localServer: true, | ||
seleniumJar: "/usr/bin/selenium-server-standalone.jar", | ||
targetBaseUrl: "https://www.paypal.com" | ||
} | ||
|
@@ -68,7 +66,7 @@ var config = { | |
``` | ||
|
||
You can see this file within the nemo examples directory: | ||
https://github.com/paypal/nemo/examples/setup.js | ||
[https://github.com/paypal/nemo/examples/setup.js](/examples/setup.js) | ||
|
||
Note you can set `nemoData` via an environment variable OR by passing it into the Nemo constructor. | ||
|
||
|
@@ -101,17 +99,20 @@ which need to require modules from your test suite. | |
|
||
Browser you wish to automate. Make sure that your chosen webdriver has this browser option available | ||
|
||
### targetServer (optional/conditional) | ||
### localServer (optional, defaults to false) | ||
|
||
Set localServer to true if you want Nemo to attempt to start a standalone binary on your system (like selenium-standalone-server) or use a local browser/driver like Chrome/chromedriver or PhantomJS. | ||
|
||
|
||
### targetServer (optional) | ||
|
||
Webdriver server you wish to use. Set as simply "localhost" if you are using a selenium-standalone driver on your local machine. | ||
Leave unset if you are using chrome or phantomjs on your local machine | ||
Webdriver server URL you wish to use. | ||
|
||
If you are using sauce labs, make sure `targetServer` is set to correct url like `"http://yourkey:[email protected]:80/wd/hub"` | ||
|
||
### serverProps (optional/conditional) | ||
|
||
Additional server properties required of the 'targetServer'. If you are using a selenium-standalone driver on your local machine, | ||
you have to minimally specify the port number. Leave unset if you aren't specifying a targetServer. | ||
Additional server properties required of the 'targetServer' | ||
|
||
You can also set args and jvmArgs to the selenium jar process as follows: | ||
|
||
|
@@ -186,6 +187,22 @@ More on plugin authoring can be found here: https://github.com/paypal/nemo-docs/ | |
|
||
File issues for new plugin creation here: https://github.com/paypal/nemo-plugin-registry/issues | ||
|
||
## Logging and debugging | ||
|
||
Nemo uses the [debug](https://github.com/visionmedia/debug.git) module for console logging and error output. There are two classes of logging, `nemo:log` and `nemo:error` | ||
|
||
If you want to see both classes of output, simply use the appropriate value of the DEBUG environment variable when you run nemo: | ||
|
||
```bash | ||
$ DEBUG=nemo:* <nemo command> | ||
``` | ||
|
||
To see just one: | ||
|
||
```bash | ||
$ DEBUG=nemo:error <nemo command> | ||
``` | ||
|
||
## API | ||
|
||
### Nemo constructor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* global module: true, require: true, console: true */ | ||
"use strict"; | ||
|
||
var should = require('chai').should(), | ||
Nemo = require('../index'); | ||
|
||
describe("@nemoData@ suite", function () { | ||
var nemo; | ||
describe("@environmentVariable@", function () { | ||
before(function (done) { | ||
process.env.nemoData = JSON.stringify({ | ||
targetBrowser: "firefox", | ||
localServer: true, | ||
seleniumJar: "/usr/local/bin/selenium-server-standalone.jar", | ||
targetBaseUrl: "https://www.paypal.com", | ||
passThroughFromEnv: true | ||
}); | ||
done(); | ||
}); | ||
after(function (done) { | ||
nemo.driver.quit().then(function () { | ||
setTimeout(function() {done();}, 100); | ||
}); | ||
}); | ||
it("should launch a local server and have the passThroughFromEnv variable", function (done) { | ||
(new Nemo()).setup({}).then(function (_nemo) { | ||
nemo = _nemo; | ||
nemo.driver.get(nemo.props.targetBaseUrl).then(function () { | ||
if (nemo.props.passThroughFromEnv === true) { | ||
done(); | ||
} else { | ||
done(new Error("some problem with passthrough variable")); | ||
} | ||
}, function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe("@jsonVariable@", function () { | ||
after(function (done) { | ||
nemo.driver.quit().then(function () { | ||
setTimeout(function() {done();}, 100); | ||
}); | ||
}); | ||
var nemoData = { | ||
targetBrowser: "firefox", | ||
localServer: true, | ||
seleniumJar: "/usr/local/bin/selenium-server-standalone.jar", | ||
targetBaseUrl: "https://www.paypal.com", | ||
passThroughFromJson: true | ||
}; | ||
var nemo; | ||
it("should launch a local server and have the passThroughFromEnv variable", function (done) { | ||
(new Nemo({nemoData: nemoData})).setup({}).then(function (_nemo) { | ||
nemo = _nemo; | ||
nemo.driver.get(nemo.props.targetBaseUrl).then(function () { | ||
if (nemo.props.passThroughFromJson === true && nemo.props.passThroughFromEnv === undefined) { | ||
done(); | ||
} else { | ||
done(new Error("some problem with passthrough variable")); | ||
} | ||
}, function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe("@launchFirefox@", function () { | ||
before(function (done) { | ||
process.env.nemoData = JSON.stringify({ | ||
targetBrowser: "firefox", | ||
targetBaseUrl: "https://www.paypal.com" | ||
}); | ||
done(); | ||
}); | ||
after(function (done) { | ||
nemo.driver.quit().then(function () { | ||
setTimeout(function() {done();}, 10); | ||
}); | ||
}); | ||
it("should work without localServer, seleniumJar props", function (done) { | ||
(new Nemo()).setup({}).then(function (_nemo) { | ||
|
||
nemo = _nemo; | ||
console.log(nemo.props.targetBaseUrl); | ||
nemo.driver.get(nemo.props.targetBaseUrl).then(function () { | ||
done(); | ||
}, function (err) { | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters