From a89a858b605b197ff922ab1a5666e77ea9f100f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Mon, 6 Nov 2017 15:43:27 +0100 Subject: [PATCH 01/12] Use variable for job name instead of hardcoded string in Jenkinsfile --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 785638f49..74c30bb89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ def fail(reason) { 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' + 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: "#${env.JOB_BASE_NAME}-jenkins" currentBuild.result = 'FAILURE' error("${reason}") } @@ -92,8 +92,8 @@ node('lisk-nano') { stage ('Deploy') { try { - sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/lisk-nano/$BRANCH_NAME/ && rsync" $WORKSPACE/app/build/ jenkins@master-01:/var/www/test/lisk-nano/$BRANCH_NAME/' - githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/lisk-nano/${BRANCH_NAME}" + sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/$JOB_BASE_NAME/$BRANCH_NAME/ && rsync" $WORKSPACE/app/build/ jenkins@master-01:/var/www/test/$JOB_BASE_NAME/$BRANCH_NAME/' + githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/${JOB_BASE_NAME}/${BRANCH_NAME}" } catch (err) { echo "Error: ${err}" fail('Stopping build: deploy failed') @@ -160,7 +160,7 @@ node('lisk-nano') { if (previous_build != null && previous_build.result == 'FAILURE') { slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} was successful.", - channel: '#lisk-nano-jenkins' + channel: "#${env.JOB_BASE_NAME}-jenkins" } } else { archiveArtifacts allowEmptyArchive: true, artifacts: 'e2e-test-screenshots/' From f41bc80ffb6343cabeadbeba594dda9cd489065a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Mon, 6 Nov 2017 17:02:10 +0100 Subject: [PATCH 02/12] Use actual job base name; limit name of slack channel length --- Jenkinsfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 74c30bb89..96d2a4d82 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,14 @@ def fail(reason) { 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: "#${env.JOB_BASE_NAME}-jenkins" + BASE_NAME = "${env.JOB_NAME}".tokenize('/')[0] + /* Slack channel names are limited to 22 characters */ + if (BASE_NAME == 'lisk-wallet-private' ) { + BASE_NAME = 'lisk-wallet' + } + 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: "#${BASE_NAME}-jenkins" currentBuild.result = 'FAILURE' error("${reason}") } @@ -92,8 +99,8 @@ node('lisk-nano') { stage ('Deploy') { try { - sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/$JOB_BASE_NAME/$BRANCH_NAME/ && rsync" $WORKSPACE/app/build/ jenkins@master-01:/var/www/test/$JOB_BASE_NAME/$BRANCH_NAME/' - githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/${JOB_BASE_NAME}/${BRANCH_NAME}" + sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/${JOB_NAME%/*}/$BRANCH_NAME/ && rsync" $WORKSPACE/app/build/ jenkins@master-01:/var/www/test/${JOB_NAME%/*}/$BRANCH_NAME/' + githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/" + "${JOB_BASE_NAME}".tokenize('/')[0] + "/${BRANCH_NAME}" } catch (err) { echo "Error: ${err}" fail('Stopping build: deploy failed') @@ -158,9 +165,13 @@ node('lisk-nano') { /* notify of success if previous build failed */ previous_build = currentBuild.getPreviousBuild() if (previous_build != null && previous_build.result == 'FAILURE') { + /* Slack channel names are limited to 22 characters */ + if (BASE_NAME == 'lisk-wallet-private' ) { + BASE_NAME = 'lisk-wallet' + } slackSend color: 'good', message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} was successful.", - channel: "#${env.JOB_BASE_NAME}-jenkins" + channel: "#${BASE_NAME}-jenkins" } } else { archiveArtifacts allowEmptyArchive: true, artifacts: 'e2e-test-screenshots/' From b8849261ebbc3f04a15c7d5962c7300e602171f4 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 6 Nov 2017 20:28:01 +0100 Subject: [PATCH 03/12] Set meta viewport to fix size on mobile devices --- src/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.html b/src/index.html index 406cb8b0c..6a2671b74 100644 --- a/src/index.html +++ b/src/index.html @@ -2,6 +2,7 @@ + Lisk Nano From 929c5168962f7d9a55d4e54dcb06ab98a4bb3fe8 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Tue, 7 Nov 2017 06:42:26 +0100 Subject: [PATCH 04/12] Cleanup eslint paths ... to make sure it covers all js files --- .eslintignore | 4 ++++ config/webpack.config.react.js | 1 - package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..ce26711fd --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +dist +node_modules +coverage +app/build diff --git a/config/webpack.config.react.js b/config/webpack.config.react.js index 7677cf21c..4b25dd4ba 100644 --- a/config/webpack.config.react.js +++ b/config/webpack.config.react.js @@ -1,6 +1,5 @@ /* eslint-disable import/no-extraneous-dependencies */ const { resolve } = require('path'); -const webpack = require('webpack'); const StyleLintPlugin = require('stylelint-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const I18nScannerPlugin = require('../src/i18n-scanner'); diff --git a/package.json b/package.json index aa2fc71ea..8170bc617 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "copy-files": "cpx \"./src/{index.html,assets/**/*}\" ./app/build/", "clean-build": "rm -rf app/build", "clean-dist": "rm -rf dist", - "eslint": "eslint ./src/ ./app/src/ ./app/config/ ./features/", + "eslint": "eslint ./", "pack": "npm install && npm run build && npm run clean-dist && npm run dist", "pack:win": "cmd /c npm install && npm run clean-build && npm run copy-files && npm run build-prod && npm run build-electron && npm run clean-dist && npm run dist:win", "storybook": "start-storybook -p 6006 -s ./src/", From 1e3be3c7cdf64770c09a5f138f036da91deb21a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Tue, 7 Nov 2017 10:51:04 +0100 Subject: [PATCH 05/12] Truncate job name to create slack channel names < 21 chars --- Jenkinsfile | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 96d2a4d82..163cc82d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,31 @@ -def fail(reason) { - def pr_branch = '' +def get_build_info() { + pr_branch = '' if (env.CHANGE_BRANCH != null) { pr_branch = " (${env.CHANGE_BRANCH})" } - BASE_NAME = "${env.JOB_NAME}".tokenize('/')[0] - /* Slack channel names are limited to 22 characters */ - if (BASE_NAME == 'lisk-wallet-private' ) { - BASE_NAME = 'lisk-wallet' + build_info = "#${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch}" + return build_info +} + +def slack_send(color, message) { + /* Slack channel names are limited to 21 characters */ + CHANNEL_MAX_LEN = 21 + CHANNEL_SUFFIX = '-jenkins' + + channel = "${env.JOB_NAME}".tokenize('/')[0] + channel_len = CHANNEL_MAX_LEN - CHANNEL_SUFFIX.size() + if ( channel.size() > channel_len ) { + channel = channel.substring(0, channel_len) } - 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: "#${BASE_NAME}-jenkins" + channel += CHANNEL_SUFFIX + echo "[slack_send] channel: ${channel} " + + slackSend color: "${color}", message: "${message}", channel: "${channel}" +} + +def fail(reason) { + build_info = get_build_info() + slack_send('danger', "Build ${build_info} failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\nCause: ${reason}") currentBuild.result = 'FAILURE' error("${reason}") } @@ -100,7 +115,7 @@ node('lisk-nano') { stage ('Deploy') { try { sh 'rsync -axl --delete --rsync-path="mkdir -p /var/www/test/${JOB_NAME%/*}/$BRANCH_NAME/ && rsync" $WORKSPACE/app/build/ jenkins@master-01:/var/www/test/${JOB_NAME%/*}/$BRANCH_NAME/' - githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/" + "${JOB_BASE_NAME}".tokenize('/')[0] + "/${BRANCH_NAME}" + githubNotify context: 'Jenkins test deployment', description: 'Commit was deployed to test', status: 'SUCCESS', targetUrl: "${HUDSON_URL}test/" + "${JOB_NAME}".tokenize('/')[0] + "/${BRANCH_NAME}" } catch (err) { echo "Error: ${err}" fail('Stopping build: deploy failed') @@ -155,23 +170,14 @@ node('lisk-nano') { deleteDir() } - def pr_branch = '' - if (env.CHANGE_BRANCH != null) { - pr_branch = " (${env.CHANGE_BRANCH})" - } if (currentBuild.result == null || currentBuild.result == 'SUCCESS') { /* delete all files on success */ deleteDir() /* notify of success if previous build failed */ previous_build = currentBuild.getPreviousBuild() if (previous_build != null && previous_build.result == 'FAILURE') { - /* Slack channel names are limited to 22 characters */ - if (BASE_NAME == 'lisk-wallet-private' ) { - BASE_NAME = 'lisk-wallet' - } - slackSend color: 'good', - message: "Recovery: build #${env.BUILD_NUMBER} of <${env.BUILD_URL}|${env.JOB_NAME}>${pr_branch} was successful.", - channel: "#${BASE_NAME}-jenkins" + build_info = get_build_info() + slack_send('good', "Recovery: build ${build_info} was successful.") } } else { archiveArtifacts allowEmptyArchive: true, artifacts: 'e2e-test-screenshots/' From 11225bc5bb088ea6b0ea601a84c83ce0fe7ed9c0 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:34:01 +0100 Subject: [PATCH 06/12] Merge intersecting e2e test scenarios --- features/forging.feature | 11 ++++------- features/menu.feature | 5 +---- features/transactions.feature | 15 +++------------ features/voting.feature | 14 +++----------- 4 files changed, 11 insertions(+), 34 deletions(-) diff --git a/features/forging.feature b/features/forging.feature index 3e9abe259..d3241cd73 100644 --- a/features/forging.feature +++ b/features/forging.feature @@ -1,12 +1,9 @@ Feature: Forging tab - Scenario: should allow to view forging center if account is delegate + Scenario: should allow to view forging center if account is delegate and should show more blocks on scroll Given I'm logged in as "delegate" When I click tab number 3 Then I should see forging center + And I should see table with 20 lines + And I scroll to the bottom + And I should see table with 40 lines - Scenario: should show more blocks on scroll - Given I'm logged in as "delegate" - When I click tab number 3 - Then I should see table with 20 lines - When I scroll to the bottom - Then I should see table with 40 lines diff --git a/features/menu.feature b/features/menu.feature index 70034a133..0793fd31d 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -33,10 +33,7 @@ Feature: Top right menu And I click "ok button" And I wait 15 seconds And I should see text "test" in "delegate name" element - - 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 + And There is no "register as delegate" in main menu Scenario: should allow to register a delegate with second passphrase Given I'm logged in as "second passphrase account" diff --git a/features/transactions.feature b/features/transactions.feature index 267ef7f62..1b1519cb0 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -1,10 +1,5 @@ Feature: Transactions tab - Scenario: should show transactions - Given I'm logged in as "genesis" - When I click tab number 1 - Then I should see table with 40 lines - - Scenario: should show more transactions on scroll + Scenario: should show transactions and more on scroll Given I'm logged in as "genesis" When I click tab number 1 Then I should see table with 40 lines @@ -28,15 +23,11 @@ Feature: Transactions tab 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." - Scenario: should provide "No transactions" message - Given I'm logged in as "empty account" - When I click tab number 1 - Then I should see table with 0 lines - And I should see text "There are no transactions, yet. RECEIVE LSK" in "empty message" element - Scenario: should provide "Receive LSK" modal if there are "No transactions" Given I'm logged in as "empty account" When I click tab number 1 + And I should see table with 0 lines + And I should see text "There are no transactions, yet. RECEIVE LSK" in "empty message" element And I click "receive lsk button" And I wait 1 seconds Then I should see text "5932438298200837883L" in "receive modal address" element diff --git a/features/voting.feature b/features/voting.feature index 78dbb3d5d..deadbc4ea 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -1,10 +1,5 @@ Feature: Voting tab - Scenario: should allow to view delegates - Given I'm logged in as "any account" - When I click tab number 2 - Then I should see table with 100 lines - - Scenario: should allow to view more delegates on scroll + Scenario: should allow to view delegates and more on scroll Given I'm logged in as "any account" When I click tab number 2 Then I should see table with 100 lines @@ -21,12 +16,9 @@ Feature: Voting tab When I click tab number 2 And I fill in "genesis_42" to "search" field Then I should see table with 1 lines - - Scenario: search delegates should provide "no results" message - Given I'm logged in as "any account" - When I click tab number 2 + And I clear "search" field And I fill in "doesntexist" to "search" field - Then I should see table with 0 lines + And I should see table with 0 lines And I should see text "No delegates found" in "empty message" element Scenario: should allow to view my votes From 2cd87f94d231745a0ac0188492aff2c67d79ade0 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:40:18 +0100 Subject: [PATCH 07/12] Remove e2e scenarios covered elsewhere either in unit tests or in other e2e tests --- features/login.feature | 8 -------- features/send.feature | 15 --------------- features/top.feature | 18 ------------------ 3 files changed, 41 deletions(-) delete mode 100644 features/top.feature diff --git a/features/login.feature b/features/login.feature index 3c5c1c88e..94c40d587 100644 --- a/features/login.feature +++ b/features/login.feature @@ -23,14 +23,6 @@ Feature: Login page Then I should be logged in And I should see text "Mainnet" in "peer network" element - Scenario: should allow to login to Testnet - 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" - Then I should be logged in - And I should see text "Testnet" in "peer network" element - 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 diff --git a/features/send.feature b/features/send.feature index 02b80d7b0..dcb4145b4 100644 --- a/features/send.feature +++ b/features/send.feature @@ -15,13 +15,6 @@ Feature: Send dialog And I fill in "537318935439898807L" to "recipient" field Then I should see "Insufficient funds" error message - 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 - Scenario: should allow to exit send dialog Given I'm logged in as "any account" When I click "send button" @@ -29,14 +22,6 @@ Feature: Send dialog And I click "cancel button" Then I should see no "modal dialog" - Scenario: should allow to send all funds - Given I'm logged in as "send all account" - When I click "send button" - 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 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" When I click "send button" diff --git a/features/top.feature b/features/top.feature deleted file mode 100644 index 55b17c173..000000000 --- a/features/top.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Main page top area - Scenario: should allow to logout - Given I'm logged in as "any account" - When I click "logout button" - Then I should be on login page - - Scenario: should show peer - Given I'm logged in as "any account" - Then I should see text "Custom Node" in "peer network" element - - Scenario: should show address - Given I'm logged in as "genesis" - Then I should see text "16313739661670634666L" in "address" element - - Scenario: should show balance - Given I'm logged in as "empty account" - Then I should see text "0 LSK" in "balance value" element - From 3022fc4593a0bdc965e1754a5b4f23957916e258 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 20:51:18 +0100 Subject: [PATCH 08/12] Add @integration tag to e2e tests that should be integration tests --- features/accountManagement.feature | 2 ++ features/menu.feature | 7 +++++++ features/send.feature | 2 ++ features/transactions.feature | 2 ++ features/voting.feature | 6 ++++++ 5 files changed, 19 insertions(+) diff --git a/features/accountManagement.feature b/features/accountManagement.feature index bfcae7f92..dfb3c5005 100644 --- a/features/accountManagement.feature +++ b/features/accountManagement.feature @@ -34,12 +34,14 @@ Feature: Account management And I refresh the page And I should be on login page + @integration Scenario: should allow to exit save account dialog with "cancel button" Given I'm logged in as "any account" When I click "save account" in main menu And I click "cancel button" Then I should see no "modal dialog" + @integration Scenario: should allow to exit save account dialog with "x button" Given I'm logged in as "any account" When I click "save account" in main menu diff --git a/features/menu.feature b/features/menu.feature index 0793fd31d..530816fa5 100644 --- a/features/menu.feature +++ b/features/menu.feature @@ -12,12 +12,14 @@ Feature: Top right menu Given I'm logged in as "second passphrase account" Then There is no "register second passphrase" in main menu + @integration 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 "Insufficient funds for 5 LSK fee" error message And "next button" should be disabled + @integration 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 @@ -43,12 +45,14 @@ 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 with username: "test2". It can take several seconds before it is processed." + @integration 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" + @integration 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 @@ -72,12 +76,14 @@ Feature: Top right menu -----END LISK SIGNED MESSAGE----- """ + @integration Scenario: should allow to exit sign message dialog with "cancel button" Given I'm logged in as "any account" When I click "sign message" in main menu And I click "cancel button" Then I should see no "modal dialog" + @integration Scenario: should allow to exit sign message dialog with "x button" Given I'm logged in as "any account" When I click "sign message" in main menu @@ -91,6 +97,7 @@ Feature: Top right menu And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field Then I should see "Hello world" in "result" field + @integration Scenario: should allow to exit verify message dialog Given I'm logged in as "any account" When I click "verify message" in main menu diff --git a/features/send.feature b/features/send.feature index dcb4145b4..c44e836aa 100644 --- a/features/send.feature +++ b/features/send.feature @@ -8,6 +8,7 @@ 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." + @integration Scenario: should not allow to send when not enough funds Given I'm logged in as "empty account" When I click "send button" @@ -15,6 +16,7 @@ Feature: Send dialog And I fill in "537318935439898807L" to "recipient" field Then I should see "Insufficient funds" error message + @integration Scenario: should allow to exit send dialog Given I'm logged in as "any account" When I click "send button" diff --git a/features/transactions.feature b/features/transactions.feature index 1b1519cb0..6e6bd8f24 100644 --- a/features/transactions.feature +++ b/features/transactions.feature @@ -6,6 +6,7 @@ Feature: Transactions tab When I scroll to the bottom Then I should see table with 60 lines + @integration Scenario: should allow send to address Given I'm logged in as "genesis" When I click tab number 1 @@ -14,6 +15,7 @@ Feature: Transactions tab 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." + @integration @pending Scenario: should allow to repeat the transaction Given I'm logged in as "genesis" diff --git a/features/voting.feature b/features/voting.feature index deadbc4ea..38590c296 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -21,12 +21,14 @@ Feature: Voting tab And I should see table with 0 lines And I should see text "No delegates found" in "empty message" element + @integration Scenario: should allow to view my votes Given I'm logged in as "genesis" When I click tab number 2 And I click "my votes button" Then I should see delegates list with 101 lines + @integration Scenario: should not allow to vote if not enough funds for the fee Given I'm logged in as "empty account" When I click tab number 2 @@ -35,6 +37,7 @@ Feature: Voting tab Then I should see "Insufficient funds for 1 LSK fee" error message And "submit button" should be disabled + @integration 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 @@ -82,6 +85,7 @@ Feature: Voting tab And I click "submit button" Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." + @integration Scenario: should allow to select delegates in the "Vote" dialog and vote for them Given I'm logged in as "delegate candidate" When I click tab number 2 @@ -90,6 +94,7 @@ Feature: Voting tab And I click "submit button" Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." + @integration Scenario: should allow to remove votes form delegates Given I'm logged in as "genesis" When I click tab number 2 @@ -100,6 +105,7 @@ Feature: Voting tab And I click "submit button" Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." + @integration Scenario: should allow to exit vote dialog Given I'm logged in as "genesis" When I click tab number 2 From 766466c79b18434f2454658703d106462a702850 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 21:10:29 +0100 Subject: [PATCH 09/12] Split menu.feature into multiple *.feature files --- features/menu.feature | 105 ---------------------- features/registerDelegate.feature | 35 ++++++++ features/registerSecondPassphrase.feature | 28 ++++++ features/signMessage.feature | 33 +++++++ features/verifyMessage.feature | 15 ++++ 5 files changed, 111 insertions(+), 105 deletions(-) delete mode 100644 features/menu.feature create mode 100644 features/registerDelegate.feature create mode 100644 features/registerSecondPassphrase.feature create mode 100644 features/signMessage.feature create mode 100644 features/verifyMessage.feature diff --git a/features/menu.feature b/features/menu.feature deleted file mode 100644 index 530816fa5..000000000 --- a/features/menu.feature +++ /dev/null @@ -1,105 +0,0 @@ -Feature: Top right menu - Scenario: should allow to set 2nd passphrase - Given I'm logged in as "second passphrase candidate" - When I click "register second passphrase" in main menu - And I click "next button" - And I 250 times move mouse randomly - And I remember passphrase, click "next button", fill in missing word - And I click "next 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." - - 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 - - @integration - 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 "Insufficient funds for 5 LSK fee" error message - And "next button" should be disabled - - @integration - 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" - - 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 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 - And There is no "register as delegate" in main menu - - 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 - 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 with username: "test2". It can take several seconds before it is processed." - - @integration - 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" - - @integration - 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 "Insufficient funds for 25 LSK fee" error message - And "register button" should be disabled - - Scenario: should allow to sign message - Given I'm logged in as "any account" - When I click "sign message" in main menu - And I fill in "Hello world" to "message" field - And I click "primary button" - Then I should see in "result" field: - """ - -----BEGIN LISK SIGNED MESSAGE----- - -----MESSAGE----- - Hello world - -----PUBLIC KEY----- - c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f - -----SIGNATURE----- - 079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64 - -----END LISK SIGNED MESSAGE----- - """ - - @integration - Scenario: should allow to exit sign message dialog with "cancel button" - Given I'm logged in as "any account" - When I click "sign message" in main menu - And I click "cancel button" - Then I should see no "modal dialog" - - @integration - Scenario: should allow to exit sign message dialog with "x button" - Given I'm logged in as "any account" - When I click "sign message" in main menu - And I click "x button" - Then I should see no "modal dialog" - - Scenario: should allow to verify message - Given I'm logged in as "any account" - When I click "verify message" in main menu - And I fill in "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" to "public key" field - And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field - Then I should see "Hello world" in "result" field - - @integration - Scenario: should allow to exit verify message dialog - Given I'm logged in as "any account" - When I click "verify message" in main menu - And I click "x button" - Then I should see no "modal dialog" diff --git a/features/registerDelegate.feature b/features/registerDelegate.feature new file mode 100644 index 000000000..f5b0459c2 --- /dev/null +++ b/features/registerDelegate.feature @@ -0,0 +1,35 @@ +Feature: Register delegate + 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 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 + And There is no "register as delegate" in main menu + + 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 + 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 with username: "test2". It can take several seconds before it is processed." + + @integration + 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" + + @integration + 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 "Insufficient funds for 25 LSK fee" error message + And "register button" should be disabled + + diff --git a/features/registerSecondPassphrase.feature b/features/registerSecondPassphrase.feature new file mode 100644 index 000000000..66826c240 --- /dev/null +++ b/features/registerSecondPassphrase.feature @@ -0,0 +1,28 @@ +Feature: Register second passphrase + Scenario: should allow to set 2nd passphrase + Given I'm logged in as "second passphrase candidate" + When I click "register second passphrase" in main menu + And I click "next button" + And I 250 times move mouse randomly + And I remember passphrase, click "next button", fill in missing word + And I click "next 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." + + 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 + + @integration + 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 "Insufficient funds for 5 LSK fee" error message + And "next button" should be disabled + + @integration + 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" + diff --git a/features/signMessage.feature b/features/signMessage.feature new file mode 100644 index 000000000..142b955e9 --- /dev/null +++ b/features/signMessage.feature @@ -0,0 +1,33 @@ +Feature: Sign message + Scenario: should allow to sign message + Given I'm logged in as "any account" + When I click "sign message" in main menu + And I fill in "Hello world" to "message" field + And I click "primary button" + Then I should see in "result" field: + """ + -----BEGIN LISK SIGNED MESSAGE----- + -----MESSAGE----- + Hello world + -----PUBLIC KEY----- + c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f + -----SIGNATURE----- + 079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64 + -----END LISK SIGNED MESSAGE----- + """ + + @integration + Scenario: should allow to exit sign message dialog with "cancel button" + Given I'm logged in as "any account" + When I click "sign message" in main menu + And I click "cancel button" + Then I should see no "modal dialog" + + @integration + Scenario: should allow to exit sign message dialog with "x button" + Given I'm logged in as "any account" + When I click "sign message" in main menu + And I click "x button" + Then I should see no "modal dialog" + + diff --git a/features/verifyMessage.feature b/features/verifyMessage.feature new file mode 100644 index 000000000..fc2098a55 --- /dev/null +++ b/features/verifyMessage.feature @@ -0,0 +1,15 @@ +Feature: Verify message + Scenario: should allow to verify message + Given I'm logged in as "any account" + When I click "verify message" in main menu + And I fill in "c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f" to "public key" field + And I fill in "079331d868678fd5f272f09d6dc8792fb21335aec42af7f11caadbfbc17d4707e7d7f343854b0c619b647b81ba3f29b23edb4eaf382a47c534746bad4529560b48656c6c6f20776f726c64" to "signature" field + Then I should see "Hello world" in "result" field + + @integration + Scenario: should allow to exit verify message dialog + Given I'm logged in as "any account" + When I click "verify message" in main menu + And I click "x button" + Then I should see no "modal dialog" + From 0a6a1c45cb3fc3fca8b0887b7d83c3e735b463c9 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 8 Nov 2017 21:42:34 +0100 Subject: [PATCH 10/12] Make unstable e2e scenario temporarily @pending --- features/voting.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/voting.feature b/features/voting.feature index 38590c296..56a6d0aa7 100644 --- a/features/voting.feature +++ b/features/voting.feature @@ -86,6 +86,7 @@ Feature: Voting tab Then I should see alert dialog with title "Success" and text "Your votes were successfully submitted. It can take several seconds before they are processed." @integration + @pending Scenario: should allow to select delegates in the "Vote" dialog and vote for them Given I'm logged in as "delegate candidate" When I click tab number 2 From 96d7555d687f2c7b1c2781b0ea63b6a10c6ac41b Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Thu, 9 Nov 2017 09:27:49 +0100 Subject: [PATCH 11/12] Move menu.step.js code to generic.step.js ... because there is no menu.feature anymore --- features/step_definitions/generic.step.js | 20 +++++++++++++++ features/step_definitions/menu.step.js | 30 ----------------------- 2 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 features/step_definitions/menu.step.js diff --git a/features/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index ae58a643a..6c976a2c7 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -199,5 +199,25 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { When('I scroll to the bottom', () => { browser.executeScript('window.scrollBy(0, 10000);'); }); + + When('I click "{itemSelector}" in main menu', (itemSelector, callback) => { + waitForElemAndClickIt('.main-menu-icon-button'); + browser.sleep(1000); + waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`); + browser.sleep(1000).then(callback); + }); + + Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { + waitForElemAndClickIt('.main-menu-icon-button'); + browser.sleep(500); + expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0) + .and.notify(callback); + }); + + Then('I should see in "{fieldName}" field:', (fieldName, value, callback) => { + const elem = element(by.css(`.${fieldName.replace(/ /g, '-')} textarea`)); + expect(elem.getAttribute('value')).to.eventually.equal(value) + .and.notify(callback); + }); }); diff --git a/features/step_definitions/menu.step.js b/features/step_definitions/menu.step.js deleted file mode 100644 index 14a76d194..000000000 --- a/features/step_definitions/menu.step.js +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -const { defineSupportCode } = require('cucumber'); -const chai = require('chai'); -const chaiAsPromised = require('chai-as-promised'); -const { waitForElemAndClickIt } = require('../support/util.js'); - -chai.use(chaiAsPromised); -const expect = chai.expect; - -defineSupportCode(({ When, Then }) => { - When('I click "{itemSelector}" in main menu', (itemSelector, callback) => { - waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(1000); - waitForElemAndClickIt(`.${itemSelector.replace(/ /g, '-')}`); - browser.sleep(1000).then(callback); - }); - - Then('There is no "{itemSelector}" in main menu', (itemSelector, callback) => { - waitForElemAndClickIt('.main-menu-icon-button'); - browser.sleep(500); - expect(element.all(by.css(`md-menu-item .md-button.${itemSelector.replace(/ /g, '-')}`)).count()).to.eventually.equal(0) - .and.notify(callback); - }); - - Then('I should see in "{fieldName}" field:', (fieldName, value, callback) => { - const elem = element(by.css(`.${fieldName.replace(/ /g, '-')} textarea`)); - expect(elem.getAttribute('value')).to.eventually.equal(value) - .and.notify(callback); - }); -}); From 6cbee05a7c5ff1d868cac52279f4a1f5dbbeea60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Fri, 10 Nov 2017 12:16:37 +0100 Subject: [PATCH 12/12] Use core port number > 4000 to prevent side effects --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d41c73b11..0de720210 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,7 +45,7 @@ node('lisk-nano') { try { sh ''' - N=${EXECUTOR_NUMBER:-0} + N=${EXECUTOR_NUMBER:-0}; N=$((N+1)) cd ~/lisk-Linux-x86_64 # work around core bug: config.json gets overwritten; use backup cp .config.json config_$N.json @@ -138,7 +138,7 @@ node('lisk-nano') { ansiColor('xterm') { withCredentials([string(credentialsId: 'lisk-nano-testnet-passphrase', variable: 'TESTNET_PASSPHRASE')]) { sh ''' - N=${EXECUTOR_NUMBER:-0} + N=${EXECUTOR_NUMBER:-0}; N=$((N+1)) # End to End test configuration export DISPLAY=:1$N @@ -161,7 +161,7 @@ node('lisk-nano') { echo "Error: ${err}" } finally { sh ''' - N=${EXECUTOR_NUMBER:-0} + N=${EXECUTOR_NUMBER:-0}; N=$((N+1)) curl --verbose http://127.0.0.1:400$N/api/blocks/getNethash || true ( 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