Skip to content

Commit

Permalink
Merge pull request #1340 from LiskHQ/1335-e2e-for-activity
Browse files Browse the repository at this point in the history
E2E for activity - Closes #1335
  • Loading branch information
Efefefef authored Oct 12, 2018
2 parents ff3591f + e7fee85 commit ec56c39
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/sendTo/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SendTo extends React.Component {
};

return (<Box className={`${styles.wrapper} ${grid.row}`}>
<section className={styles.content}>
<section className={`${styles.content} explorer-account-left-block`}>
<div className={`
${grid['col-xs-12']}
${grid['col-sm-7']}
Expand Down Expand Up @@ -60,7 +60,7 @@ class SendTo extends React.Component {
`}>
<h2>
<span>
<LiskAmount val={account.balance}/>
<LiskAmount val={account.balance} className={'balance'}/>
<small className={styles.balanceUnit}>LSK</small>
</span>
</h2>
Expand Down
1 change: 1 addition & 0 deletions test/constants/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const urls = {
wallet: '/wallet',
help: '/help',
settings: '/settings',
accounts: '/explorer/accounts',
};

export default urls;
117 changes: 117 additions & 0 deletions test/cypress/e2e/activity.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import accounts from '../../constants/accounts';
import networks from '../../constants/networks';
import urls from '../../constants/urls';

const ss = {
transactoinsTable: '.transaction-results',
transactionRow: '.transactions-row',
seeAllBtn: '.seeAllLink',
transactionDetailBackButton: '.transaction-details-back-button',
recipientInput: '.recipient input',
accountInfoTab: '.account-info',
votedAdress: '.voter-address',
delegateName: '.delegate-name',
searchInput: '#autosuggest-input',
showMoreVotesBtn: '.show-votes',
};

beforeEach(() => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
});

/**
* To remove the effect of activating the All tab back after full load
*/
const waitBeforeChangeTabAfterLoading = () => cy.wait(1000);

describe('Dashboard Activity', () => {
describe('Latest activity', () => {
it('5 tx are shown', () => {
cy.visit(urls.dashboard);
cy.get(ss.transactionRow).should('have.length', 5);
});

it('Click leads to tx details', () => {
cy.visit(urls.dashboard);
cy.get(ss.transactionRow).eq(0).click();
cy.url().should('contain', 'wallet?id=');
cy.get(ss.transactionDetailBackButton);
});

it('See all leads to wallet activity', () => {
cy.visit(urls.dashboard);
cy.get(ss.seeAllBtn).click();
cy.url().should('contain', 'wallet');
cy.get(ss.recipientInput);
});
});

[
{
name: 'Wallet Activity',
open: () => cy.visit(urls.wallet),
},
// TODO: unskip after #1339
// {
// name: 'Account Activity opened by direct link',
// open: () => cy.visit(`${urls.accounts}/${accounts.genesis.address}`),
// },
{
name: 'Account Activity opened from search',
open: () => {
cy.get(ss.searchInput).click().type(`${accounts.genesis.address}{enter}`);
},
},
].forEach((testSet) => {
describe(testSet.name, () => {
it('25 tx are shown, scrolling loads another 25', () => {
testSet.open();
cy.get(ss.transactionRow).should('have.length', 25);
cy.get('.transaction-results').scrollTo('bottom');
cy.get('.transactions-row').should('have.length', 50);
});

it('Click leads to tx details', () => {
testSet.open();
cy.get(ss.transactionRow).eq(0).click();
cy.url().should('contain', '?id=');
cy.get(ss.transactionDetailBackButton);
});

describe('Account info tab for non-delegate', () => {
beforeEach(() => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
});
it('Shows 101 votes', () => {
testSet.open();
waitBeforeChangeTabAfterLoading();
cy.get(ss.accountInfoTab).click();
cy.get(ss.showMoreVotesBtn).click();
cy.get(ss.votedAdress).should('have.length', 101);
});

it('Shows voted delegate nickname ', () => {
testSet.open();
waitBeforeChangeTabAfterLoading();
cy.get(ss.accountInfoTab).click();
cy.get(ss.votedAdress).eq(0).should('have.text', 'genesis_1 ');
});

it('Click on voted delegate leads to account page', () => {
testSet.open();
waitBeforeChangeTabAfterLoading();
cy.get(ss.accountInfoTab).click();
cy.get(ss.votedAdress).eq(0).click();
cy.get(ss.delegateName).should('have.text', 'genesis_1');
});
});

describe('Delegate statistics tab for delegate', () => {
beforeEach(() => {
cy.autologin(accounts.delegate.passphrase, networks.devnet.node);
});
// TODO Create after #1336 fix
});
});
});
});
12 changes: 0 additions & 12 deletions test/cypress/e2e/ex-protractor-cucumber/send.spec.js

This file was deleted.

0 comments on commit ec56c39

Please sign in to comment.