Skip to content

Commit

Permalink
Merge branch '1.4.0' into 1210-update-dependencies-to-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Sep 11, 2018
2 parents e543d60 + 1d3271e commit 54a253d
Show file tree
Hide file tree
Showing 43 changed files with 647 additions and 1,188 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -4,7 +4,6 @@ node_modules
npm-debug.log
src/.nyc_output
coverage
e2e-test-screenshots
app/report.html
app/*.map
app/build
Expand All @@ -16,3 +15,5 @@ app/app.js
.idea
blockchain_explorer.db.gz
reports
test/cypress/screenshots/
test/cypress/videos/
41 changes: 10 additions & 31 deletions Jenkinsfile
Expand Up @@ -19,7 +19,6 @@ node('lisk-hub') {
cache_file = restoreCache("package.json")
sh '''
npm install
./node_modules/protractor/bin/webdriver-manager update
'''
saveCache(cache_file, './node_modules', 10)
} catch (err) {
Expand Down Expand Up @@ -101,34 +100,20 @@ node('lisk-hub') {
ansiColor('xterm') {
withCredentials([string(credentialsId: 'lisk-hub-testnet-passphrase', variable: 'TESTNET_PASSPHRASE')]) {
sh '''
N=${EXECUTOR_NUMBER:-0}; N=$((N+1))
export N=${EXECUTOR_NUMBER:-0}; N=$((N+1))
# End to End test configuration
export DISPLAY=:1$N
Xvfb :1$N -ac -screen 0 1280x1024x24 &
cp -r ~/lisk-docker/examples/development $WORKSPACE/$BRANCH_NAME
cd $WORKSPACE/$BRANCH_NAME
cp /home/lisk/blockchain_explorer.db.gz ./blockchain.db.gz
LISK_VERSION=1.0.0-rc.1 make coldstart
LISK_PORT=$( docker-compose port lisk 4000 |cut -d ":" -f 2 )
cd -
cp -r ~/lisk-docker/examples/development $WORKSPACE/$BRANCH_NAME
cd $WORKSPACE/$BRANCH_NAME
cp /home/lisk/blockchain_explorer.db.gz ./blockchain.db.gz
LISK_VERSION=1.0.0-rc.1 make coldstart
# Run end-to-end tests
npm run serve -- $WORKSPACE/app/build -p 300$N -a 127.0.0.1 &>server.log &
if [ -z $CHANGE_BRANCH ]; then
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:$LISK_PORT --cucumberOpts.tags @advanced
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL https://testnet.lisk.io --cucumberOpts.tags @testnet --params.useTestnetPassphrase true
else
echo "Skipping @testnet end-to-end tests because we're not on 'development' branch"
fi
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:$LISK_PORT
if [ -z $CHANGE_BRANCH ]; then
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --cucumberOpts.tags @testnet --params.useTestnetPassphrase true --params.network testnet
else
echo "Skipping @testnet end-to-end tests because we're not on 'development' branch"
fi
export CYPRESS_baseUrl=http://127.0.0.1:300$N/#/
export CYPRESS_coreUrl=http://127.0.0.1:$( docker-compose port lisk 4000 |cut -d ":" -f 2 )
cd -
npm run serve -- $WORKSPACE/app/build -p 300$N -a 127.0.0.1 &>server.log &
npm run cypress:run -- --record
'''
}
}
Expand All @@ -150,14 +135,10 @@ node('lisk-hub') {
N=${EXECUTOR_NUMBER:-0}; N=$((N+1))
pgrep --list-full -f "Xvfb :1$N" || true
pkill --echo -f "Xvfb :1$N" -9 || echo "pkill returned code $?"
cat reports/cucumber_report.json | ./node_modules/.bin/cucumber-junit > reports/cucumber_report.xml
'''

cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/*/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, fileCoverageTargets: '100, 0, 0', lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII'
junit 'reports/junit_report.xml'
junit 'reports/cucumber_report.xml'

dir('node_modules') {
deleteDir()
}
Expand All @@ -171,8 +152,6 @@ node('lisk-hub') {
build_info = getBuildInfo()
liskSlackSend('good', "Recovery: build ${build_info} was successful.")
}
} else {
archiveArtifacts allowEmptyArchive: true, artifacts: 'e2e-test-screenshots/'
}
}
}
11 changes: 4 additions & 7 deletions package.json
Expand Up @@ -13,7 +13,8 @@
"dev": "webpack-dev-server --config ./config/webpack.config.dev --env.dev --hot",
"build-prod": "webpack --config ./config/webpack.config.prod --env.prod",
"build-electron": "webpack --config ./config/webpack.config.electron",
"e2e-test": "protractor protractor.conf.js",
"cypress:open": "cypress open --project test/cypress",
"cypress:run": "cypress run --project test/cypress",
"test": "karma start",
"test-jest": "jest --config ./jest.config.js",
"bundlesize": "bundlesize",
Expand Down Expand Up @@ -110,8 +111,7 @@
"cpx": "=1.5.0",
"css-hot-loader": "=1.3.1",
"css-loader": "0.28.7",
"cucumber": "2.2.0",
"cucumber-junit": "1.7.0",
"cypress": "3.1.0",
"del-cli": "1.1.0",
"electron": "1.8.8",
"electron-builder": "19.32.2",
Expand All @@ -126,6 +126,7 @@
"eslint-config-google": "0.9.1",
"eslint-loader": "1.9.0",
"eslint-plugin-babel": "4.1.2",
"eslint-plugin-cypress": "2.0.1",
"eslint-plugin-html": "3.2.2",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-mocha": "4.11.0",
Expand Down Expand Up @@ -164,8 +165,6 @@
"postcss-nesting": "4.2.1",
"postcss-partial-import": "=4.1.0",
"postcss-reporter": "5.0.0",
"protractor": "5.4.0",
"protractor-cucumber-framework": "3.1.0",
"raw-loader": "1.0.0-beta.0",
"react-addons-test-utils": "=15.6.0",
"react-hot-loader": "=1.3.1",
Expand Down Expand Up @@ -230,8 +229,6 @@
],
"greenkeeper": {
"ignore": [
"cucumber",
"protractor-cucumber-framework",
"postcss-cssnext"
]
}
Expand Down
36 changes: 0 additions & 36 deletions protractor.conf.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/header/header.js
Expand Up @@ -79,7 +79,7 @@ class Header extends React.Component {
<PrivateWrapper>
<div className={`account ${styles.account}`}>
<div className={styles.information} align="right">
<div className={styles.balance}>
<div className={`balance ${styles.balance}`}>
<LiskAmount val={this.props.account.balance}/>
<small> LSK</small>
</div>
Expand Down
8 changes: 8 additions & 0 deletions test/cypress/.eslintrc
@@ -0,0 +1,8 @@
{
"plugins": [
"cypress"
],
"env": {
"cypress/globals": true
}
}
17 changes: 17 additions & 0 deletions test/cypress/cypress.json
@@ -0,0 +1,17 @@
{
"baseUrl": "http://localhost:8080/#/",
"viewportWidth": 1500,
"viewportHeight": 1000,
"projectId": "1it63b",
"video": true,
"env": {
"coreUrl": "http://localhost:4000"
},
"integrationFolder": "./e2e",
"fixturesFolder": "./fixtures",
"pluginsFile": "./plugins/index.js",
"screenshotsFolder": "./screenshots",
"supportFile": "./support/index.js",
"videosFolder": "./videos",
"trashAssetsBeforeRuns": true
}
43 changes: 43 additions & 0 deletions test/cypress/e2e/ex-protractor-cucumber/explorer.spec.js
@@ -0,0 +1,43 @@
import accounts from '../../../constants/accounts';

describe('Explorer page', () => {
it('should show search results on custom node for an account and a transactions while being logged in', () => {
cy.loginUI(accounts.genesis, 'dev');
cy.get('#autosuggest-input').click().type('15610359283786884938L{enter}');
cy.get('.empty-message').should('have.text', 'No activity yet');
cy.get('.autosuggest-btn-close').click();
cy.get('#autosuggest-input').click().type('16313739661670634666L{enter}');
cy.url().should('contains', '/explorer/accounts/16313739661670634666L');
cy.get('.transactions-row').should('have.length', 25);
cy.get('.send-to-address').click();
cy.get('#autosuggest-input').click().type('16313739661670634666L');
cy.get('.home-link').click();
cy.get('.autosuggest-btn-close').click();
cy.get('#autosuggest-input').click().type('9938914350729699234{enter}');
cy.get('.empty-message').should('have.text', 'No results');
cy.get('.autosuggest-btn-close').click();
cy.get('#autosuggest-input').click().type('1465651642158264047');
cy.get('.transactions-result').click();
cy.get('.transaction-id .copy-title').should('have.text', '1465651642158264047');
});

it('should show added voters in "voted delegate" transaction type while being logged in', () => {
cy.loginUI(accounts.genesis, 'dev');
cy.get('#autosuggest-input').click().type('18294919898268153226');
cy.get('.transactions-result').click();
cy.get('.voter-address').should('have.length', 33);
cy.get('.home-link').click();
cy.get('.autosuggest-btn-close').click();
cy.get('#autosuggest-input').click().type('2581762640681118072L');
cy.get('.addresses-result').click();
cy.get('.delegate-statistics').click();
cy.get('.votersFilterQuery-row').should('have.length', 2);
cy.get('.home-link').click();
cy.get('.autosuggest-btn-close').click();
cy.get('#autosuggest-input').click().type('4401082358022424760L');
cy.get('.addresses-result').click();
cy.wait(3000);
cy.get('.delegate-statistics').click();
cy.get('.votesFilterQuery-row').should('have.length', 10);
});
});
25 changes: 25 additions & 0 deletions test/cypress/e2e/ex-protractor-cucumber/followedAccount.spec.js
@@ -0,0 +1,25 @@
import accounts from '../../../constants/accounts';

describe('Followed accounts', () => {
it('should add a followed account to list', () => {
cy.loginUI(accounts.genesis, 'dev');
cy.get('.followed-account').should('have.length', 0);
cy.get('.add-account-button').click();
cy.get('.address input').click().type('94495548317450502L');
cy.get('.next').click();
cy.get('.next').click();
cy.get('.followed-account').should('have.length', 1);
cy.get('.account-title input').should('have.value', '94495548317450502L');
cy.get('.edit-accounts').click();
cy.get('.account-title input').clear().type('Bob');
cy.get('.edit-accounts').click();
cy.get('.account-title input').should('have.value', 'Bob');
cy.get('.followed-account').click();
cy.url().should('include', '/explorer/accounts/94495548317450502L');
cy.get('.account-title').should('have.text', 'Bob');
cy.visit('/dashboard');
cy.get('.edit-accounts').click();
cy.get('.remove-account').click();
cy.get('.followed-account').should('have.length', 0);
});
});
44 changes: 44 additions & 0 deletions test/cypress/e2e/ex-protractor-cucumber/login.spec.js
@@ -0,0 +1,44 @@
import accounts from '../../../constants/accounts';

describe('Login', () => {
it('should allow to login to Testnet through network options launch protocol', () => {
cy.visit('/');
cy.get('.network').should('have.length', 0);
cy.visit('/setting');
cy.get('.showNetwork').click();
cy.visit('/');
cy.get('.network').click();
cy.get('ul li').eq(2).click();
cy.get('.passphrase input').click();
cy.get('.passphrase input').each(($el, index) => {
const passphraseWordsArray = accounts.genesis.passphrase.split(' ');
cy.wrap($el).type(passphraseWordsArray[index]);
});
cy.get('.login-button').click();
cy.get('.account-information-address .copy-title').should('have.text', accounts.genesis.address);
cy.get('.network-status').should('have.text', 'Connected to testnet');
cy.get('.main-tabs #transactions').click();
cy.get('.transactions-row').should('have.length', 25);
});

it('should allow to login to Custom node through network options launch protocol', () => {
cy.visit('/');
cy.get('.network').should('have.length', 0);
cy.visit('/setting');
cy.get('.showNetwork').click();
cy.visit('/');
cy.get('.network').click();
cy.get('ul li').eq(3).click();
cy.get('.address input').type('https://testnet.lisk.io');
cy.get('.passphrase input').click();
cy.get('.passphrase input').each(($el, index) => {
const passphraseWordsArray = accounts.genesis.passphrase.split(' ');
cy.wrap($el).type(passphraseWordsArray[index]);
});
cy.get('.login-button').click();
cy.get('.account-information-address .copy-title').should('have.text', accounts.genesis.address);
cy.get('.network-status').should('have.text', 'Connected to testnet');
cy.get('.main-tabs #transactions').click();
cy.get('.transactions-row').should('have.length', 25);
});
});
69 changes: 69 additions & 0 deletions test/cypress/e2e/ex-protractor-cucumber/onboarding.spec.js
@@ -0,0 +1,69 @@
import accounts from '../../../constants/accounts';

beforeEach(() => {
cy.addLocalStorage('settings', 'onBoarding', true);
});

describe('Onboarding', () => {
it('should not start onboarding when not logged in', () => {
cy.visit('/');
cy.wait(1000);
cy.get('.joyride-tooltip__header').should('have.length', 0);
});

it('should start onboarding automatically', () => {
cy.loginUI(accounts.genesis, 'main');
cy.wait(2000);
cy.get('.joyride-tooltip__header').should('have.text', 'Welcome to Lisk Hub');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Lisk ID');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Explore the network');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Keep the overview');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Send LSK');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Manage your application');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Access extra features');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'You’ve completed the tour!');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.length', 0);
cy.visit('/setting');
cy.get('.advancedMode');
cy.visit('/help');
cy.get('.help-onboarding').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Welcome to Lisk Hub');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Lisk ID');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Explore the network');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Keep the overview');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Send LSK');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Manage your application');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Access extra features');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'You’ve completed the tour!');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.length', 0);
cy.reload();
cy.loginUI(accounts.genesis, 'main');
cy.get('.joyride-tooltip__header').should('have.length', 0);
cy.visit('/help');
cy.get('.help-onboarding').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Welcome to Lisk Hub');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Lisk ID');
cy.get('.joyride-tooltip__button--primary').click();
cy.get('.joyride-tooltip__button--skip').click();
cy.get('.joyride-tooltip__header').should('have.text', 'Onboarding whenever you need');
cy.get('.joyride-tooltip__button--skip').click();
cy.get('.joyride-tooltip__header').should('have.length', 0);
});
});

0 comments on commit 54a253d

Please sign in to comment.