Commit f7256421 authored by chriseth's avatar chriseth Committed by GitHub

Merge pull request #94 from redsquirrel/browser-testing

Initial browser testing
parents 5ce87fd3 795c429d
.vscode .vscode
build build
node_modules node_modules
reports
language: node_js language: node_js
node_js: node_js:
- stable - stable
script: npm run lint && npm run test && npm run build before_script:
- npm run serve &
script:
- npm run lint && npm run test && npm run build && nightwatch --env chrome
- pkill node
addons: addons:
sauce_connect: sauce_connect:
username: "chriseth" username: "chriseth"
...@@ -11,7 +15,7 @@ deploy: ...@@ -11,7 +15,7 @@ deploy:
script: ci/deploy_from_travis.sh script: ci/deploy_from_travis.sh
skip_cleanup: true skip_cleanup: true
on: on:
branch: master branch: master
env: env:
global: global:
- ENCRYPTION_LABEL="b5c2730599da" - ENCRYPTION_LABEL="b5c2730599da"
...@@ -19,5 +23,3 @@ env: ...@@ -19,5 +23,3 @@ env:
- COMMIT_AUTHOR="Travis CI" - COMMIT_AUTHOR="Travis CI"
- PUSH_REPO="git@github.com:ethereum/browser-solidity.git" - PUSH_REPO="git@github.com:ethereum/browser-solidity.git"
- FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md" - FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md"
...@@ -37,7 +37,26 @@ Run: ...@@ -37,7 +37,26 @@ Run:
- In Debian based OSes such as Ubuntu 14.04LTS you may need to run `apt-get install build-essential`. After installing `build-essential` run `npm rebuild`. - In Debian based OSes such as Ubuntu 14.04LTS you may need to run `apt-get install build-essential`. After installing `build-essential` run `npm rebuild`.
## Unit Testing
Register new unit test files in `test/index.js`. The tests are written using [tape](https://www.npmjs.com/package/tape). Run the tests via:
npm test
## Browser Testing
To run the Selenium tests via nightwatch serve the app through a local web server:
npm run serve # starts web server at localhost:8080
Then you will need to either:
1. Have a Selenium server running locally on port 4444 along with the chromedriver installed.
* Run: `./node_modules/nightwatch/bin/nightwatch --env local`
1. Or, install SauceConnect and run it locally `sc -u <USERNAME> -k <ACCESS_KEY>` (see .travis.yml for values)
* Run: `./node_modules/nightwatch/bin/nightwatch --env chrome`
## Usage as a Chrome Extension ## Usage as a Chrome Extension
If you would like to use this as a Chrome extension, you must either build it first or pull from the `gh-pages` branch, both described above. If you would like to use this as a Chrome extension, you must either build it first or pull from the `gh-pages` branch, both described above.
......
{
"src_folders" : ["test-browser"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"test_settings" : {
"default" : {
"launch_url": "http://ondemand.saucelabs.com:80",
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"silent": true,
"username": "chriseth",
"access_key": "b781828a-9e9c-43d8-89d4-2fbb879595ca",
"screenshots" : {
"enabled" : false
},
"globals": {
"waitForConditionTimeout": 60000
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"local" : {
"launch_url": "http://localhost:8080",
"selenium_port": 4444,
"selenium_host": "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"scripts": { "scripts": {
"test": "node test/index.js", "test": "node test/index.js",
"build": "mkdir -p build; browserify src/index.js -o build/app.js", "build": "mkdir -p build; browserify src/index.js -o build/app.js",
"lint": "semistandard" "lint": "semistandard",
"serve": "http-server ."
}, },
"devDependencies": { "devDependencies": {
"brace": "^0.8.0", "brace": "^0.8.0",
...@@ -16,8 +17,10 @@ ...@@ -16,8 +17,10 @@
"ethereumjs-tx": "^1.1.1", "ethereumjs-tx": "^1.1.1",
"ethereumjs-util": "^4.4.0", "ethereumjs-util": "^4.4.0",
"ethereumjs-vm": "^1.4.0", "ethereumjs-vm": "^1.4.0",
"http-server": "0.9.0",
"jquery": "^2.2.0", "jquery": "^2.2.0",
"js-base64": "^2.1.9", "js-base64": "^2.1.9",
"nightwatch": "^0.9.3",
"semistandard": "^7.0.0", "semistandard": "^7.0.0",
"tape": "^4.5.1", "tape": "^4.5.1",
"web3": "^0.15.3", "web3": "^0.15.3",
......
module.exports = {
'New file test': function (browser) {
browser
.url('http://127.0.0.1:8080')
.waitForElementVisible('.newFile', 5000)
.click('.newFile')
.assert.containsText('.active', 'Untitled')
.end();
}
};
module.exports = {
'Smoke test': function (browser) {
browser
.url('http://127.0.0.1:8080')
.waitForElementVisible('#righthand-panel', 5000)
.assert.containsText('#righthand-panel', 'Solidity version')
.end();
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment