You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/12/01 17:14:20 UTC
fauxton commit: updated refs/heads/master to 73d272e
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master d4be41541 -> 73d272e6e
Update Nightwatch README file
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/73d272e6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/73d272e6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/73d272e6
Branch: refs/heads/master
Commit: 73d272e6e07196a8bacc4ba8310f61973038df9e
Parents: d4be415
Author: Benjamin Keen <be...@gmail.com>
Authored: Fri Nov 28 14:14:53 2014 -0800
Committer: Benjamin Keen <be...@gmail.com>
Committed: Mon Dec 1 08:14:11 2014 -0800
----------------------------------------------------------------------
test/nightwatch_tests/nightwatch_README.md | 54 +++++++++++++++++--------
1 file changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/73d272e6/test/nightwatch_tests/nightwatch_README.md
----------------------------------------------------------------------
diff --git a/test/nightwatch_tests/nightwatch_README.md b/test/nightwatch_tests/nightwatch_README.md
index b4aed76..a18d6a7 100644
--- a/test/nightwatch_tests/nightwatch_README.md
+++ b/test/nightwatch_tests/nightwatch_README.md
@@ -7,12 +7,24 @@ Hello.
There are several nightwatch tests already written for Fauxton.
-Before running the browser tests, you will need to add a user to your CouchDB admin accounts:
+Before running the browser tests, you need to first set it up. Editing your `settings.json` file (or
+`settings.json.default` or whatever you're using) and find the following section near the bottom:
-> user: tester
-password: testerpass
+```javascript
+ "nightwatch": {
+ "username": "",
+ "password": "",
+ "launch_url": "",
+ "custom_commands_path": "test/nightwatch_tests/custom-commands",
+ "globals_path": "test/nightwatch_tests/helpers/helpers.js"
+ }
+```
-Then, to run the the test:
+There, add the `username`, `password` and `launch_url` values. The username and password needs to be an admin
+account already setup on your CouchDB installation. The `launch_url` should be the base URL of your local installation,
+minus the "http://" prefix, e.g. `localhost:8000` or `thomas.dev:8000`.
+
+To run the test:
$ npm install
$ grunt nightwatch
@@ -24,21 +36,27 @@ You can run individual single tests by running
if you want to run the testfile `createsDatabase.js`.
-##Writing Tests
+## Writing Tests
You can contribute by writing tests for Fauxton as well.
-Please take a look at the existing examples in the `app/addons/documents/tests` or `app/addons/databases/tests` folders.
+Please take a look at the existing examples in the `app/addons/documents/tests` or `app/addons/databases/tests` folders.
Below are a few caveats to writing tests.
-1. When you write a new test, if the component you are testing doesn't have any nightwatch tests already, you will need to create a folder for it, and add it's file path to the list of test folders in `tests/nightwatch_test/nightwatch.json`.
+1. When you write a new test, if the component you are testing doesn't have any nightwatch tests already, you will
+need to create a folder for it, and add its file path to the list of test folders in `tests/nightwatch_test/nightwatch.json`.
1. Before each test is run, a database called'fauxton-selenium-test' is created, then deleted after each test.
-2. Use `.verify()` instead of `.assert()` in your tests. This will allow the tests to continue, even if the browser has failed, and will not exit or skip subsequent tests.
-3. `.waitForElementNotPresent()`, `.waitForElementNotVisible()`, `.waitForElementPresent()`, `.waitForElementVisible()`, will exit testing by default if the Element is not found. There is a third argument, 'abortOnFailure', if you set this to 'false', the rest of the tests will continue even if this assertion fails.
-4. Sometimes `.click()` doesn't work reliably (most likely if the element you are clicking on doesn't have an individual ID selector). You can use jquery to simulate a click by using `.execute($("#CSS Selector.HERE").click();)`
-5. The function `.pause(time)` is sometimes necessary, although we have tried to avoid excessive use of a hard coded pausing. Instead try and make use of the `.waitForElement` functions instead of `.pause(time)`.
-
-##Nightwatch Files in Fauxton
+2. Use `.verify()` instead of `.assert()` in your tests. This will allow the tests to continue, even if the browser
+has failed, and will not exit or skip subsequent tests.
+3. `.waitForElementNotPresent()`, `.waitForElementNotVisible()`, `.waitForElementPresent()`, `.waitForElementVisible()`,
+will exit testing by default if the Element is not found. There is a third argument, 'abortOnFailure', if you set this
+to 'false', the rest of the tests will continue even if this assertion fails.
+4. Sometimes `.click()` doesn't work reliably (most likely if the element you are clicking on doesn't have an
+individual ID selector). You can use jquery to simulate a click by using `.execute($("#CSS Selector.HERE").click();)`
+5. The function `.pause(time)` is sometimes necessary, although we have tried to avoid excessive use of a hard coded
+pausing. Instead try and make use of the `.waitForElement` functions instead of `.pause(time)`.
+
+## Nightwatch Files in Fauxton
There are several Nightwatch related files spread out in the couchdb-fauxton folder.
1. Individual browser tests are kept in
@@ -52,12 +70,14 @@ There are several Nightwatch related files spread out in the couchdb-fauxton fol
2. Custom Commands, Global helper functions, and the Configuration are kept in
couchdb-fauxton/tests/nightwatch_tests
-
- The configuration file is `nightwatch.json`.
+
+ The configuration file is `nightwatch.json`. Please note that this file is auto-generated by grunt every time you
+ run the nightwatch task. It examines the content of your `settings.json` file to figure out what tests to run.
Global helper functions are in `helpers/helpers.js`.
Custom commands are `custom-commands/functionName.js`.
- - The custom command name is the name of the file itself, and it needs to follow either the `loginToGUI.js` pattern, or the `createDatabase.js` pattern (for async commands).
-
+ - The custom command name is the name of the file itself, and it needs to follow either the `loginToGUI.js`
+ pattern, or the `createDatabase.js` pattern (for async commands).
+
Selenium related files are kept in the `selenium` folder
3. Node