Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #201 from LiskHQ/178_e2e-tests-for-1-0-0
Browse files Browse the repository at this point in the history
Create e2e tests for all 1.0.0 features - Closes #178
  • Loading branch information
karmacoma authored May 10, 2017
2 parents 3d568d1 + f7fe7e3 commit dbbb2ec
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ node_modules
npm-debug.log
src/.nyc_output
src/coverage
src/e2e-test-screenshots
*.sw[pon]
app/app.js
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@ Setup a lisk test node to run on localhost:4000 as described in https://github.c

Make sure that the Lisk version of the node matches version in https://github.com/LiskHQ/lisk-nano/blob/development/src/app/services/peers/peer.js#L16

Make sure there are some transactions on the master account so we can test they display correctly:
```
for i in {1..20}
do
curl -k -H "Content-Type: application/json" -X PUT -d '{"secret":"wagon stock borrow episode laundry kitten salute link globe zero feed marble","amount":'"$i"'0000000,"recipientId":"537318935439898807L"}' http://localhost:4000/api/transactions; echo ''
done
```

### Run

Start the development version of lisk-nano:
Expand All @@ -102,9 +94,10 @@ cd src
npm run dev
```

Run the protractor tests:
Run the protractor tests (replace `~/git/lisk/` with your path to lisk core):

```
./spec/setup.sh ~/git/lisk/
npm run e2e-test
```

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/transfer/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ app.component('transfer', {
this.recipient.value,
this.amount.raw,
this.account.get().passphrase,
this.secondPassphrase,
this.secondPassphrase || null,
).then((data) => {
const transaction = {
id: data.transactionId,
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"grunt-newer": "=1.2.0",
"html-webpack-plugin": "=2.19.0",
"imports-loader": "=0.6.5",
"jasmine-spec-reporter": "=3.2.0",
"jasmine-spec-reporter": "=3.3.0",
"jit-grunt": "=0.10.0",
"json-loader": "=0.5.4",
"karma": "=1.4.1",
Expand All @@ -73,6 +73,7 @@
"nyc": "=10.1.2",
"phantomjs": "=2.1.7",
"phantomjs-prebuilt": "=2.1.14",
"protractor": "=5.1.1",
"pug": "=2.0.0-beta11",
"pug-cli": "=1.0.0-alpha6",
"pug-loader": "=2.3.0",
Expand Down
22 changes: 19 additions & 3 deletions src/spec/conf.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
directConnect: true,
capabilities: {
browserName: 'chrome',
},
onPrepare() {
const env = jasmine.getEnv();

env.clearReporters();
jasmine.getEnv().addReporter(new SpecReporter({
// FIXME the following like can make the output cleaner
// but then shell return code is always 0 even if some tests fail.
// env.clearReporters();

env.addReporter(new SpecReporter({
spec: {
displayStacktrace: false,
displayDuration: true,
},
summary: {
displayDuration: true,
},
}));

jasmine.getEnv().addReporter({
specStarted(result) {
jasmine.getEnv().currentSpec = result;
},
specDone() {
jasmine.getEnv().currentSpec = null;
},
});
},
};
25 changes: 25 additions & 0 deletions src/spec/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Purpose of this script is to clean lisk database and create some tranactions

if [ -z "$1" ]
then
echo "One required argument missing: path to folder with lisk core app.js"
exit 1
fi

pwd=`pwd`
cd $1
forever stop app.js
dropdb lisk_test && createdb lisk_test
forever start app.js
sleep 5
cd $pwd

for i in {1..20}
do
curl -k -H "Content-Type: application/json" -X PUT -d '{"secret":"wagon stock borrow episode laundry kitten salute link globe zero feed marble","amount":'"$i"000000000',"recipientId":"537318935439898807L"}' http://localhost:4000/api/transactions
echo ''
done
curl -k -H "Content-Type: application/json" -X PUT -d '{"secret":"wagon stock borrow episode laundry kitten salute link globe zero feed marble","amount":'10000000000',"recipientId":"544792633152563672L"}' http://localhost:4000/api/transactions
curl -k -H "Content-Type: application/json" -X PUT -d '{"secret":"wagon stock borrow episode laundry kitten salute link globe zero feed marble","amount":'10000000000',"recipientId":"4264113712245538326L"}' http://localhost:4000/api/transactions
sleep 5
Loading

0 comments on commit dbbb2ec

Please sign in to comment.