Skip to content

Commit

Permalink
#112: The option to add an address should be always visible: fixed br…
Browse files Browse the repository at this point in the history
…oken e2e tests and add add additional e2e tests.
  • Loading branch information
AndreiIarovoi committed May 14, 2018
1 parent a6eb063 commit a5a8ff8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
13 changes: 13 additions & 0 deletions e2e/wallets.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,17 @@ describe('Wallets', () => {
page.navigateTo();
expect<any>(page.canUnlock()).toEqual(true);
});

it('should always display add new address button for the wallet', () => {
page.navigateTo();
expect<any>(page.showAddAddress()).toEqual(true);
});

it('should display unlock wallet component on add new address for locked wallet', () => {
expect<any>(page.showShowUnlockWallet()).toEqual(true);
});

it('should unlock wallet component on add new address for locked wallet', () => {
expect<any>(page.unlockWallet()).toEqual(true);
});
});
35 changes: 30 additions & 5 deletions e2e/wallets.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ export class WalletsPage {
const btnCreate = element(by.buttonText('Create'));

label.clear();
label.sendKeys('Test wallet');
label.sendKeys('Test create wallet');
seed.clear();
seed.sendKeys('skycoin-web-e2e-test-seed');
seed.sendKeys('skycoin-web-e2e-test-create-wallet-seed');
confirm.clear();
confirm.sendKeys('skycoin-web-e2e-test-seed');
confirm.sendKeys('skycoin-web-e2e-test-create-wallet-seed');
return btnCreate.isEnabled().then(status => {
if (status) {
btnCreate.click();
Expand Down Expand Up @@ -160,8 +160,9 @@ export class WalletsPage {
}

hideEmptyAddress() {
return element(by.css('.-btn-minus')).click().then(() => {
return element.all(by.css('.coins-column')).filter((address) => {
return element.all(by.css('.-btn-minus')).first().click().then(() => {
const parentWalletElement = element.all(by.css('.-wallet-detail')).first();
return parentWalletElement.all(by.css('.coins-column')).filter((address) => {
return address.getText().then(value => {
return value === '0';
});
Expand Down Expand Up @@ -223,6 +224,30 @@ export class WalletsPage {
});
}

showAddAddress() {
return element.all(by.css('.-expand.rotate-90')).first().click().then(() => {
return element(by.css('.btn-add-address')).isPresent();
});
}

showShowUnlockWallet() {
return element(by.css('.btn-add-address')).click().then(() => {
return element(by.css('app-unlock-wallet')).isPresent();
});
}

unlockWallet() {
const seed = element(by.css('[formcontrolname="seed"]'));
seed.clear();
seed.sendKeys('skycoin-web-e2e-test-seed');

return element(by.buttonText('Unlock')).click().then(() => {
return (element(by.css('app-unlock-wallet')).isPresent()).then((result) => {
return !result;
});
});
}

showPriceInformation() {
return element(by.css('.balance p.dollars')).getText().then(text => {
return this._checkHeaderPriceFormat(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ng-container>
<div class="-actions">
<div class="-button" (click)="onAddNewAddress()">
<div class="-btn-plus">
<div class="-btn-plus btn-add-address">
<img src="../../../../../assets/img/plus-grey.png">
<span>New Address</span>
</div>
Expand Down

0 comments on commit a5a8ff8

Please sign in to comment.