Example project for testium(minimum setup).
npm install
npm test
Default: use phantomjs for E2E testing.
1: Install devDependencies
This project use testium, Mocha and power-assert.
2: Create .testiumrc
; defaults to false, `npm start`s the app
launch = true
3: Setup HTTP server for testing.
nodeapps/http-server provide HTTP server.
"scripts": {
"start": "http-server",
"test": "mocha test/*.js"
},
If you not going to use XHR
etc..., is not required for you.
4: Write E2E test case
Please see test/app-test.js
snippet
"use strict";
var injectBrowser = require('testium/mocha');
var assert = require('power-assert');
describe("index.html", function () {
before(injectBrowser());// <= integrate testium
beforeEach(function () {
this.browser.navigateTo('/');// move to `"/"` which is served by http-server
});
it("then output filled with text of this option", function () {
var firstInput = this.browser.getElement('input[name="framework_name"]');
// click
firstInput.click();
// assert
var testFrameWorkName = firstInput.get("value");
var output = this.browser.getElement("#js-output");
var result = output.get("text");
assert(result.indexOf(testFrameWorkName) >= 0);
});
});
5: Run test
npm test
# alias to
mocha --require intelli-espower-loader test/
1: You put browser = "chrome"
to .testiumrc
; defaults to false, `npm start`s the app
launch = true
browser = "chrome"
2: Download chromium-driver
$ ./node_modules/.bin/testium --download-selenium
3: Run test
npm test
Easy to Run!
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT