diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index a9ae8d62dd..45f4901ec8 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -3243,6 +3243,7 @@ "BALANCE_SHEET" : "Balance sheet", "BENEFICIARY" : "Beneficaries", "BILAN" : "Bilan", + "BILLING_SERVICES" : "Billing Services", "BUDGETING" : "Budget", "BUDGET_ANALYSIS" : "Budget Analysis", "BUDGET_BY_ACCOUNT" : "Budget by Account", diff --git a/client/src/partials/billing_services/form.html b/client/src/partials/billing_services/form.html index bb180b4886..fbb74b95df 100644 --- a/client/src/partials/billing_services/form.html +++ b/client/src/partials/billing_services/form.html @@ -14,7 +14,11 @@
-
+
@@ -96,11 +100,11 @@
-

+

{{ "BILLING_SERVICES.CREATED" | translate }}

-

+

{{ "BILLING_SERVICES.UPDATED" | translate }}

@@ -128,7 +132,7 @@ -
diff --git a/client/src/partials/billing_services/index.html b/client/src/partials/billing_services/index.html index 165139bfdf..00a18ae6e3 100644 --- a/client/src/partials/billing_services/index.html +++ b/client/src/partials/billing_services/index.html @@ -11,13 +11,13 @@
- +
diff --git a/client/src/partials/billing_services/list/list.js b/client/src/partials/billing_services/list/list.js index c84534b8d7..5690201c0a 100644 --- a/client/src/partials/billing_services/list/list.js +++ b/client/src/partials/billing_services/list/list.js @@ -15,10 +15,10 @@ function BillingServicesListController($translate, BillingServices, Accounts) { var vm = this; var editTemplate = - '
'; + '
'; var deleteTemplate = - '
'; + '
'; // these options are for the ui-grid vm.options = { diff --git a/client/test/e2e/billingServices/billingServices.spec.js b/client/test/e2e/billingServices/billingServices.spec.js new file mode 100644 index 0000000000..29a3093d83 --- /dev/null +++ b/client/test/e2e/billingServices/billingServices.spec.js @@ -0,0 +1,90 @@ +/* global browser, element, by, protractor */ + +var chai = require('chai'); +var expect = chai.expect; + +// import testing utiliites +var helpers = require('../shared/helpers'); +helpers.configure(chai); + +var components = require('../shared/components'); +var GU = require('../shared/gridTestUtils.spec.js'); +var FU = require('../shared/FormUtils'); + +describe('Billing Services', function () { + 'use strict'; + + /** @const */ + var path = '#/admin/billing_services'; + + /** @const */ + var gridId = 'BillingServicesGrid'; + + before(function () { browser.get(path); }); + + it('can create a billing service', function () { + + // click on the create button + FU.buttons.create(); + + // anticipate that the form should come up + FU.exists(by.css('[name="BillingServicesForm"]'), true); + + var root = element(by.css('[data-component-find-account]')); + + // search for a particular account using the account input + var accountInput = root.element(by.model('BillingServicesFormCtrl.model.account')); + accountInput.sendKeys('410'); + + // click select the proper account + var option = root.all(by.repeater('match in matches track by $index')).first(); + option.click(); + + // fill in the rest of the fields + FU.input('BillingServicesFormCtrl.model.label', 'Value Added Tax'); + FU.input('BillingServicesFormCtrl.model.description', 'A tax added for people who want value!'); + FU.input('BillingServicesFormCtrl.model.value', 25); + + FU.buttons.submit(); + + // make sure the "created" validation tag exists + FU.exists(by.css('[data-validation="created"]'), true); + + // let's be sure we can find the record on the grid by returning there + FU.buttons.back(); + + // check that the grid as exactly one record + var grid = GU.getGrid(gridId); + + var rows = grid.element(by.css('.ui-grid-render-container-body')) + .all(by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index')); + + expect(rows.count()).to.eventually.equal(1); + }); + + it('can update a billing service', function () { + + // get the cell with the update button and click it + var cell = GU.dataCell(gridId, 0, 6); + cell.element(by.css('[data-method="update"]')).click(); + + // expect to find the update form has loaded + FU.exists(by.css('[name="BillingServicesForm"]'), true); + + // update the label + FU.clear('BillingServicesFormCtrl.model.label'); + FU.input('BillingServicesFormCtrl.model.label', 'Value Reduced Tax'); + + // submit the forn + FU.buttons.submit(); + + // make sure the "created" validation tag exists + FU.exists(by.css('[data-validation="updated"]'), true); + + // return to the main page + FU.buttons.back(); + }); + + /** @todo -- requires the modal described in #150 or similar */ + it('can delete a billing service'); +}); diff --git a/client/test/e2e/shared/FormUtils.js b/client/test/e2e/shared/FormUtils.js index 97a980e05e..f50f023b5f 100644 --- a/client/test/e2e/shared/FormUtils.js +++ b/client/test/e2e/shared/FormUtils.js @@ -65,6 +65,7 @@ var buttons = { create : function create() { return $('[data-method="create"]').click(); }, submit : function submit() { return $('[data-method="submit"]').click(); }, cancel : function cancel() { return $('[data-method="cancel"]').click(); }, + back : function back() { return $('[data-method="back"]').click(); }, delete : function delet() { return $('[data-method="delete"]').click(); } }; diff --git a/protractor.conf.js b/protractor.conf.js index 8ee7d626cb..65293f7929 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -9,19 +9,16 @@ var q = require('q'); // as appropriate. var config = { - + specs: ['client/test/e2e/**/*.spec.js'], - + framework : 'mocha', baseUrl : 'https://localhost:8080/', - allScriptsTimeout : 30000, - timeout : 10000, - defaultTimeoutInterval : 30000, - ignoreSynchronization : false, mochaOpts : { timeout : 30000 }, + // default browsers to run multiCapabilities: [{ //'browserName': 'firefox',