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

Commit

Permalink
Merge pull request #880 from LiskHQ/879-custom-node-error-toast
Browse files Browse the repository at this point in the history
Add missing error toast for unavailable custom node - Closes #879
  • Loading branch information
gina contrino authored Oct 18, 2017
2 parents 915920d + 0b56732 commit 83c07ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions features/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions features/step_definitions/generic.step.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/actions/peers.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 83c07ad

Please sign in to comment.