Skip to content

Commit

Permalink
Merge pull request #623 from LiskHQ/583-account-switcher-integration-…
Browse files Browse the repository at this point in the history
…test-fails-randomly

Account switcher integration test fails randomly - Closes #583
  • Loading branch information
faival authored Mar 29, 2018
2 parents 74091cf + 4dc0a95 commit b3ab308
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/savedAccounts/accountCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const AccountCard = ({ account, t, isEditing, handleRemove, isSecureAppears,
null
}
{ isEditing ?
<PrimaryButton className='remove-button'
<PrimaryButton className={isSelectedForRemove(account) ? 'confirm-button' : 'remove-button'}
theme={ isSelectedForRemove(account) ?
{} :
{ button: styles.removeButton }
Expand Down
2 changes: 1 addition & 1 deletion src/components/savedAccounts/savedAccounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('SavedAccounts', () => {
it('should call props.accountRemoved on the second "remove button" click', () => {
wrapper.find('button.edit-button').simulate('click');
wrapper.find('button.remove-button').at(1).simulate('click');
wrapper.find('button.remove-button').at(1).simulate('click');
wrapper.find('button.confirm-button').at(0).simulate('click');
expect(props.accountRemoved).to.have.been.calledWith(savedAccounts[1]);
});

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/savedAccounts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Feature: Saved Accounts
And I should see 2 instances of "saved account card"
And I click "edit button"
And I click "remove button"
And I click "remove button"
And I click "confirm button"
And I click "edit button"
Then I should see 1 instances of "saved account card"

Expand Down
4 changes: 2 additions & 2 deletions test/integration/accountSwitch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('@integration: Account switch', () => {
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('When I click "confirm button"', () => helper.clickOnElement('button.confirm-button'));
step('Then I should see 2 instances of "saved account card"', () => helper.shouldSeeCountInstancesOf(2, '.saved-account-card'));
});

Expand All @@ -105,7 +105,7 @@ describe('@integration: Account switch', () => {
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('When I click "confirm button"', () => helper.clickOnElement('button.confirm-button'));
step('Then I should see 2 instances of "saved account card"', () => helper.shouldSeeCountInstancesOf(2, '.saved-account-card'));
});

Expand Down
2 changes: 1 addition & 1 deletion test/utils/genericStepDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ export default class GenericStepDefinition {
* @param {String} selector - Valid css selector
*/
shouldSeeCountInstancesOf(count, selector) {
expect(this.wrapper.find(selector)).to.have.lengthOf(count);
expect(this.wrapper).to.have.exactly(count).descendants(selector);
}
}

0 comments on commit b3ab308

Please sign in to comment.