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

Commit

Permalink
Merge branch 'development' into 725-passphrase-e2e-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Sep 28, 2017
2 parents 03befac + 629c06e commit 96bd491
Show file tree
Hide file tree
Showing 62 changed files with 897 additions and 340 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"./src/**/*.test.js",
"./features/*/*.js",
"./src/**/stories.js",
"./src/tests.js"
"./src/tests.js",
"./src/i18n-scanner.js"
]
}
],
Expand Down
40 changes: 21 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
def fail(reason) {
slackSend color: 'danger', message: "Build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}> (${env.BRANCH_NAME}) failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\nCause: ${reason}", channel: '#lisk-nano-jenkins'
currentBuild.result = 'FAILURE'
milestone 1
error(${reason})
def pr_branch = ''
if (env.CHANGE_BRANCH != null) {
pr_branch = " (${env.CHANGE_BRANCH})"
}
slackSend color: 'danger', message: "Build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\nCause: ${reason}", channel: '#lisk-nano-jenkins'
currentBuild.result = 'FAILURE'
sh 'rm -rf "$WORKSPACE/node_modules/"'
milestone 1
error("${reason}")
}

node('lisk-nano-01'){
lock(resource: "lisk-nano-01", inversePrecedence: true) {
stage ('Cleanup Orphaned Processes') {
stage ('Cleanup, Checkout, and Start Lisk Core') {
try {
sh '''
# Clean up old processes
Expand All @@ -21,20 +26,16 @@ node('lisk-nano-01'){
} catch (err) {
fail('Stopping build, installation failed')
}
}

stage ('Prepare Workspace') {
try {
deleteDir()
checkout scm
} catch (err) {
fail('Stopping build, Checkout failed')
}
}

stage ('Start Lisk Core') {
try {
sh '''#!/bin/bash
sh '''
cd ~/lisk-test-nano
bash lisk.sh rebuild -f /home/lisk/lisk-test-nano/blockchain_explorer.db.gz
'''
Expand All @@ -45,7 +46,7 @@ node('lisk-nano-01'){

stage ('Install npm dependencies') {
try {
sh '''#!/bin/bash
sh '''
npm install
# Build nano
cd $WORKSPACE
Expand All @@ -72,7 +73,7 @@ node('lisk-nano-01'){

stage ('Build Nano') {
try {
sh '''#!/bin/bash
sh '''
# Add coveralls config file
cp ~/.coveralls.yml-nano .coveralls.yml
Expand All @@ -84,7 +85,7 @@ node('lisk-nano-01'){
}
}

stage ('Run Tests') {
stage ('Run Unit Tests') {
try {
ansiColor('xterm') {
sh '''
Expand All @@ -103,7 +104,7 @@ node('lisk-nano-01'){
}
}

stage ('Start Dev Server and Run Tests') {
stage ('Start Dev Server and Run E2E Tests') {
try {
ansiColor('xterm') {
sh '''
Expand Down Expand Up @@ -134,7 +135,7 @@ node('lisk-nano-01'){
}
}

stage ('Deploy') {
stage ('Deploy and Set milestone') {
try {
sh '''
rsync -axl --delete "$WORKSPACE/app/dist/" "jenkins@master-01:/var/www/test/lisk-nano/$BRANCH_NAME/"
Expand All @@ -143,12 +144,13 @@ node('lisk-nano-01'){
rm -rf "$WORKSPACE/*"
'''
} catch (err) {
fail('Stopping build, End to End Test suite failed')
fail('Stopping build, Deploy failed')
}
}

stage ('Set milestone') {
milestone 1
/* notify of success if previous build failed */
if (currentBuild.getPreviousBuild().result == 'FAILURE') {
slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}> was sucessful.", channel: '#lisk-nano-jenkins'
}
}
}
}
9 changes: 7 additions & 2 deletions features/step_definitions/generic.step.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,13 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
.and.notify(callback);
});

Then('I should see text "{text}" in "{fieldName}" element', (text, fieldName, callback) => {
const selectorClass = `.${fieldName.replace(/ /g, '-')}`;
Then('I should see text "{text}" in "{elementName}" element', (text, elementName, callback) => {
const selectorClass = `.${elementName.replace(/ /g, '-')}`;
waitForElemAndCheckItsText(selectorClass, text, callback);
});

Then('I should see element "{elementName}" that contains text:', (elementName, text, callback) => {
const selectorClass = `.${elementName.replace(/ /g, '-')}`;
waitForElemAndCheckItsText(selectorClass, text, callback);
});

Expand Down
10 changes: 5 additions & 5 deletions features/step_definitions/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function writeScreenShot(data, filename) {

function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}

defineSupportCode(({ After }) => {
Expand Down
24 changes: 24 additions & 0 deletions features/voting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ Feature: Voting tab
Then I should see "Insufficient funds for 1 LSK fee" error message
And "submit button" should be disabled

Scenario: should display voting bar with numbers of selected votes if any selected
Given I'm logged in as "delegate candidate"
When I click tab number 2
And I should see no "voting bar"
And I click checkbox on table row no. 3
Then I should see element "voting bar" that contains text:
"""
Upvotes: 1
Downvotes: 0
Total new votes: 1 / 33
Total votes: 1 / 101
"""
And I click checkbox on table row no. 5
And I should see element "voting bar" that contains text:
"""
Upvotes: 2
Downvotes: 0
Total new votes: 2 / 33
Total votes: 2 / 101
"""
And I click checkbox on table row no. 3
And I click checkbox on table row no. 5
And I should see no "voting bar"

Scenario: should allow to select delegates in the "Voting" tab and vote for them
Given I'm logged in as "delegate candidate"
When I click tab number 2
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"dist:win": "build --win --ia32 --x64",
"dist:mac": "build --mac",
"dist:linux": "build --linux --ia32 --x64 --armv7l",
"copy-files": "mkdir app/dist && cp -r ./src/index.html ./app/dist",
"copy-files": "mkdir app/dist && cp -r ./src/index.html ./src/assets ./app/dist",
"clean": "del app/dist -f",
"eslint": "eslint ./src/ ./app/main.js ./features/",
"storybook": "start-storybook -p 6006 -s ./src/",
"i18n-scanner": "node ./src/i18n-scanner.js",
"build-storybook": "build-storybook"
},
"author": "Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>",
Expand Down Expand Up @@ -78,8 +79,8 @@
"electron": "=1.6.2",
"electron-builder": "=16.8.3",
"enzyme": "=2.8.2",
"eslint": "=3.19.0",
"eslint-config-airbnb": "=14.1.0",
"eslint": "=4.7.2",
"eslint-config-airbnb": "=15.1.0",
"eslint-config-google": "=0.7.1",
"eslint-loader": "=1.7.1",
"eslint-plugin-html": "=2.0.3",
Expand All @@ -88,6 +89,8 @@
"exports-loader": "=0.6.3",
"extract-text-webpack-plugin": "=2.1.2",
"file-loader": "=0.9.0",
"glob": "=7.1.2",
"i18next-scanner": "=2.0.0",
"imports-loader": "=0.6.5",
"js-nacl": "=1.2.2",
"json-loader": "=0.5.4",
Expand Down
12 changes: 6 additions & 6 deletions src/actions/forging.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export const forgedBlocksUpdated = data => ({
export const fetchAndUpdateForgedBlocks = ({ activePeer, limit, offset, generatorPublicKey }) =>
(dispatch) => {
getForgedBlocks(activePeer, limit, offset, generatorPublicKey)
.then(response =>
dispatch(forgedBlocksUpdated(response.blocks)),
);
.then(response =>
dispatch(forgedBlocksUpdated(response.blocks)),
);
};

export const forgingStatsUpdated = data => ({
Expand All @@ -22,7 +22,7 @@ export const forgingStatsUpdated = data => ({
export const fetchAndUpdateForgedStats = ({ activePeer, key, startMoment, generatorPublicKey }) =>
(dispatch) => {
getForgedStats(activePeer, startMoment, generatorPublicKey)
.then(response =>
dispatch(forgingStatsUpdated({ [key]: response.forged })),
);
.then(response =>
dispatch(forgingStatsUpdated({ [key]: response.forged })),
);
};
12 changes: 6 additions & 6 deletions src/actions/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export const transactionsLoaded = data => ({
export const transactionsRequested = ({ activePeer, address, limit, offset }) =>
(dispatch) => {
transactions(activePeer, address, limit, offset)
.then((response) => {
dispatch(transactionsLoaded({
count: parseInt(response.count, 10),
confirmed: response.transactions,
}));
});
.then((response) => {
dispatch(transactionsLoaded({
count: parseInt(response.count, 10),
confirmed: response.transactions,
}));
});
};
2 changes: 1 addition & 1 deletion src/actions/transactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import sinon from 'sinon';
import actionTypes from '../constants/actions';
import { transactionAdded, transactionsUpdated,
transactionsLoaded, transactionsRequested } from './transactions';
transactionsLoaded, transactionsRequested } from './transactions';
import * as accountApi from '../utils/api/account';

describe('actions: transactions', () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const App = () => (
<Route path={`${match.url}/forging/:dialog?`} component={Forging} />
</main>
)} />
<Route exact path="/register" component={Login} />
<Route exact path="/" component={Login} />
</main>
<Dialog />
Expand Down
18 changes: 9 additions & 9 deletions src/components/app/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import Forging from '../forging';
const fakeStore = configureStore();

const addRouter = Component => (props, path) =>
mount(
<Provider {...props}>
<MemoryRouter initialEntries={path}>
<I18nextProvider i18n={ i18n }>
<Component />
</I18nextProvider>
</MemoryRouter>
</Provider>,
);
mount(
<Provider {...props}>
<MemoryRouter initialEntries={path}>
<I18nextProvider i18n={ i18n }>
<Component />
</I18nextProvider>
</MemoryRouter>
</Provider>,
);

const publicComponent = [
{ route: '/', component: Login },
Expand Down
Loading

0 comments on commit 96bd491

Please sign in to comment.