From a5a8ff8e5d0316acea173921a791bf9fd49f47ed Mon Sep 17 00:00:00 2001 From: "SU\\andrei.iarovoi" Date: Mon, 14 May 2018 16:21:45 +0300 Subject: [PATCH] #112: The option to add an address should be always visible: fixed broken e2e tests and add add additional e2e tests. --- e2e/wallets.e2e-spec.ts | 13 +++++++ e2e/wallets.po.ts | 35 ++++++++++++++++--- .../wallet-detail.component.html | 2 +- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/e2e/wallets.e2e-spec.ts b/e2e/wallets.e2e-spec.ts index 05a169c5..3805bdd8 100644 --- a/e2e/wallets.e2e-spec.ts +++ b/e2e/wallets.e2e-spec.ts @@ -84,4 +84,17 @@ describe('Wallets', () => { page.navigateTo(); expect(page.canUnlock()).toEqual(true); }); + + it('should always display add new address button for the wallet', () => { + page.navigateTo(); + expect(page.showAddAddress()).toEqual(true); + }); + + it('should display unlock wallet component on add new address for locked wallet', () => { + expect(page.showShowUnlockWallet()).toEqual(true); + }); + + it('should unlock wallet component on add new address for locked wallet', () => { + expect(page.unlockWallet()).toEqual(true); + }); }); diff --git a/e2e/wallets.po.ts b/e2e/wallets.po.ts index 52dd314c..6c22ed86 100644 --- a/e2e/wallets.po.ts +++ b/e2e/wallets.po.ts @@ -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(); @@ -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'; }); @@ -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); diff --git a/src/app/components/pages/wallets/address-detail/wallet-detail.component.html b/src/app/components/pages/wallets/address-detail/wallet-detail.component.html index e3e84e65..de88fe64 100644 --- a/src/app/components/pages/wallets/address-detail/wallet-detail.component.html +++ b/src/app/components/pages/wallets/address-detail/wallet-detail.component.html @@ -13,7 +13,7 @@
-
+
New Address