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

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into 568-migrate-…
Browse files Browse the repository at this point in the history
…desktop-notifications-to-react
  • Loading branch information
alepop committed Aug 21, 2017
2 parents fa9fdc3 + 2c3d897 commit 22dff25
Show file tree
Hide file tree
Showing 50 changed files with 294 additions and 205 deletions.
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
"no-restricted-properties": "off",
"no-return-assign": "off",
"no-underscore-dangle": "off",
"import/no-extraneous-dependencies": "off",
"import/no-extraneous-dependencies": ["error", {
devDependencies: [
"./src/**/*.test.js",
"./features/*/*.js",
"./src/**/stories.js"
]
}
],
"no-param-reassign": "off"
}
}
30 changes: 24 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,37 @@ node('lisk-nano-01'){
}
}

stage ('Build Nano') {
stage ('Install npm dependencies') {
try {
sh '''#!/bin/bash
# Install Electron
npm install
# Build nano
cd $WORKSPACE
npm install
'''
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, npm install failed')
}
}

stage ('Run Eslint') {
try {
sh '''
cd $WORKSPACE
npm run eslint
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, Eslint failed')
}
}

stage ('Build Nano') {
try {
sh '''#!/bin/bash
# Add coveralls config file
cp ~/.coveralls.yml-nano .coveralls.yml
Expand All @@ -69,10 +91,6 @@ node('lisk-nano-01'){
sh '''
export ON_JENKINS=true
# Start xvfb
export DISPLAY=:99
Xvfb :99 -ac -screen 0 1280x1024x24 &
# Run test
cd $WORKSPACE
npm run test
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lisk Nano

[![Build Status](https://jenkins.lisk.io/buildStatus/icon?job=Nano-Pipeline/development)](https://jenkins.lisk.io/job/Nano-Pipeline/job/development)
[![Build Status](https://jenkins.lisk.io/buildStatus/icon?job=lisk-nano/development)](https://jenkins.lisk.io/job/lisk-nano/job/development)
[![Coverage Status](https://coveralls.io/repos/github/LiskHQ/lisk-nano/badge.svg?branch=development)](https://coveralls.io/github/LiskHQ/lisk-nano?branch=development)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)

Expand Down Expand Up @@ -71,17 +71,15 @@ npm run test-live

### Setup

To setup protractor as described on http://www.protractortest.org/#/ run:
Setup protractor

```
npm install -g protractor
webdriver-manager update
webdriver-manager start
./node_modules/protractor/bin/webdriver-manager update
```

Setup a lisk test node to run on localhost:4000 as described in https://github.com/LiskHQ/lisk#tests

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
And run it with [pm2](http://pm2.keymetrics.io/).

### Run

Expand Down
4 changes: 2 additions & 2 deletions e2e-test-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ fi

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

Expand Down
Empty file modified e2e-transactions.sh
100644 → 100755
Empty file.
22 changes: 19 additions & 3 deletions features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,27 @@ Feature: Login page
And I select option no. 1 from "network" select
And I click "login button"
Then I should be logged in
And I should see text "Mainnet" in "peer network" element

Scenario: should allow to change network
Scenario: should allow to login to Testnet
Given I'm on login page
When I select option no. 2 from "network" select
Then the option "Testnet" is selected in "network" select
When I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field
And I select option no. 2 from "network" select
And I click "login button"
Then I should be logged in
And I should see text "Testnet" in "peer network" element

@ignore
Scenario: should remember the selected network
Given I'm on login page
When I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field
And I select option no. 2 from "network" select
And I click "login button"
And I click "logout button"
And I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field
And I click "login button"
Then I should be logged in
And I should see text "Testnet" in "peer network" element

@ignore
Scenario: should allow to create a new account
Expand Down
12 changes: 2 additions & 10 deletions features/menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,33 @@ Feature: Top right menu
And I click "ok button"
Then I should see alert dialog with title "Success" and text "Second passphrase registration was successfully submitted. It can take several seconds before it is processed."

@ignore
Scenario: should not allow to set 2nd passphrase again
Given I'm logged in as "second passphrase account"
Then There is no "register second passphrase" in main menu

@ignore
Scenario: should not allow to set 2nd passphrase if not enough funds for the fee
Given I'm logged in as "empty account"
When I click "register second passphrase" in main menu
Then I should see "Not enough LSK to pay 5 LSK fee" error message
Then I should see "Insufficient funds for 5 LSK fee" error message
And "next button" should be disabled

@ignore
Scenario: should allow to exit 2nd passphrase registration dialog
Given I'm logged in as "genesis"
When I click "register second passphrase" in main menu
And I click "cancel button"
Then I should see no "modal dialog"

@ignore
Scenario: should allow to register a delegate
Given I'm logged in as "delegate candidate"
When I click "register as delegate" in main menu
And I fill in "test" to "username" field
And I click "register button"
Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted. It can take several seconds before it is processed."

@ignore
Scenario: should not allow to register a delegate again
Given I'm logged in as "delegate"
Then There is no "register as delegate" in main menu

@ignore
Scenario: should allow to register a delegate with second passphrase
Given I'm logged in as "second passphrase account"
When I click "register as delegate" in main menu
Expand All @@ -50,18 +44,16 @@ Feature: Top right menu
And I click "register button"
Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted. It can take several seconds before it is processed."

@ignore
Scenario: should allow to exit delegate registration dialog
Given I'm logged in as "genesis"
When I click "register as delegate" in main menu
And I click "cancel button"
Then I should see no "modal dialog"

@ignore
Scenario: should not allow to register delegate if not enough funds for the fee
Given I'm logged in as "empty account"
When I click "register as delegate" in main menu
Then I should see "Not enough LSK to pay 25 LSK fee" error message
Then I should see "Insufficient funds for 25 LSK fee" error message
And "register button" should be disabled

Scenario: should allow to sign message
Expand Down
8 changes: 1 addition & 7 deletions features/send.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Feature: Send dialog
@ignore
Scenario: should allow to send when enough funds and correct address form
Given I'm logged in as "genesis"
When I click "send button"
Expand All @@ -8,30 +7,26 @@ Feature: Send dialog
And I click "submit button"
Then I should see alert dialog with title "Success" and text "Your transaction of 1 LSK to 537318935439898807L was accepted and will be processed in a few seconds."

@ignore
Scenario: should not allow to send when not enough funds
Given I'm logged in as "empty account"
When I click "send button"
And I fill in "1" to "amount" field
And I fill in "537318935439898807L" to "recipient" field
Then I should see "Insufficient funds" error message

@ignore
Scenario: should not allow to send when invalid address
Given I'm logged in as "any account"
When I click "send button"
And I fill in "1243409812409" to "recipient" field
And I fill in "1" to "amount" field
Then I should see "Invalid" error message

@ignore
Scenario: should allow to exit send dialog
Given I'm logged in as "send all account"
Given I'm logged in as "any account"
When I click "send button"
And I click "cancel button"
Then I should see no "modal dialog"

@ignore
Scenario: should allow to send all funds
Given I'm logged in as "send all account"
When I click "send button"
Expand All @@ -40,7 +35,6 @@ Feature: Send dialog
And I click "submit button"
Then I should see alert dialog with title "Success" and text "Your transaction of 101 LSK to 537318935439898807L was accepted and will be processed in a few seconds."

@ignore
Scenario: should allow to send with second passphrase
Given I'm logged in as "second passphrase account"
When I click "send button"
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/forging.step.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const { waitForElemAndCheckItsText } = require('../support/util.js');


defineSupportCode(({ Then }) => {
Then('I should see forging center', (callback) => {
waitForElemAndCheckItsText('.delegate-name', 'genesis_17', callback);
Expand Down
19 changes: 11 additions & 8 deletions features/step_definitions/generic.step.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
Expand Down Expand Up @@ -26,7 +27,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
const selectorClass = `.${fieldName.replace(/ /g, '-')}`;
const secondPassphrase = accounts[accountName].secondPassphrase;
browser.sleep(500);
waitForElemAndSendKeys(`input${selectorClass}, textarea${selectorClass}`, secondPassphrase, callback);
waitForElemAndSendKeys(`${selectorClass} input, ${selectorClass} textarea`, secondPassphrase, callback);
});


Expand All @@ -46,13 +47,14 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
});

When('I click "{elementName}" in "{menuName}" menu', (elementName, menuName, callback) => {
waitForElemAndClickIt(`.md-icon-button.${menuName.replace(/ /g, '-')}`);
waitForElemAndClickIt(`.${menuName.replace(/ /g, '-')}`);
browser.sleep(1000);
waitForElemAndClickIt(`md-menu-item .md-button.${elementName.replace(/ /g, '-')}`, callback);
waitForElemAndClickIt(`.${elementName.replace(/ /g, '-')}`, callback);
});

When('I select option no. {index} from "{selectName}" select', (index, selectName, callback) => {
waitForElemAndClickIt(`.${selectName}`);
browser.sleep(500);
const optionElem = element.all(by.css(`.${selectName} ul li`)).get(index - 1);
browser.wait(EC.presenceOf(optionElem), waitTime);
optionElem.click().then(callback);
Expand All @@ -69,7 +71,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
});

Then('I should see table with {lineCount} lines', (lineCount, callback) => {
browser.sleep(3500);
browser.sleep(500);
expect(element.all(by.css('table tbody tr')).count()).to.eventually.equal(parseInt(lineCount, 10))
.and.notify(callback);
});
Expand All @@ -81,7 +83,8 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
});

Then('I should see "{text}" error message', (text, callback) => {
waitForElemAndCheckItsText('.md-input-message-animation, .error-message', text, callback);
browser.sleep(500);
waitForElemAndCheckItsText('.error-message, .theme__error___2k5Jz', text, callback);
});

Then('"{elementName}" should be disabled', (elementName, callback) => {
Expand All @@ -100,6 +103,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
browser.driver.manage().window().setSize(1000, 1000);
browser.get('http://localhost:8080/');
browser.manage().addCookie({ name: 'address', value: 'http://localhost:4000' });
browser.manage().addCookie({ name: 'network', value: '2' });
browser.get('http://localhost:8080/');
waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase);
waitForElemAndClickIt('.login-button', callback);
Expand All @@ -111,9 +115,8 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
* Generates a sequence of random pairs of x,y coordinates on the screen that simulates
* the movement of mouse to produce a pass phrase.
*/
for (let i = 0; i < iterations; i++) {
actions
.mouseMove(element(by.css('body')), {
for (let i = 0; i < iterations; i += 1) {
actions.mouseMove(element(by.css('body')), {
x: 500 + (Math.floor((((i % 2) * 2) - 1) * (249 + (Math.random() * 250)))),
y: 500 + (Math.floor((((i % 2) * 2) - 1) * (249 + (Math.random() * 250)))),
});
Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/hooks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const fs = require('fs');

Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/login.step.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const { waitForElemAndCheckItsText } = require('../support/util.js');

Expand Down
3 changes: 2 additions & 1 deletion features/step_definitions/menu.step.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
Expand All @@ -14,7 +15,7 @@ defineSupportCode(({ When, Then }) => {
});

Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => {
waitForElemAndClickIt('header .md-icon-button');
waitForElemAndClickIt('.main-menu-icon-button');
browser.sleep(1000);
expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0)
.and.notify(callback);
Expand Down
1 change: 1 addition & 0 deletions features/step_definitions/top.step.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const { waitForElemAndCheckItsText } = require('../support/util.js');

Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/transactions.step.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const { waitForElemAndClickIt } = require('../support/util.js');


defineSupportCode(({ When }) => {
When('I click "{elementName}" element on table row no. {index}', (elementName, index, callback) => {
const selectorClass = `.${elementName.replace(/ /g, '-')}`;
waitForElemAndClickIt(`transactions tr:nth-child(${index}) ${selectorClass}`, callback);
waitForElemAndClickIt(`table tr:nth-child(${index}) ${selectorClass}`, callback);
});
});

5 changes: 3 additions & 2 deletions features/step_definitions/voting.step.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
Expand All @@ -8,7 +9,7 @@ const expect = chai.expect;

defineSupportCode(({ When, Then }) => {
When('I click checkbox on table row no. {index}', (index, callback) => {
waitForElemAndClickIt(`delegates tr:nth-child(${index}) md-checkbox`, callback);
waitForElemAndClickIt(`table tr:nth-child(${index}) td label`, callback);
});

When('Search twice for "{searchTerm}" in vote dialog', (searchTerm, callback) => {
Expand All @@ -19,7 +20,7 @@ defineSupportCode(({ When, Then }) => {
});

Then('I should see delegates list with {count} lines', (count, callback) => {
expect(element.all(by.css('md-menu-item.vote-list-item')).count())
expect(element.all(by.css('.my-votes-button li')).count())
.to.eventually.equal(parseInt(count, 10))
.and.notify(callback);
});
Expand Down

0 comments on commit 22dff25

Please sign in to comment.