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

Commit

Permalink
Merge branch '1.3.0' into 831-i18n-scanner-in-webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet authored Nov 6, 2017
2 parents a350ac1 + 8544afd commit 629e6e0
Show file tree
Hide file tree
Showing 27 changed files with 273 additions and 195 deletions.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@lisk.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
19 changes: 9 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def fail(reason) {
error("${reason}")
}

/* comment out the next line to allow concurrent builds on the same branch */
properties([disableConcurrentBuilds(), pipelineTriggers([])])
node('lisk-nano') {
try {
stage ('Cleanup, Checkout and Start Lisk Core') {
Expand Down Expand Up @@ -54,10 +56,6 @@ node('lisk-nano') {
cp -r ~/cache/development/node_modules ./ || true
npm install
./node_modules/protractor/bin/webdriver-manager update
# cache nightly builds (development) only to save space
if [ $BRANCH_NAME = "development" ]; then
rsync -axl --delete $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true
fi
'''
} catch (err) {
echo "Error: ${err}"
Expand Down Expand Up @@ -118,15 +116,13 @@ node('lisk-nano') {
ansiColor('xterm') {
sh '''
N=${EXECUTOR_NUMBER:-0}
NODE_ENV= npm run --silent dev -- --port 808$N > .lisk-nano.log 2>&1 &
sleep 30
# End to End test configuration
export DISPLAY=:1$N
Xvfb :1$N -ac -screen 0 1280x1024x24 &
# Run end-to-end tests
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:808$N/ --params.liskCoreURL http://127.0.0.1:400$N
npm run --silent e2e-test -- --params.baseURL file://$WORKSPACE/app/build/index.html --params.liskCoreURL http://127.0.0.1:400$N
'''
}
} catch (err) {
Expand All @@ -143,8 +139,11 @@ node('lisk-nano') {
( cd ~/lisk-Linux-x86_64 && bash lisk.sh stop_node -p etc/pm2-lisk_$N.json ) || true
pgrep --list-full -f "Xvfb :1$N" || true
pkill --echo -f "Xvfb :1$N" -9 || echo "pkill returned code $?"
pgrep --list-full -f "webpack.*808$N" || true
pkill --echo -f "webpack.*808$N" -9 || echo "pkill returned code $?"
# cache nightly builds (development) only to save space
if [ $BRANCH_NAME = "development" ]; then
rsync -axl --delete $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true
fi
'''
dir('node_modules') {
deleteDir()
Expand All @@ -154,7 +153,7 @@ node('lisk-nano') {
if (env.CHANGE_BRANCH != null) {
pr_branch = " (${env.CHANGE_BRANCH})"
}
if (currentBuild.result == 'SUCCESS') {
if (currentBuild.result == null || currentBuild.result == 'SUCCESS') {
/* delete all files on success */
deleteDir()
/* notify of success if previous build failed */
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![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)
[![Join the chat at https://gitter.im/LiskHQ/lisk](https://badges.gitter.im/LiskHQ/lisk.svg)](https://gitter.im/LiskHQ/lisk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![devDependencies Status](https://david-dm.org/liskHQ/lisk-nano/dev-status.svg)](https://david-dm.org/liskHQ/lisk-nano?type=dev)

## Development

Expand Down
2 changes: 2 additions & 0 deletions config/webpack.config.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const webpack = require('webpack');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const I18nScannerPlugin = require('../src/i18n-scanner');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
/* eslint-enable import/no-extraneous-dependencies */

const entries = {
Expand Down Expand Up @@ -46,5 +47,6 @@ module.exports = {
'./app/src/**/*.js',
],
}),
new HardSourceWebpackPlugin(),
],
};
6 changes: 3 additions & 3 deletions features/accountManagement.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Account management
And I click "save account button"
And I wait 1 seconds
And I should see text "Account saved" in "toast" element
And I Refresh the page
And I refresh the page
And I wait 2 seconds
Then I should be logged in
And I click "send button"
Expand All @@ -26,12 +26,12 @@ Feature: Account management
Given I'm logged in as "any account"
When I click "save account" in main menu
And I click "save account button"
And I Refresh the page
And I refresh the page
And I wait 2 seconds
And I click "forget account" in main menu
And I wait 1 seconds
Then I should see text "Account was successfully forgotten." in "toast" element
And I Refresh the page
And I refresh the page
And I should be on login page

Scenario: should allow to exit save account dialog with "cancel button"
Expand Down
2 changes: 2 additions & 0 deletions features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Feature: 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 wait 2 seconds
And I refresh the page
And I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field
And I click "login button"
Expand All @@ -45,6 +46,7 @@ Feature: Login page
Scenario: should allow to create a new account
Given I'm on login page
When I click "new account button"
And I wait 1 seconds
And I click "next button"
And I 250 times move mouse randomly
And I remember passphrase, click "next button", fill in missing word
Expand Down
4 changes: 2 additions & 2 deletions features/menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Feature: Top right menu
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."
Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted with username: "test". It can take several seconds before it is processed."
And I click "ok button"
And I wait 15 seconds
And I should see text "test" in "delegate name" element
Expand All @@ -44,7 +44,7 @@ Feature: Top right menu
And I fill in "test2" to "username" field
And I fill in second passphrase of "second passphrase account" to "second passphrase" 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."
Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted with username: "test2". It can take several seconds before it is processed."

Scenario: should allow to exit delegate registration dialog
Given I'm logged in as "genesis"
Expand Down
3 changes: 2 additions & 1 deletion features/send.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Feature: Send dialog
Scenario: should allow to exit send dialog
Given I'm logged in as "any account"
When I click "send button"
And I wait 1 seconds
And I click "cancel button"
Then I should see no "modal dialog"

Expand All @@ -33,7 +34,7 @@ Feature: Send dialog
And I fill in "537318935439898807L" to "recipient" field
And I click "send maximum amount" in "transaction amount" menu
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."
Then I should see alert dialog with title "Success" and text "Your transaction of 100 LSK to 537318935439898807L was accepted and will be processed in a few seconds."

Scenario: should allow to send with second passphrase
Given I'm logged in as "second passphrase account"
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/forging.step.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { waitForElemAndCheckItsText } = require('../support/util.js');

defineSupportCode(({ Then }) => {
Then('I should see forging center', (callback) => {
waitForElemAndCheckItsText('.delegate-name', 'genesis_17', callback);
waitForElemAndCheckItsText('.delegate-name', 'genesis_17');
waitForElemAndCheckItsText('.forged-blocks h5', 'Forged Blocks', callback);
});
});
61 changes: 28 additions & 33 deletions features/step_definitions/generic.step.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const {
waitForElemAndCheckItsText,
waitForElemAndMatchItsText,
waitForElemRemoved,
waitForElemAndClickIt,
waitForElemAndSendKeys,
Expand All @@ -12,7 +13,6 @@ const {
waitTime,
} = require('../support/util.js');
const accounts = require('../support/accounts.js');
const localStorage = require('../support/localStorage.js');

chai.use(chaiAsPromised);
const expect = chai.expect;
Expand Down Expand Up @@ -75,12 +75,12 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {

When('I select option no. {index} from "{selectName}" select', (index, selectName, callback) => {
waitForElemAndClickIt(`.${selectName}`);
browser.sleep(500);
browser.sleep(1000);
const selector = `.${selectName} ul li`;
const optionElem = element.all(by.css(selector)).get(index - 1);
browser.wait(EC.presenceOf(optionElem), waitTime)
.catch(error => console.error(`${error}`)); // eslint-disable-line no-console
optionElem.click().then(callback);
optionElem.click().then(callback).catch(callback);
});

Then('the option "{optionText}" is selected in "{selectName}" select', (optionText, selectName, callback) => {
Expand All @@ -101,7 +101,7 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {

Then('I should see no "{elementName}"', (elementName, callback) => {
const selector = `.${elementName.replace(/ /g, '-')}`;
waitForElemRemoved(selector, () => {
waitForElemRemoved(selector).then(() => {
expect(element.all(by.css(selector)).count()).to.eventually.equal(0)
.and.notify(callback);
});
Expand All @@ -123,9 +123,9 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
waitForElemAndCheckItsText(selectorClass, text, callback);
});

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

Then('I should see element "{elementName}" that contains text:', (elementName, text, callback) => {
Expand All @@ -139,15 +139,10 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
});

Given('I\'m logged in as "{accountName}"', { timeout: 2 * defaultTimeout }, (accountName, callback) => {
browser.ignoreSynchronization = true;
browser.driver.manage().window().setSize(1000, 1000);
browser.get(browser.params.baseURL);
localStorage.clear();
localStorage.setItem('address', browser.params.liskCoreURL);
localStorage.setItem('network', 2);
browser.get(browser.params.baseURL);
waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase);
waitForElemAndClickIt('.login-button', callback);
waitForElemAndSendKeys('.passphrase input', accounts[accountName].passphrase, () => {
waitForElemAndClickIt('.login-button', callback);
});
});

When('I go to "{url}"', (url, callback) => {
Expand All @@ -171,29 +166,29 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => {
});

When('I remember passphrase, click "{nextButtonSelector}", fill in missing word', { timeout: 2 * defaultTimeout }, (nextButtonSelector, callback) => {
waitForElemAndCheckItsText('.passphrase label', 'Save your passphrase in a safe place!');

waitForElem('.passphrase textarea', (textareaElem) => {
textareaElem.getText().then((passphrase) => {
// eslint-disable-next-line no-unused-expressions
expect(passphrase).to.not.be.undefined;
const passphraseWords = passphrase.split(' ');
expect(passphraseWords.length).to.equal(12);
waitForElemAndClickIt(`.${nextButtonSelector.replace(/ /g, '-')}`);

waitForElem('.passphrase-verifier p span', (elem) => {
elem.getText().then((firstPartOfPassphrase) => {
const missingWordIndex = firstPartOfPassphrase.length ?
firstPartOfPassphrase.split(' ').length :
0;
waitForElemAndSendKeys('.passphrase-verifier input', passphraseWords[missingWordIndex], callback);
waitForElemAndCheckItsText('.passphrase label', 'Save your passphrase in a safe place!', () => {
waitForElem('.passphrase textarea').then((textareaElem) => {
textareaElem.getText().then((passphrase) => {
// eslint-disable-next-line no-unused-expressions
expect(passphrase).to.not.be.undefined;
const passphraseWords = passphrase.split(' ');
expect(passphraseWords.length).to.equal(12);
waitForElemAndClickIt(`.${nextButtonSelector.replace(/ /g, '-')}`, () => {
waitForElem('.passphrase-verifier p span').then((elem) => {
elem.getText().then((firstPartOfPassphrase) => {
const missingWordIndex = firstPartOfPassphrase.length ?
firstPartOfPassphrase.split(' ').length :
0;
waitForElemAndSendKeys('.passphrase-verifier input', passphraseWords[missingWordIndex], callback);
}).catch(callback);
}).catch(callback);
});
});
});
}).catch(callback);
}).catch(callback);
});
});

When('I Refresh the page', (callback) => {
When('I refresh the page', (callback) => {
browser.refresh().then(callback);
});

Expand Down
48 changes: 46 additions & 2 deletions features/step_definitions/hooks.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,52 @@
/* eslint-disable import/no-extraneous-dependencies */
const { defineSupportCode } = require('cucumber');
const { takeScreenshot, slugify } = require('../support/util.js');
const fs = require('fs');
const localStorage = require('../support/localStorage.js');

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
}

function writeScreenShot(data, filename) {
const stream = fs.createWriteStream(filename);
stream.write(new Buffer(data, 'base64'));
stream.end();
}

function takeScreenshot(screnarioSlug, callback) {
browser.takeScreenshot().then((screenshotBuffer) => {
if (!fs.existsSync(browser.params.screenshotFolder)) {
fs.mkdirSync(browser.params.screenshotFolder);
}
const screenshotPath = `${browser.params.screenshotFolder}/${screnarioSlug}.png`;
writeScreenShot(screenshotBuffer, screenshotPath);
console.log(`Screenshot saved to ${screenshotPath}`); // eslint-disable-line no-console
if (callback) {
callback();
}
});
}

defineSupportCode(({ Before, After }) => {
Before((scenario, callback) => {
browser.ignoreSynchronization = true;
browser.driver.manage().window().setSize(1000, 1000);
browser.get(browser.params.baseURL);
localStorage.clear();
localStorage.setItem('address', browser.params.liskCoreURL);
localStorage.setItem('network', 2);
callback();
});

Before('@pending', (scenario, callback) => {
callback(null, 'pending');
});

defineSupportCode(({ After }) => {
After((scenario, callback) => {
if (scenario.isFailed()) {
const screnarioSlug = slugify([scenario.scenario.feature.name, scenario.scenario.name].join(' '));
Expand Down
Loading

0 comments on commit 629e6e0

Please sign in to comment.