-
Notifications
You must be signed in to change notification settings - Fork 60
Move network selection to login module - Closes #89 #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks very good.
Only issues:
- network dropdown should have a default
- end-to-end tests need to be updated, to see what's not passing run:
npm run e2e-test
@@ -95,6 +95,7 @@ module.exports = function (config) { | |||
// If true, Karma captures browsers, runs the tests and exits | |||
singleRun: !opts.live, | |||
client: { | |||
captureConsole: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go a separate commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
@@ -16,6 +16,7 @@ const PATHS = { | |||
}; | |||
|
|||
const common = { | |||
devtool: 'source-map', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go a separate commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/spec/spec.js
Outdated
@@ -120,22 +125,19 @@ function testAddress() { | |||
} | |||
|
|||
function testPeer() { | |||
login(masterAccount); | |||
waitForElemAndCheckItsText('.peer md-select-value .md-text', 'localhost:4000'); | |||
expect(element.all(by.css('form md-select md-select-value span:first-child')).get(0).getText()).toEqual('Choose your network node'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't work if you run only this one because you first need to launchApp();
src/app/components/top/top.pug
Outdated
md-select(ng-model='$ctrl.$peers.currentPeerConfig', aria-label='Peer') | ||
md-optgroup(ng-repeat='(name, peers) in $ctrl.$peers.stack', ng-if='peers.length', label='{{ name }}') | ||
md-option(ng-repeat='peer in peers', ng-value='peer') {{ peer.node }}{{ peer.port ? ':' + peer.port : '' }} | ||
div.address.value {{ $ctrl.$peers.currentPeerConfig.node }}:{{ $ctrl.$peers.currentPeerConfig.port }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.address class shouldn't be here, it causes this warning in e2e tests:
W/element - more than one element found for locator By(css selector, .address) - the first result will be used
I think we should try to fix at least. Or at least find out why it is broken specifically on Safari. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -95,6 +95,7 @@ module.exports = function (config) { | |||
// If true, Karma captures browsers, runs the tests and exits | |||
singleRun: !opts.live, | |||
client: { | |||
captureConsole: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
src/package.json
Outdated
@@ -52,7 +52,7 @@ | |||
"jasmine-spec-reporter": "^3.2.0", | |||
"jit-grunt": "=0.10.0", | |||
"json-loader": "=0.5.4", | |||
"karma": "^1.5.0", | |||
"karma": "1.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=1.4.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.5.0 has some bugs, according to the authors
src/spec/spec.js
Outdated
@@ -83,11 +84,15 @@ function testNewAccount() { | |||
launchApp(); | |||
|
|||
element.all(by.css('.md-button.md-primary')).get(0).click(); | |||
/** | |||
* To generate a random pattern of mousemove events, we're randomizing the x,y pairs that | |||
* based on even/odd valkuds of i will locate right/left halves of screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling and grammar.
/**
* To generate a random pattern of mousemove events, we are randomizing the x,y pairs that
* based on even/odd values we locate the right/left halves of the screen
*/
@@ -67,6 +72,29 @@ describe('Login controller', () => { | |||
controller.passphrase = ''; | |||
}); | |||
|
|||
describe('controller()', () => { | |||
it('Should define a watcher for $ctrl.$peers.currentPeerConfig', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should
expect(spy).to.have.been.calledWith(); | ||
}); | ||
|
||
it('Should be able to change the active peer', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should
@@ -16,6 +16,7 @@ const PATHS = { | |||
}; | |||
|
|||
const common = { | |||
devtool: 'source-map', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
src/app/components/login/login.pug
Outdated
form(ng-submit='$ctrl.doTheLogin()') | ||
md-input-container.md-block(md-is-error='$ctrl.valid === 0') | ||
label Enter your passphrase | ||
label.select Choose your network node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would phrase it as: Choose a peer
.
Also, upon logging in, the selection is referred to as a "Peer", not a node.
I'm happy to see either or, as long as the terminology is consistently applied.
I'm not sure if the interpolation issue with the active peer is related to this ticket. based on the templates I suppose such issue must happen in many cases. besides, we're using interpolation markup in many cases, taking in to account that it uses watchers, replacing it with ngBind, ngValue and other directives can help improve performance. |
…om/LiskHQ/lisk-nano into 89-move-network-selection-to-login
@Tosch110 @slaweet @alihaghighatkhah: If there is a failure to connect to a selected peer, then the current behaviour results in a another mainnet node being selected. Even if localhost or testnet peer is chosen. I think this should be fixed in: |
42d8b65
to
c72a85d
Compare
Changes made:
Closes #89