diff --git a/test/e2e/account-public.controller.spec.js b/test/e2e/account-public.controller.spec.js deleted file mode 100644 index 4e4a93c5f..000000000 --- a/test/e2e/account-public.controller.spec.js +++ /dev/null @@ -1,91 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); - - -chai.use(chaiAsPromised); -var expect = chai.expect; - - -describe('public account', function() { - - before(function(){ - helperForms.login(config.user.username,config.user.password); - }); - - - function pressRenameSubmit() { - return $("form[name='renameForm'] button[type='submit']") - .click().then( - helperBrowser.waitForElementToDisplay.bind(this, $("div.showPublic div.alert-success")) - ); - } - - function waitForRenameSubmitButtonBecameAvailable() { - return helperBrowser.waitForElementToBecameAvailable($("form[name='renameForm'] button[type='submit']")); - } - - it('should show public account page', function(done) { - browser.get('#/account/public'); - - // Wait for the page to render - helperBrowser.waitForElementToDisplay($('#address')); - - expect($('.username').getText()).to.eventually.equal('~' + config.user.username) - .and.notify(done); - }); - - it('should show rename user controls', function(done) { - $('div.edit-account-btn-wrapper a').click(); - - expect($('#renameForm').isDisplayed()) - .to.eventually.be.true; - - expect($('#address').isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - - it('should allow to rename user', function(done) { - $('#username').sendKeys(config.user.username + '-E2E'); - $('#password').sendKeys(config.user.password); - - waitForRenameSubmitButtonBecameAvailable(); - - expect($("form[name='renameForm'] button[type='submit']").getAttribute('disabled')) - .to.eventually.be.null - .and.notify(done); - }); - - - it('should rename user', function(done) { - protractor.getInstance().ignoreSynchronization = true; - - pressRenameSubmit(); - - expect($('.username').getText()).to.eventually.equal('~' + config.user.username + '-E2E') - .and.notify(done); - }); - - it('should rename user back', function(done) { - $('div.edit-account-btn-wrapper a').click(); - - $('#username').sendKeys(config.user.username); - $('#password').sendKeys(config.user.password); - - waitForRenameSubmitButtonBecameAvailable(); - - pressRenameSubmit(); - - expect($('.username').getText()).to.eventually.equal('~' + config.user.username) - .and.notify(done); - }); - -}); diff --git a/test/e2e/gateway-advanced.controller.spec.js b/test/e2e/gateway-advanced.controller.spec.js deleted file mode 100644 index 9a7e4ccad..000000000 --- a/test/e2e/gateway-advanced.controller.spec.js +++ /dev/null @@ -1,126 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); -var TrustPage = require('./pages/trustPage.js'); -var AdvancedPage = require('./pages/advancedPage.js'); - - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('gateway advanced', function() { - - var trustPage; - var advancedPage; - - before(function(){ - helperForms.login(config.user.username,config.user.password); - trustPage = new TrustPage(); - advancedPage = new AdvancedPage(); - advancedPage.goTo(); - }); - - it('should show advanced settings page', function(done) { - helperBrowser.waitForElementToDisplay(advancedPage.editAdvancedSettingsButton).then(done); - }); - - it('should show trust line advanced settings edit control', function(done) { - advancedPage.editAdvancedSettingsButton.click(). - then(helperBrowser.waitForElementToDisplay.bind(this, advancedPage.showAdvancedOptionsInput)). - then(done); - }); - - it('should save trust line advanced settings show on', function(done) { - advancedPage.showAdvancedOptionsInput.click(). - then(advancedPage.saveAdvancedSettingsButton.click). - then(helperBrowser.waitForElementToDisplay.bind(this, advancedPage.advancedSettingsShowHolder)). - then(done); - }); - - it('should show gateways page', function(done) { - trustPage.goTo(); - - helperBrowser.waitForElementToDisplay(trustPage.connectGatewayButton).then(done); - }); - - it('should show add gateway user controls', function(done) { - trustPage.connectGatewayButton.click(); - - expect(trustPage.gatewayAddressInput.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should show trust amount input field', function(done) { - expect(trustPage.gatewayTrustAmountInput.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should connect a gateway using Ripple address', function(done) { - var self = this; - trustPage.putAddressAdvanced(config.gateway.address, 'USD', "1000"). - then(trustPage.connectGatewaySubmit.bind(trustPage, config.user.password)). - then(done); - }); - - it('should show gateway', function(done) { - expect(trustPage.usdGatewayTitle).to.eventually.equal('USD - US Dollar') - .and.notify(done); - }); - - it('should show edit limit input', function(done) { - trustPage.usdGatewayEditButton.click(). - then(helperBrowser.waitForElementToDisplay.bind(this, trustPage.editLimitInput)). - then(done); - }); - - it('should show new limit', function(done) { - trustPage.editLimitInput.clear(). - then(function () { - trustPage.editLimitInput.sendKeys('200'); - }). - then(function() { - protractor.getInstance().ignoreSynchronization = true; - return trustPage.usdGatewaySaveButton.click(); - }).then(helperBrowser.waitForElement.bind(this, trustPage.changesSavedHolder)). - then(function() { - expect(trustPage.usdGatewayLimitHolder.getText()).to.eventually.equal('200.00') - .and.notify(done); - }); - }); - - it('should remove a gateway', function(done) { - trustPage.usdGatewayEditButton.click(). - then(trustPage.usdGatewayAdvancedDeleteButton.click). - then(helperBrowser.waitForElement.bind(this, trustPage.gatewayRemovedHolder)). - then(function() { - advancedPage.goTo(); - done(); - }); - }); - - it('should show advanced settings page 2', function(done) { - helperBrowser.waitForElementToDisplay(advancedPage.editAdvancedSettingsButton).then(done); - }); - - it('should show trust line advanced settings edit control 2', function(done) { - advancedPage.editAdvancedSettingsButton.click(). - then(helperBrowser.waitForElementToDisplay.bind(this, advancedPage.showAdvancedOptionsInput)). - then(done); - }); - - it('should save trust line advanced settings show off', function(done) { - advancedPage.showAdvancedOptionsInput.click(). - then(advancedPage.saveAdvancedSettingsButton.click). - then(helperBrowser.waitForElementToDisplay.bind(this, advancedPage.advancedSettingsHideHolder)). - then(done); - }); - -}); diff --git a/test/e2e/gateway-simple.controller.spec.js b/test/e2e/gateway-simple.controller.spec.js deleted file mode 100644 index f228d18e7..000000000 --- a/test/e2e/gateway-simple.controller.spec.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); -var TrustPage = require('./pages/trustPage.js'); - - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('gateway simple', function() { - - var page; - - before(function(){ - helperForms.login(config.user.username,config.user.password); - page = new TrustPage(); - page.goTo(); - }); - - it('should show gateways page', function(done) { - helperBrowser.waitForElementToDisplay(page.connectGatewayButton).then(done); - // hack. check if trust line advanced settings is on - than gatewayAdvanced - // $('#trust_counterparty').evaluate('advanced_feature_switch').then(function(on) { - // if (on) { - // $('#trust_counterparty').evaluate('advanced_feature_switch = true;'); - // } - // }); - }); - - it('should show add gateway user controls', function(done) { - page.connectGatewayButton.click(); - - // $('#trust_counterparty').evaluate('advanced_feature_switch').then(function(r) { }); - expect(page.gatewayAddressInput.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should connect a gateway using Ripple address', function(done) { - page.connectGateway(config.gateway.address, 'USD', config.user.password).then(done); - }); - - it('should show gateway', function(done) { - // protractor.getInstance().ignoreSynchronization = false; - expect(page.usdGatewayTitle).to.eventually.equal('USD - US Dollar') - .and.notify(done); - }); - - it('should remove a gateway', function(done) { - page.removeGateway('USD').then(done); - }); - - it('should show add gateway user controls (by name)', function(done) { - page.connectGatewayButton.click(); - - expect(page.gatewayAddressInput.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should connect a gateway using Ripple name', function(done) { - page.connectGateway(config.gateway.name, 'USD', config.user.password).then(done); - }); - - it('should show USD gateway', function(done) { - expect(page.usdGatewayTitle).to.eventually.equal('USD - US Dollar') - .and.notify(done); - }); - - it('should remove a USD gateway', function(done) { - page.removeGateway('USD').then(done); - }); - - it('should show add gateway user controls (fake currency)', function(done) { - page.connectGatewayButton.click().then(function() { - expect(page.gatewayAddressInput.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should connect a gateway with fake currency', function(done) { - page.connectGateway(config.gateway.address, config.gateway.fakeCurrency, config.user.password).then(done); - }); - - it('should show gateway with fake currency', function(done) { - expect(page.gatewayTitle(config.gateway.fakeCurrency)).to.eventually.equal(config.gateway.fakeCurrency) - .and.notify(done); - }); - - it('should remove a fake currency gateway', function(done) { - page.removeGateway(config.gateway.fakeCurrency).then(done); - }); - -}); diff --git a/test/e2e/login.controller.spec.js b/test/e2e/login.controller.spec.js deleted file mode 100644 index 73c39a47e..000000000 --- a/test/e2e/login.controller.spec.js +++ /dev/null @@ -1,97 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('bootstrap', function() { - before(function() { - browser.get('/#'); - }); - - it('should automatically redirect to /register when location hash/fragment is empty', function(done) { - helperBrowser.waitForNavigation('/#'); - expect(browser.getCurrentUrl()) - .to.eventually - .contain('/register') - .and.notify(done); - }); -}); - -describe('migration', function() { - - before(function(){ - browser.get('#/migrate'); - }); - - it('should render migrate when user navigates to /migrate', function(done) { - expect($("form[name='loginForm']").getText()) - .to.exist - .and.notify(done); - }); - - it('should take old user to registration page', function(done) { - helperForms.migrate(config.oldUser.username,config.oldUser.password); - - // Check if it takes to the register page - expect(browser.getCurrentUrl()) - .to.eventually - .contain('/register') - .and.notify(done); - }); - -}); - -describe('login', function() { - - before(function(){ - browser.get('#/login'); - }); - - it('should render login when user navigates to /login', function(done) { - expect($("form[name='loginForm']").getText()) - .to.exist - .and.notify(done); - }); - - it('should login a user then change route to /balance', function(done) { - helperForms.login(config.user.username,config.user.password); - - // Check if it takes to the balance page (success login) - expect(browser.getCurrentUrl()) - .to.eventually - .contain('/balance') - .and.notify(done); - }); - - it('should not login a user with wrong password', function(done) { - helperForms.logout(); - browser.get('#/login'); - browser.getCurrentUrl() - .then(function(url){ - // It's already logged in if the page is other then login or register - if (url.match('login') || url.match('register')){ - browser.get('#/login'); - - $(".auth-form-container #login_username").sendKeys(config.user.username); - $(".auth-form-container #login_password").sendKeys("wrongpassword"); - $("#loginBtn").click() - .then(function(){ - var errorMessage = $("form[name='loginForm'] .text-status .backend b"); - helperBrowser.waitForElement(errorMessage); - expect(errorMessage.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - } - }); - }); - -}); diff --git a/test/e2e/myOrders.js b/test/e2e/myOrders.js deleted file mode 100644 index af1a82b0d..000000000 --- a/test/e2e/myOrders.js +++ /dev/null @@ -1,156 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); -var TradePage = require('./pages/tradePage.js'); - - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('My Orders', function() { - - var page; - - before(function(){ - helperForms.login(config.user.username,config.user.password); - page = new TradePage(); - page.goTo(); - }); - - it('should show trade page', function(done) { - helperBrowser.waitForElement(page.myOrdersMsgHolder).then(done); - }); - - it('should set currency pair to XRP/USD.SnapSwap', function(done) { - page.setCurrencyPair('XRP/USD.SnapSwap').then(function() { - helperBrowser.waitForElement(page.sellXRPButton).then(done); - }); - }); - - it('should enable sell button', function(done) { - page.enterOrder(0.0001, 987).then(function () { - helperBrowser.waitForElementToBecameAvailable(page.sellXRPButton).then(done); - }); - }); - - it('should confirm fat finger', function(done) { - page.sellXRPButton.click().then(function () { - helperBrowser.waitForElementToBecameAvailable(page.confirmFatButton).then(done); - }); - }); - - it('should confirm show order', function(done) { - page.confirmOrder(config.user.password).then(done); - }); - - it('should enable sell button 2', function(done) { - page.enterOrder(0.0002, 907).then(function () { - helperBrowser.waitForElementToBecameAvailable(page.sellXRPButton).then(done); - }); - }); - - it('should confirm fat finger 2', function(done) { - page.sellXRPButton.click().then(function () { - helperBrowser.waitForElementToBecameAvailable(page.confirmFatButton).then(done); - }); - }); - - it('should confirm show order 2', function(done) { - page.confirmOrder(config.user.password).then(done); - }); - - it('should sort qty desc', function(done) { - var self = this; - page.qtyHead.click(). - then(browser.sleep.bind(this, 1000)). - then(function () { - page.qty.then(function(items) { - expect(items.length).to.equal(2); - expect(items[0].getText()).to.eventually.equal('0.0002'); - }); - }); - }); - - it('should sort qty asc', function(done) { - page.qtyHead.click(). - then(browser.sleep.bind(this, 1000)). - then(function () { - page.qty.then(function(items) { - expect(items[0].getText()).to.eventually.equal('0.0001'); - }); - }); - }); - - it('should sort limit desc', function(done) { - page.limitHead.click(). - then(browser.sleep.bind(this, 1000)). - then(function () { - page.limit.then(function(items) { - expect(items[0].getText()).to.eventually.equal('987'); - }); - }); - }); - - it('should sort limit asc', function(done) { - page.limitHead.click(). - then(browser.sleep.bind(this, 1000)). - then(function () { - page.limit.then(function(items) { - expect(items[0].getText()).to.eventually.equal('907'); - }); - }); - }); - - it('should set currency pair to XRP/USD.Bitstamp', function(done) { - page.setCurrencyPair('XRP/USD.Bitstamp').then(function() { - helperBrowser.waitForElement(page.sellXRPButton).then(done); - }); - }); - - it('should show current pairs only', function(done) { - helperBrowser.waitForElementToDisplay(page.currentPairOnly). - then(page.currentPairOnly.click). - then(browser.sleep.bind(this, 100)). - then(function() { - page.qty.then(function(items) { - expect(items.length).to.equal(0); - }); - }); - }); - - it('should show orders back', function(done) { - helperBrowser.waitForElementToDisplay(page.currentPairOnly). - then(page.currentPairOnly.click). - then(browser.sleep.bind(this, 100)). - then(function() { - page.qty.then(function(items) { - expect(items.length).to.equal(2); - }); - }); - }); - - it('should cancel all orders', function(done) { - function checkCount() { - page.limit.count().then(function(len) { - if (len == 0) { - done() - } else { - checkCount(); - } - }); - } - - page.cancelAllOrders(config.user.password). - then(browser.sleep.bind(this, 100)). - then(function() { - checkCount(); - }); - }); - -}); diff --git a/test/e2e/pages/advancedPage.js b/test/e2e/pages/advancedPage.js deleted file mode 100644 index c2b9d31ad..000000000 --- a/test/e2e/pages/advancedPage.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var AdvancedPage = function () { - this.editAdvancedSettingsButton = $('form[name="accountsAdvForm"] div[ng-hide="editAcctOptions"] a.btn-cancel'); - this.showAdvancedOptionsInput = $('input[name="acct_adv"]'); - this.saveAdvancedSettingsButton = $('form[name="accountsAdvForm"] #save'); - this.advancedSettingsShowHolder = $('form[name="accountsAdvForm"] div[ng-show="advanced_feature_switch"]'); - this.advancedSettingsHideHolder = $('form[name="accountsAdvForm"] div[ng-hide="advanced_feature_switch"]'); -}; - -AdvancedPage.prototype.goTo = function () { - browser.get('#/advanced'); -} - - -module.exports = AdvancedPage; diff --git a/test/e2e/pages/tradePage.js b/test/e2e/pages/tradePage.js deleted file mode 100644 index 5ae80861e..000000000 --- a/test/e2e/pages/tradePage.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; - -var helperBrowser = require('../utils/browser'); - -var TradePage = function () { - this.myOrdersMsgHolder = $('#myOrdersMsg'); - this.currencyPairInput = $('#currency_pair'); - this.sellXRPButton = $('form[name="tradeForm"] button[btn-type="sell"]'); - this.sellAmountInput = $('form[name="tradeForm"] input[name="amount"][input-type="sell"]'); - this.sellPriceInput = $('form[name="tradeForm"] input[name="price"][input-type="sell"]'); - this.confirmFatButton = $('form.mode-confirm button.submit'); - this.unlockPasswordInput = $("div.modal-dialog #popup_unlock_password"); - this.unlockPasswordButton = $("div.modal-dialog div.unlock-btns-wrapper button.modal-submit-btn"); - - this.orderIsActiveMsg = $("group.result-success[ng-show=\"tx_result=='cleared' && executedOnOfferCreate=='none'\"]"); - this.submitAnotherButton = $("a[ng-click=\"reset_widget(type)\"]"); - this.qtyHead = $('div[rp-sort-header-field="qty"]'); - this.limitHead = $('div[rp-sort-header-field="limit"]'); - this.qty = $$("div[data-label='QTY']"); - this.limit = $$("div[data-label='Limit']"); - this.currentPairOnly = $('input[name="current_pair_only"]'); - this.cancelAll = $('.listings .my .row rp-popup a.btn-cancel.btn-a'); - this.cancelAllConfirm = $('body div.modal button[ng-click="cancel_all_orders()"]'); -}; - -TradePage.prototype.goTo = function () { - browser.get('#/trade'); -} - -TradePage.prototype.setCurrencyPair = function (pair) { - var self = this; - return this.currencyPairInput.clear(). - then(function() { - return self.currencyPairInput.sendKeys(pair, protractor.Key.ENTER); - }); -} - -TradePage.prototype.enterOrder = function (amount, price) { - var self = this; - return helperBrowser.waitForElement(this.sellAmountInput). - then(this.sellAmountInput.clear). - then(function() { - return self.sellAmountInput.sendKeys(amount); - }). - then(this.sellPriceInput.clear). - then(function() { - return self.sellPriceInput.sendKeys(price); - }); -} - -TradePage.prototype.confirmOrder = function (password) { - var self = this; - - return helperBrowser.waitForElementToBecameAvailable(this.confirmFatButton). - then(this.confirmFatButton.click). - then(browser.sleep.bind(self, 1000)). - then(function() { - return self.unlockPasswordInput.isDisplayed(); - }). - then(function(isUnlockDisplayed) { - /// it should show password input - if (isUnlockDisplayed) { - return self.unlockPasswordInput.sendKeys(password).then(function() { - protractor.getInstance().ignoreSynchronization = true; - return self.unlockPasswordButton.click(); - }); - } else { - return protractor.promise.fulfilled(true); - } - }). - then(helperBrowser.waitForElement.bind(self, this.orderIsActiveMsg)). - then(this.submitAnotherButton.click); -} - -TradePage.prototype.cancelAllOrders = function (password) { - var self = this; - - return helperBrowser.waitForElementToDisplay(this.cancelAll). - then(this.cancelAll.click). - then(browser.sleep.bind(self, 10)). - then(this.cancelAllConfirm.click). - then(function() { - return self.unlockPasswordInput.isPresent(); - }). - then(function(isUnlockDisplayed) { - /// it should show password input - if (isUnlockDisplayed) { - return self.unlockPasswordInput.sendKeys(password).then(function() { - protractor.getInstance().ignoreSynchronization = true; - return self.unlockPasswordButton.click(); - }); - } else { - return protractor.promise.fulfilled(true); - } - }); -} - - -module.exports = TradePage; diff --git a/test/e2e/pages/trustPage.js b/test/e2e/pages/trustPage.js deleted file mode 100644 index 0b4478439..000000000 --- a/test/e2e/pages/trustPage.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict'; - -var helperBrowser = require('../utils/browser'); - -var TrustPage = function () { - this.connectGatewayButton = element(by.css('.btn-add-trust a')); - this.gatewayAddressInput = element(by.css('#trust_counterparty')); - this.trustFormSubmitButton = element(by.css("form[name='trustForm'] a.btn.btn-primary.submit")); - this.currencyInput = element(by.css('form[name="trustForm"] div[ng-hide="advanced_feature_switch"] #trust_amount_currency')); - this.confirmGatewayButton = element(by.css("div.modal-dialog button.btn-default.btn-success")); - this.unlockPasswordInput = element(by.css("div.modal-dialog #popup_unlock_password")); - this.unlockPasswordButton = element(by.css("div.modal-dialog div.unlock-btns-wrapper button.modal-submit-btn")); - this.gatewayAddedHolder = element(by.css('group.result-success[ng-show=\'tx_result=="cleared"\'] h2')); -// this.usdGatewayTitle = element(by.css('div.currency-usd span.currency')).getText(); - this.usdGatewayEditButton = element(by.css('div.currency-usd div.lines a[ng-click="edit_account()"]')); - this.usdGatewayDeleteButton = element(by.css('div.currency-usd div.lines span[ng-show="editing && !advanced_feature_switch"] button[ng-click="delete_account()"]')); - this.gatewayRemovedHolder = element(by.css('group[on="notif"] group.result-success[ng-switch-when="gateway_removed"]')); - - // for gateway advanced test - this.gatewayTrustAmountInput = element(by.css('#trust_amount')); - this.advancedCurrencyInput = element(by.css('form[name="trustForm"] div[ng-show="advanced_feature_switch"] #trust_amount_currency')); - // editLimitInput = element(by.model('trust.limit')); - this.editLimitInput = element(by.css('div.currency-usd input[name="limit"]')); - this.usdGatewaySaveButton = element(by.css('div.currency-usd div.lines div[ng-show="editing && advanced_feature_switch"] #save')); - this.changesSavedHolder = element(by.css('group[on="notif"] group.result-success[ng-switch-when="success"]')); - // exactBinding not working - protractor is too old :( - // usdGatewayLimitHolder = element(by.css('div.currency-usd div.lines ')).element(by.exactBinding('component.limit')); - this.usdGatewayLimitHolder = element(by.css('div.currency-usd div.lines div[ng-show="advanced_feature_switch"] div.ng-binding')); - this.usdGatewayAdvancedDeleteButton = element(by.css('div.currency-usd div.lines div[ng-show="editing && advanced_feature_switch"] button[ng-click="delete_account()"]')); -}; - -Object.defineProperty(TrustPage.prototype, 'usdGatewayTitle', { - get: function() { - return ($('div.currency-usd span.currency')).getText(); - } -}); - -TrustPage.prototype.goTo = function () { - browser.get('#/trust'); -} - -TrustPage.prototype.gatewayTitle = function (currency) { - return $('div.currency-' + currency.toLowerCase() + ' span.currency').getText(); -} - -TrustPage.prototype.putAddress = function (address, currency) { - var self = this; - return this.gatewayAddressInput.sendKeys(address). - then(this.currencyInput.clear). - then(function() { - return self.currencyInput.sendKeys(currency); - }); -} - -TrustPage.prototype.connectGateway = function (addressOrName, currency, password) { - return this.putAddress(addressOrName, currency).then(this.connectGatewaySubmit.bind(this, password)); -} - -TrustPage.prototype.connectGatewaySubmit = function (password) { - var self = this; - - return helperBrowser.waitForElementToBecameAvailable(this.trustFormSubmitButton). - then(this.trustFormSubmitButton.click). - then(helperBrowser.waitForElementToDisplay.bind(self, this.confirmGatewayButton)). - then(this.confirmGatewayButton.click). - then(browser.sleep.bind(self, 1000)). - then(function() { - return self.unlockPasswordInput.isPresent(); - }). - then(function(isUnlockDisplayed) { - /// it should show password input - if (isUnlockDisplayed) { - return self.unlockPasswordInput.sendKeys(password).then(function() { - protractor.getInstance().ignoreSynchronization = true; - return self.unlockPasswordButton.click(); - }); - } else { - return protractor.promise.fulfilled(true); - } - }). - then(helperBrowser.waitForElementToDisplay.bind(self, this.gatewayAddedHolder)); -} - -TrustPage.prototype.removeGateway = function (currency) { - var self = this; - return $('div.currency-' + currency.toLowerCase() + ' div.lines a[ng-click="edit_account()"]').click(). - then(browser.sleep.bind(this, 30)). - then($('div.currency-' + currency.toLowerCase() + ' div.lines span[ng-show="editing && !advanced_feature_switch"] button[ng-click="delete_account()"]').click). - then(helperBrowser.waitForElement.bind(self, self.gatewayRemovedHolder)). - then(browser.sleep.bind(this, 1000)); -} - - -// for gateway advanced test -TrustPage.prototype.putAddressAdvanced = function (address, currency, amount) { - var self = this; - return this.gatewayAddressInput.sendKeys(address). - then(this.advancedCurrencyInput.clear). - then(function () { - self.advancedCurrencyInput.sendKeys(currency); - }). - then(this.gatewayTrustAmountInput.clear). - then(function () { - self.gatewayTrustAmountInput.sendKeys(amount); - }); -} - -module.exports = TrustPage; diff --git a/test/e2e/protractor.conf-example.js b/test/e2e/protractor.conf-example.js deleted file mode 100644 index 0ef70a62e..000000000 --- a/test/e2e/protractor.conf-example.js +++ /dev/null @@ -1,36 +0,0 @@ -exports.config = { - seleniumAddress: 'http://localhost:4444/wd/hub', - framework: 'mocha', - mochaOpts: { - timeout: 20000 - }, - specs: ['*.js'], - capabilities: { - browserName: 'chrome' - }, - baseUrl: 'http://local.rippletrade.com/index_debug.html', - - // Credentials of a funded test account - user: { - username: '', - password: '', - secret: '' - }, - - // OldBlob user credentials for testing the migration - oldUser: { - username: '', - password: '', - secret: '' - }, - - // gateway test - gateway : { - address: 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q', - name: '~SnapSwap', - fakeCurrency: '111' - }, - - // Ripple address to send xrp to - counterparty: '' -}; diff --git a/test/e2e/register.controller.spec.js b/test/e2e/register.controller.spec.js deleted file mode 100644 index f1f571d75..000000000 --- a/test/e2e/register.controller.spec.js +++ /dev/null @@ -1,282 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('register form', function() { - - beforeEach(function(){ - browser.get('#/register'); - }); - - it('should render the register form', function(done) { - expect($("form[name='registerForm']").getText()) - .to.exist - .and.notify(done); - }); -}); - -describe('user name field', function() { - - beforeEach(function(){ - browser.get('#/register'); - }); - - it('should accept a non-existing user name', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys(config.user.username + "-new") - .then(function(){ - var message = $("form[name='registerForm'] .success[rp-error-valid]"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny an existing user name', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys(config.user.username) - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='exists']"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a reserved user name', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys("google") - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='reserved']"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a too short user name', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys("xy") - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='tooshort']"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a user name with a wrong charset', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys(config.user.username + "รค") - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='charset']"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a user name starting with a hyphen', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys("-" + config.user.username) - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='starthyphen']"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a user name ending with a hyphen', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys(config.user.username + "-") - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='endhyphen']"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a user name with multiple hyphens', function(done) { - $(".auth-form-wrapper #register_username") - .sendKeys(config.user.username + "--x") - .then(function(){ - var message = $("form[name='registerForm'] .errorGroup[rp-errors='register_username'] span[ng-switch-when='multhyphen']"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); -}); - -describe('password field', function() { - - beforeEach(function(){ - browser.get('#/register'); - }); - - it('should deny a weak password', function(done) { - $(".auth-form-wrapper #register_password") - .sendKeys("123456") - .then(function(){ - var message = $(".ng-invalid-rp-strong-password#register_password"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should accept a strong password', function(done) { - $(".auth-form-wrapper #register_password") - .sendKeys("73571n6.") - .then(function(){ - var message = $(".ng-valid-rp-strong-password#register_password"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny non-matching passwords', function(done) { - $(".auth-form-wrapper #register_password").sendKeys("73571n6."); - $(".auth-form-wrapper #register_password2").sendKeys("73571n6") - .then(function(){ - var message = $(".ng-invalid-rp-same-in-set#register_password"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should accept matching passwords', function(done) { - $(".auth-form-wrapper #register_password").sendKeys("73571n6."); - $(".auth-form-wrapper #register_password2").sendKeys("73571n6.") - .then(function(){ - var message = $(".ng-valid-rp-same-in-set#register_password"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); -}); - -describe('email field', function() { - - beforeEach(function(){ - browser.get('#/register'); - }); - - it('should deny an invalid email', function(done) { - $(".auth-form-wrapper #register_email").sendKeys("e2e-test") - .then(function(){ - var message = $(".ng-invalid-email#register_email"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should accept a valid email', function(done) { - $(".auth-form-wrapper #register_email").sendKeys("e2e-test+index@example.com") - .then(function(){ - var message = $(".ng-valid-email#register_email"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); -}); - -describe('secret field', function() { - - beforeEach(function(){ - browser.get('#/register'); - }); - - it('should deny an invalid secret', function(done) { - $(".auth-form-wrapper a[ng-click='showMasterKeyInput=true']").click(); - $(".auth-form-wrapper #register_masterkey").sendKeys("test-invalid-key") - .then(function(){ - var message = $(".ng-invalid-rp-master-key#register_masterkey"); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should accept a valid secret', function(done) { - $(".auth-form-wrapper a[ng-click='showMasterKeyInput=true']").click(); - $(".auth-form-wrapper #register_masterkey").sendKeys(config.oldUser.secret) - .then(function(){ - var message = $(".ng-valid-rp-master-key#register_masterkey"); - expect(message.isPresent()) - .to.eventually.be.true; - message = $(".ng-valid-rp-master-address-exists#register_masterkey"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - - it('should deny a valid secret that already has an account', function(done) { - $(".auth-form-wrapper a[ng-click='showMasterKeyInput=true']").click(); - $(".auth-form-wrapper #register_masterkey").sendKeys(config.user.secret) - .then(function(){ - var message = $(".register_masterkey .auth-attention:not(.ng-hide)"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); -}); - -describe('register button', function() { - - var username = "e2e-test-reg-" + Math.floor(Math.random() * 1000000); - - before(function(){ - browser.get('#/register'); - $(".auth-form-wrapper #register_username").sendKeys(username); - $(".auth-form-wrapper #register_password").sendKeys(config.user.password); - $(".auth-form-wrapper #register_password2").sendKeys(config.user.password); - $(".auth-form-wrapper #register_email").sendKeys("test@example.com"); - $(".auth-form-wrapper #terms").click() - .then(function(){ - var message = $("form[name='registerForm'] .success[rp-error-valid]"); - helperBrowser.waitForElement(message); - }); - }); - - it('should be active', function(done) { - expect($(".submit-btn-container button").getAttribute('disabled')) - .to.eventually.not.equal('disabled') - .and.notify(done); - }); - - it('click should register the user', function(done) { - $(".submit-btn-container button").click() - .then(function () { - var message = $("form[name='resendForm']"); - helperBrowser.waitForElement(message); - expect(message.isPresent()) - .to.eventually.be.true - .and.notify(done); - }); - }); - -}); diff --git a/test/e2e/security.controller.spec.js b/test/e2e/security.controller.spec.js deleted file mode 100644 index 9b4054b42..000000000 --- a/test/e2e/security.controller.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('password setting', function() { - - // security page object - var SecurityPage = function() { - this.changePasswordButton = $('a[ng-hide="openFormPassword"][l10n]'); - this.passwordForm = $('#renameForm'); - this.passwordNotification = $('.alert.alert-success[ng-show=success.changePassword]'); - - this.get = function() { - browser.get('#/security'); - browser.wait($('.showSecurity').isDisplayed); - }; - - this.changePassword = function(oldpassword, newpassword) { - $('input[name=password]').sendKeys(oldpassword); - $('input[name=change_password1]').sendKeys(newpassword); - $('input[name=change_password2]').sendKeys(newpassword); - return $('#renameForm button[type=submit]').click(); - }; - }; - var securityPage = new SecurityPage(); - - before(function(){ - helperForms.login(config.user.username, config.user.password); - }); - - it('should render the security page', function(done) { - // Go to send page - securityPage.get(); - - // Wait for the security page to render - expect(securityPage.changePasswordButton.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should render the password form', function(done) { - securityPage.changePasswordButton.click(); - expect(securityPage.passwordForm.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - var tempPassword = config.user.password + '-e2e'; - protractor.getInstance().ignoreSynchronization = true; - - it('should change the password', function(done) { - securityPage.changePassword(config.user.password, tempPassword); - expect(securityPage.passwordNotification.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should login with the new password', function(done) { - helperForms.login(config.user.username, tempPassword); - }); - - it('should render the security page again', function(done) { - // sleep for 2s - browser.sleep(2000); - // Wait for the security page to render - securityPage.get(); - expect(securityPage.changePasswordButton.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should render the password form', function(done) { - securityPage.changePasswordButton.click(); - expect(securityPage.passwordForm.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should change the password back', function(done) { - - securityPage.changePassword(tempPassword, config.user.password); - expect(securityPage.passwordNotification.isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); -}); diff --git a/test/e2e/send.controller.spec.js b/test/e2e/send.controller.spec.js deleted file mode 100644 index 9308e9f10..000000000 --- a/test/e2e/send.controller.spec.js +++ /dev/null @@ -1,145 +0,0 @@ -'use strict'; - -// Chai is a BDD / TDD assertion library -var chai = require('chai'); -var chaiAsPromised = require('chai-as-promised'); -var config = require('./protractor.conf.js').config; - -var helperForms = require('./utils/forms'); -var helperBrowser = require('./utils/browser'); - -chai.use(chaiAsPromised); -var expect = chai.expect; - -describe('send', function() { - - before(function(){ - helperForms.login(config.user.username,config.user.password); - }); - - it('should render the send page', function(done) { - // Go to send page - browser.get('#/send'); - - // Wait for the send form to render - browser.wait(function() { - return $('#sendForm').isDisplayed().then(function(result) { - return result; - }); - }); - - // Assuming that everything's ok if the #send_destination is present - expect($('#send_destination').isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - describe('recipient', function() { - - var input = $('#send_destination'); - - beforeEach(function(){ - input.clear(); - }); - - it('should not accept an invalid ripple address', function(done) { - input.sendKeys('invalidrippleaddress'); - expect(input.getAttribute('class')) - .to.eventually.contain('ng-invalid') - .and.notify(done); - }); - - it('should accept a valid ripple address', function(done) { - input.sendKeys(config.counterparty); - expect(input.getAttribute('class')) - .to.eventually.not.contain('ng-invalid') - .and.notify(done); - }); - - // TODO should accept a contact name - // TODO should accept a ripple name - - }); - - describe('amount', function() { - - var input = $('#send_amount'); - - beforeEach(function(){ - input.clear(); - }); - - it('should not accept an invalid amount', function(done) { - input.sendKeys('123a'); - expect(input.getAttribute('class')) - .to.eventually.contain('ng-invalid') - .and.notify(done); - }); - - it('should accept a valid amount', function(done) { - input.sendKeys('0.000001'); - expect(input.getAttribute('class')) - .to.eventually.not.contain('ng-invalid') - .and.notify(done); - }); - - }); - - // TODO test destination tag - // TODO test source tag - - describe('send xrp button', function() { - - var input = $('#sendXrpButton'); - - it('should be active', function(done) { - expect(input.getAttribute('disabled')) - .to.eventually.not.equal('disabled') - .and.notify(done); - }); - - it('should take to the confirmation screen', function(done) { - input.click(); - expect($('.mode-confirm').isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - }); - - // TODO test alternate payments (with pathfinding) - - describe('confirm', function() { - - // TODO test the wrong password case - - it('button click should confirm the transaction', function(done) { - $('#send_unlock_password').sendKeys(config.user.password); - $('#confirmButton').click(); - - browser.wait(function() { - return $('.mode-status').isDisplayed().then(function(result) { - return result; - }); - }); - - expect($('.mode-status .pending').isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - it('should succeed', function(done) { - browser.wait(function() { - return $('.mode-status .pending').isDisplayed().then(function(result) { - return !result; - }); - }); - - expect($('.mode-status .result-success').isDisplayed()) - .to.eventually.be.true - .and.notify(done); - }); - - }); - -}); diff --git a/test/e2e/utils/browser.js b/test/e2e/utils/browser.js deleted file mode 100644 index 21286513c..000000000 --- a/test/e2e/utils/browser.js +++ /dev/null @@ -1,30 +0,0 @@ -exports.waitForNavigation = function (part) { - return browser.wait(function () { - return browser.driver.getCurrentUrl().then(function (url) { - return !!url.match(part); - }); - }); -}; - -exports.waitForElement = function (part) { - return browser.wait(function () { - return part.isPresent(); - }); -}; - -exports.waitForElementToDisplay = function (part) { - return browser.wait(function () { - return part.isPresent(); - }).then(function() { - return browser.wait(part.isDisplayed); - }); -}; - -exports.waitForElementToBecameAvailable = function (part) { - return browser.wait(function () { - return part.getAttribute('disabled').then(function (isDisabled) { - return !isDisabled; - }); - }); -}; - diff --git a/test/e2e/utils/forms.js b/test/e2e/utils/forms.js deleted file mode 100644 index 3d0d59028..000000000 --- a/test/e2e/utils/forms.js +++ /dev/null @@ -1,53 +0,0 @@ -var helpers = require('./browser'); - -/* - add these 2 lines to the top of your it block to force a logout and log back in - - forms.logout(); - - forms.login(config.user.username,config.user.password); - */ - -exports.login = function (username,password) { - browser.get('#/login'); - browser.getCurrentUrl() - .then(function(url){ - // It's already logged in if the page is other then login or register - if (url.match('login') || url.match('register')){ - browser.get('#/login'); - - $(".auth-form-container #login_username").sendKeys(username); - $(".auth-form-container #login_password").sendKeys(password); - $("#loginBtn").click() - .then(function(){ - helpers.waitForNavigation('#/balance'); - }) - } - }) -}; - -exports.migrate = function (username,password) { - browser.get('#/migrate'); - - $(".auth-form-container #login_username").sendKeys(username); - $(".auth-form-container #login_password").sendKeys(password); - $(".auth-form-container .submit-btn-container button").click() - .then(function(){ - helpers.waitForNavigation('#/register'); - }) -}; - -exports.logout = function () { - browser.getCurrentUrl() - .then(function(url){ - if (!url.match('login')){ - $(".mainnav .settings").click() - .then(function(){ - $(".mainnav .settings .dropdown-menu .logout").click() - .then(function(){ - helpers.waitForNavigation('#/login'); - }) - }) - } else { - browser.get('#/login'); - } - }); -};