Initial browser testing

pull/1/head
Dave Hoover 9 years ago
parent aa54d3d8b0
commit f81756a44c
  1. 1
      .gitignore
  2. 12
      .travis.yml
  3. 14
      README.md
  4. 42
      nightwatch.json
  5. 5
      package.json
  6. 10
      test-browser/new-file-test.js
  7. 9
      test-browser/smoke-test.js

1
.gitignore vendored

@ -1,3 +1,4 @@
.vscode
build
node_modules
reports

@ -1,7 +1,11 @@
language: node_js
node_js:
- stable
script: npm run lint && npm run test && npm run build
- stable
before_script:
- npm run serve &
script:
- npm run lint && npm run test && npm run build && nightwatch --env chrome
- pkill node
addons:
sauce_connect:
username: "chriseth"
@ -11,7 +15,7 @@ deploy:
script: ci/deploy_from_travis.sh
skip_cleanup: true
on:
branch: master
branch: master
env:
global:
- ENCRYPTION_LABEL="b5c2730599da"
@ -19,5 +23,3 @@ env:
- COMMIT_AUTHOR="Travis CI"
- PUSH_REPO="git@github.com:ethereum/browser-solidity.git"
- FILES_TO_PACKAGE="assets background.js build icon.png index.html manifest.json README.md"

@ -38,6 +38,20 @@ Run:
- In Debian based OSes such as Ubuntu you may need to run `apt-get install build-essential`. After installing `build-essential` run `npm install rebuild`.
## 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
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.

@ -0,0 +1,42 @@
{
"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 @@
"scripts": {
"test": "node test/index.js",
"build": "mkdir -p build; browserify src/index.js -o build/app.js",
"lint": "semistandard"
"lint": "semistandard",
"serve": "http-server ."
},
"devDependencies": {
"brace": "^0.8.0",
@ -16,8 +17,10 @@
"ethereumjs-tx": "^1.1.1",
"ethereumjs-util": "^4.4.0",
"ethereumjs-vm": "^1.4.0",
"http-server": "0.9.0",
"jquery": "^2.2.0",
"js-base64": "^2.1.9",
"nightwatch": "^0.9.3",
"semistandard": "^7.0.0",
"tape": "^4.5.1",
"web3": "^0.15.3",

@ -0,0 +1,10 @@
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();
}
};

@ -0,0 +1,9 @@
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();
}
};
Loading…
Cancel
Save