Skip to content

Commit

Permalink
Merge branch '0.2.0' into 426-fix-failing-wallet-test
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Mar 2, 2018
2 parents 3a46510 + 58534fd commit f29aa09
Show file tree
Hide file tree
Showing 19 changed files with 555 additions and 363 deletions.
4 changes: 2 additions & 2 deletions src/components/backgroundMaker/index.js
@@ -1,8 +1,8 @@
import React from 'react';
import styles from './backgroundMaker.css';

const BackgroundMaker = () => (
<div className={styles.stageStripes}>
const BackgroundMaker = ({ className }) => (
<div className={`${styles.stageStripes} ${className}`}>
<span className={styles.stageStripe}></span>
<span className={styles.stageStripe}></span>
<span className={styles.stageStripe}></span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/index.js
Expand Up @@ -14,7 +14,7 @@ class Dashboard extends React.Component {
render() {
const { transactions, t } = this.props;
return <div className={`${grid.row} ${styles.wrapper}`}>
<div className={`${grid['col-md-8']} ${grid['col-xs-12']} ${styles.colHack}`}>
<div className={`${grid['col-md-8']} ${grid['col-xs-12']} ${styles.main}`}>
<Box className={`${styles.graph}`}>
<CurrencyGraph />
</Box>
Expand Down
7 changes: 6 additions & 1 deletion src/components/dashboard/styles.css
Expand Up @@ -4,6 +4,11 @@
width: 100%;
}

.main {
max-height: 75vh; /* stylelint-disable-line */
overflow: auto;
}

.seeAllLink {
font-size: 15px;
color: var(--color-primary-standard);
Expand Down Expand Up @@ -49,7 +54,7 @@

@media (--medium-viewport) {
.wrapper {
& .colHack {
& .main {
padding: 0;
max-width: 100%;
flex-basis: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/components/passphrase/create/index.js
Expand Up @@ -172,7 +172,7 @@ class Create extends React.Component {
const { t, nextStep } = this.props;
const { shapes } = this.state;
const percentage = this.state.data ? this.state.data.percentage : 0;
const hintTitle = this.isTouchDevice ? 'by tilting you device.' : 'by moving your mouse.';
const hintTitle = this.isTouchDevice ? 'by tilting your device.' : 'by moving your mouse.';

return (
<section className={`${grid.row} ${grid['center-xs']} ${styles.wrapper} ${styles.generation}`} id="generatorContainer" >
Expand Down
2 changes: 1 addition & 1 deletion src/components/resultBox/resultBox.js
Expand Up @@ -25,7 +25,7 @@ class ResultBox extends React.Component {
: <FontIcon value='error' className={styles.icon}/>
}
</div>
<h2>{this.props.title}</h2>
<h2 className='result-box-header'>{this.props.title}</h2>
</header>

<p className='result-box-message'>
Expand Down
11 changes: 9 additions & 2 deletions src/components/savedAccounts/savedAccounts.css
Expand Up @@ -206,7 +206,7 @@
}

.addAcctiveAccountButton {
position: absolute;
position: absolute !important;
bottom: 100px;
left: 50%;
transform: translateX(-50%);
Expand Down Expand Up @@ -305,6 +305,13 @@
}
}

.background {
display: block !important;
position: fixed !important;
left: 0;
top: 0;
}

@media (--small-viewport) {
.wrapper {
& > h1 {
Expand Down Expand Up @@ -333,7 +340,7 @@

.deviceIos {
& .addAcctiveAccountButton {
bottom: 20vh; /* stylelint-disable-line */
bottom: 95px; /* stylelint-disable-line */
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/savedAccounts/savedAccounts.js
Expand Up @@ -75,7 +75,7 @@ class SavedAccounts extends React.Component {

return (
<div className={`${styles.wrapper} save-account`}>
<BackgroundMaker />
<BackgroundMaker className={styles.background} />
<h1>
{t('Your favorite Lisk IDs')}
</h1>
Expand Down
6 changes: 3 additions & 3 deletions src/components/send/index.js
@@ -1,4 +1,4 @@
import React from 'react';
import React, { Fragment } from 'react';
import { translate } from 'react-i18next';

import { FontIcon } from '../fontIcon';
Expand Down Expand Up @@ -28,7 +28,7 @@ class Send extends React.Component {
render() {
const { t } = this.props;
return (
<div>
<Fragment>
<span className={styles.mobileMenu}>
<span className={`send-menu-item ${styles.mobileMenuItem}`}
onClick={this.setSendIsActive.bind(this, true)}>
Expand All @@ -51,7 +51,7 @@ class Send extends React.Component {
<ResultBox />
</MultiStep>
</Box>
</div>
</Fragment>
);
}
}
Expand Down
42 changes: 1 addition & 41 deletions test/e2e/voting.feature
Expand Up @@ -24,14 +24,6 @@ Feature: Voting page
Then I should see 0 instances of "delegate row"
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"
And I wait 0.1 seconds
When I go to "main/voting/"
And I click "filter voted"
Then I should see 100 instances of "delegate row"

@testnet
Scenario: should allow to select delegates in the "Voting" tab and vote for them
Given I'm logged in as "delegate candidate"
Expand All @@ -58,19 +50,7 @@ Feature: Voting page
And I click "confirm"
And I wait 0.5 seconds
Then I should see text "You’re votes are being processed and will be confirmed. It may take up to 10 minutes to be secured in the blockchain." in "result box message" element

@integration
Scenario: should allow to remove votes form delegates
Given I'm logged in as "genesis"
And I wait 0.1 seconds
When I go to "main/voting/"
And I click checkbox on list item no. 3
And I click checkbox on list item no. 5
And I click "next"
And I click "confirm"
And I wait 0.5 seconds
Then I should see text "You’re votes are being processed and will be confirmed. It may take up to 10 minutes to be secured in the blockchain." in "result box message" element


Scenario: should allow to select delegates by URL
Given I'm logged in as "delegate candidate"
When I go to "/main/voting/vote?votes=standby_27,standby_28,standby_29,nonexisting_22&unvotes=standby_33"
Expand All @@ -84,23 +64,3 @@ Feature: Voting page
standby_2[789]
standby_2[789]
"""

@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 "voting" menu
And I click "vote button"
And Search twice for "genesis_7" in vote dialog
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
@pending
Scenario: should not allow to vote if not enough funds for the fee
Given I'm logged in as "empty account"
When I go to "main/voting/"
And I click checkbox on list item no. 3
And I click "vote button"
Then I should see "Insufficient funds for 1 LSK fee" error message
And "submit button" should be disabled
32 changes: 10 additions & 22 deletions test/integration/accountSwitch.test.js
@@ -1,5 +1,4 @@
import { step } from 'mocha-steps';
import { expect } from 'chai';
import { stub, match } from 'sinon';
import { mount } from 'enzyme';
import thunk from 'redux-thunk';
Expand All @@ -16,11 +15,12 @@ import savedAccountsReducer from '../../src/store/reducers/savedAccounts';
import SavedAccounts from '../../src/components/savedAccounts';
import * as accountApi from '../../src/utils/api/account';
import * as peers from '../../src/utils/api/peers';
import { click } from './steps';
import GenericStepDefinition from '../utils/genericStepDefinition';

describe('@integration: Account switch', () => {
let store;
let wrapper;
let helper;
let getAccountStub;
let requestToActivePeerStub;
let localStorageStub;
Expand Down Expand Up @@ -74,33 +74,21 @@ describe('@integration: Account switch', () => {
wrapper = mount(renderWithRouter(SavedAccounts, store));
store.dispatch(accountsRetrieved());
wrapper.update();
};

const clickStep = (elementName) => {
click(wrapper, elementName);
};

const shouldSeeCountInstancesOf = (count, elementName) => {
const selector = `.${elementName.replace(/ /g, '-')}`;
expect(wrapper.find(selector)).to.have.lengthOf(count);
};

const shouldBeLoggedInAs = (accountName) => {
expect(store.getState().account.publicKey).to.equal(accounts[accountName].publicKey);
helper = new GenericStepDefinition(wrapper, store);
};

describe('Scenario: should allow to remove a saved account', () => {
step('Given I\'m on "account switcher" with accounts: "genesis,delegate,empty account"', setupStep);
step('Then I should see 3 instances of "saved account card"', shouldSeeCountInstancesOf.bind(null, 3, 'saved account card'));
step('When I click "edit button"', clickStep.bind(null, 'edit button'));
step('When I click "remove button"', clickStep.bind(null, 'remove button'));
step('When I click "remove button"', clickStep.bind(null, 'remove button'));
step('Then I should see 2 instances of "saved account card"', shouldSeeCountInstancesOf.bind(null, 2, 'saved account card'));
step('Then I should see 3 instances of "saved account card"', () => helper.shouldSeeCountInstancesOf(3, '.saved-account-card'));
step('When I click "edit button"', () => helper.clickOnElement('button.edit-button'));
step('When I click "remove button"', () => helper.clickOnElement('button.remove-button'));
step('When I click "remove button"', () => helper.clickOnElement('button.remove-button'));
step('Then I should see 2 instances of "saved account card"', () => helper.shouldSeeCountInstancesOf(2, '.saved-account-card'));
});

describe('Scenario: should allow to switch account', () => {
step('Given I\'m on "account switcher" with accounts: "genesis,delegate,empty account"', setupStep);
step('When I click "saved account card"', clickStep.bind(null, 'saved account card'));
step('Then I should be logged in as "genesis" account', shouldBeLoggedInAs.bind(null, 'genesis'));
step('When I click "saved account card"', () => helper.clickOnElement('.saved-account-card'));
step('Then I should be logged in as "genesis" account', () => helper.shouldBeLoggedInAs(accounts.genesis.publicKey));
});
});
59 changes: 28 additions & 31 deletions test/integration/accountTransactions.test.js
Expand Up @@ -20,10 +20,24 @@ import getNetwork from './../../src/utils/getNetwork';
import { accountLoggedIn } from '../../src/actions/account';
import AccountTransactions from './../../src/components/accountTransactions';
import accounts from '../constants/accounts';
import { click } from './steps';
import GenericStepDefinition from '../utils/genericStepDefinition';

class Helper extends GenericStepDefinition {
checkSelectedFilter(filter) {
const expectedClass = '_active';

const activeFilter = this.wrapper.find('.transaction-filter-item').filterWhere((item) => {
const className = item.prop('className');
return className.includes(expectedClass);
});

expect(activeFilter.text().toLowerCase()).to.equal(filter);
}
}

describe('@integration: Account Transactions', () => {
let store;
let helper;
let wrapper;
let requestToActivePeerStub;
let accountAPIStub;
Expand Down Expand Up @@ -86,45 +100,28 @@ describe('@integration: Account Transactions', () => {
if (accountType) { store.dispatch(accountLoggedIn(account)); }
wrapper = mount(renderWithRouter(AccountTransactions, store,
{ match: { params: { address } } }));
};

const clickStep = (elementName) => {
click(wrapper, elementName);
};

const checkRowCount = (length) => {
expect(wrapper.find('TransactionRow')).to.have.length(length);
};

const checkSelectedFilter = (filter) => {
const expectedClass = '_active';

const activeFilter = wrapper.find('.transaction-filter-item').filterWhere((item) => {
const className = item.prop('className');
return className.includes(expectedClass);
});

expect(activeFilter.text().toLowerCase()).to.equal(filter);
helper = new Helper(wrapper, store);
};

describe('Scenario: should allow to view transactions of any account', () => {
step('Given I\'m on "accounts/123L" as "genesis" account', setupStep.bind(null, { accountType: 'genesis', address: '123L' }));
step('Then I should see 20 transaction rows as result of the address 123L', checkRowCount.bind(null, 20));
step('Given I\'m on "accounts/123L" as "genesis" account', () => setupStep({ accountType: 'genesis', address: '123L' }));
step('Then I should see 20 transaction rows as result of the address 123L', () => helper.shouldSeeCountInstancesOf(20, 'TransactionRow'));
});

describe('Scenario: should allow to filter transactions', () => {
step('Given I\'m on "wallet" as "genesis" account', setupStep.bind(null, { accountType: 'genesis', address: '123L' }));
step('Then the "All" filter should be selected by default', checkSelectedFilter.bind(null, 'all'));
step('When I click on the "Outgoing" filter', clickStep.bind(null, 'filter out'));
step('Then I expect to see the results for "Outgoing"', checkRowCount.bind(null, 5));
step('When I click on the "Incoming" filter', clickStep.bind(null, 'filter in'));
step('Then I expect to see the results for "Incoming"', checkRowCount.bind(null, 15));
step('When I click again on the "All" filter', clickStep.bind(null, 'filter all'));
step('Then I expect to see the results for "All"', checkRowCount.bind(null, 20));
step('Given I\'m on "wallet" as "genesis" account', () => setupStep({ accountType: 'genesis', address: '123L' }));
step('Then the "All" filter should be selected by default', () => helper.checkSelectedFilter('all'));
step('When I click on the "Outgoing" filter', () => helper.clickOnElement('.filter-out'));
step('Then I expect to see the results for "Outgoing"', () => helper.shouldSeeCountInstancesOf(5, 'TransactionRow'));
step('When I click on the "Incoming" filter', () => helper.clickOnElement('.filter-in'));
step('Then I expect to see the results for "Incoming"', () => helper.shouldSeeCountInstancesOf(15, 'TransactionRow'));
step('When I click again on the "All" filter', () => helper.clickOnElement('.filter-all'));
step('Then I expect to see the results for "All"', () => helper.shouldSeeCountInstancesOf(20, 'TransactionRow'));
});

describe('Scenario: allows to view transactions without login', () => {
step('Given I\'m on "accounts/123L" with no account', setupStep.bind(null, { address: '123L' }));
step('Then I should see 20 transaction rows as result of the address 123L', checkRowCount.bind(null, 20));
step('Given I\'m on "accounts/123L" with no account', () => setupStep({ address: '123L' }));
step('Then I should see 20 transaction rows as result of the address 123L', () => helper.shouldSeeCountInstancesOf(20, 'TransactionRow'));
});
});

0 comments on commit f29aa09

Please sign in to comment.