diff --git a/client/test/e2e/billingServices/billingServices.spec.js b/client/test/e2e/billingServices/billingServices.spec.js
index 7665b9eeda..3eeea3c898 100644
--- a/client/test/e2e/billingServices/billingServices.spec.js
+++ b/client/test/e2e/billingServices/billingServices.spec.js
@@ -26,17 +26,7 @@ describe('Billing Services', function () {
// 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.typeahead('BillingServicesFormCtrl.model.account', '410');
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);
diff --git a/client/test/e2e/shared/FormUtils.js b/client/test/e2e/shared/FormUtils.js
index 1990750839..e9d8081277 100644
--- a/client/test/e2e/shared/FormUtils.js
+++ b/client/test/e2e/shared/FormUtils.js
@@ -6,83 +6,31 @@ const expect = chai.expect;
const helpers = require('./helpers');
helpers.configure(chai);
-// Overide the element.all() prototype function provided by protractor to attach custom methods
-// @TODO - is there a better way without overriding the prototype function?
-var ElementArrayFinder = protractor.ElementArrayFinder;
-
-/**
-* Pick a random element from the ElementArrayFinder.
-*
-* @alias element.all(locator).random()
-* @view
-*
-*
First
-*
Second
-*
Third
-*
-*
-* @example
-* var list = element.all(by.css('.items li));
-* expect(list.random().getText()).to.have.length.above(4);
-*
-* @todo - make this work. sigh.
-ElementArrayFinder.prototype.random = function() {
- var self = this;
- return self.count()
- .then(function (length) {
- var n = Math.floor(Math.random() * length);
- return self.filter(function (elem, index) {
- return index === n;
- })
- });
-};
-*/
-
-/**
-* Filter out disabled elements from the ElementArrayFinder.
-*
-* @alias element.all(locator).enabled()
-* @view
-*
-*
-* @example
-* var options = element.all(by.css('select > option'));
-* expect(options.enabled()).to.have.length(1);
-*/
-ElementArrayFinder.prototype.enabled = function () {
- return this.filter(function (elem, index) {
- return elem.isEnabled();
- });
-};
-
// These buttons depend on custom data tags to indicate actions. This seems
// cleaner than using a whole bunch of ids which may potentially collide.
// However, this decision can be reviewed
var buttons = {
- create : function create() { return $('[data-method="create"]').click(); },
- search : function search() { return $('[data-method="search"]').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(); }
+ create: function create() { return $('[data-method="create"]').click(); },
+ search: function search() { return $('[data-method="search"]').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(); }
};
// This methods are for easily working with modals. Works with the same custom
// data tags used in form buttons.
var modal = {
- submit : function submit() { return $('[uib-modal-window] [data-method="submit"]').click(); },
- cancel : function cancel() { return $('[uib-modal-window] [data-method="cancel"]').click(); }
+ submit: function submit() { return $('[uib-modal-window] [data-method="submit"]').click(); },
+ cancel: function cancel() { return $('[uib-modal-window] [data-method="cancel"]').click(); }
};
// convenience methods to see if the form contains feedback text. Returns locators.
var feedback = {
- success : function success() { return by.css('[data-role="feedback"] > .text-success'); },
- error : function error() { return by.css('[data-role="feedback"] > .text-danger'); },
- warning : function warning() { return by.css('[data-role="feedback"] > .text-warning'); },
- info : function info() { return by.css('[data-role="feedback"] > .text-info'); }
+ success: function success() { return by.css('[data-role="feedback"] > .text-success'); },
+ error: function error() { return by.css('[data-role="feedback"] > .text-danger'); },
+ warning: function warning() { return by.css('[data-role="feedback"] > .text-warning'); },
+ info: function info() { return by.css('[data-role="feedback"] > .text-info'); }
};
// convenience methods to check form element validation states
@@ -103,42 +51,91 @@ var validation = {
module.exports = {
// get an element by its ng-model
- input : function input(model, value) {
- return element(by.model(model)).clear().sendKeys(value);
+ input : function input(model, value, anchor) {
+
+ // get the HTML element
+ let input = anchor ?
+ anchor.element(by.model(model)) :
+ element(by.model(model));
+
+ return input.clear().sendKeys(value);
},
- // get a