diff --git a/features/login.feature b/features/login.feature index ba3189ef2..8f4260292 100644 --- a/features/login.feature +++ b/features/login.feature @@ -5,6 +5,16 @@ Feature: Login page And I click "login button" Then I should be logged in + Scenario: should show toast when trying to connect to an unavailable custom node + 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. 3 from "network" select + And I clear "address" field + And I fill in "http://localhost:4218" to "address" field + And I click "login button" + And I wait 1 seconds + Then I should see text "Unable to connect to the node" in "toast" element + Scenario: should allow to login to Mainnet 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/step_definitions/generic.step.js b/features/step_definitions/generic.step.js index 865c6fdfe..ce97f337c 100644 --- a/features/step_definitions/generic.step.js +++ b/features/step_definitions/generic.step.js @@ -129,6 +129,11 @@ defineSupportCode(({ Given, When, Then, setDefaultTimeout }) => { waitForElemAndCheckItsText(selectorClass, text, callback); }); + When('I clear "{elementName}" field', (elementName) => { + const selectorClass = `.${elementName.replace(/ /g, '-')}`; + browser.executeScript(`window.document.querySelector("${selectorClass} input, ${selectorClass} textarea").value = "";`); + }); + Given('I\'m logged in as "{accountName}"', (accountName, callback) => { browser.ignoreSynchronization = true; browser.driver.manage().window().setSize(1000, 1000); diff --git a/src/actions/peers.js b/src/actions/peers.js index 60131e2b5..98324b2cb 100644 --- a/src/actions/peers.js +++ b/src/actions/peers.js @@ -1,6 +1,8 @@ +import i18next from 'i18next'; import Lisk from 'lisk-js'; import actionTypes from '../constants/actions'; import { getNethash } from './../utils/api/nethash'; +import { errorToastDisplayed } from './toaster'; const peerSet = (data, config) => ({ data: Object.assign({ @@ -41,6 +43,8 @@ export const activePeerSet = data => getNethash(Lisk.api(config)).then((response) => { config.nethash = response.nethash; dispatch(peerSet(data, config)); + }).catch(() => { + dispatch(errorToastDisplayed({ label: i18next.t('Unable to connect to the node') })); }); } else { dispatch(peerSet(data, config));