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

Add missing error toast for unavailable custom node - Closes #879 #880

Merged
merged 4 commits into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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