Class: Field

e2e/fields/Field~Field(conf)

Field

Constructor

new Field(conf)

Defines a form field to help writing end to end tests.

Help manipulate form fields in a Page. Use Field.get method to get a Field instance.

Parameters:
Name Type Description
conf Object

A field configuration object

Source:

Members

(readonly) baseElement :Object

Element from where to look for the field (typically the form element).

Type:
  • Object
Source:

(readonly) name :String

Field label.

Type:
  • String
Source:

Methods

(static) get(conf) → {Field}

Gets an instance of a Field.

Parameters:
Name Type Description
conf Object

A field configuration object

Source:
Returns:

An instance of a Field sub object

Type
Field
Example
var Field = require('@openveo/test').e2e.fields.Field;

var myTextField = Field.get({
  type: 'text',
  name: 'My field',
  baseElement: element(by.css('form'))
});

(static) setInputValue(inputElement, value) → {Promise}

Sets an input value.

Parameters:
Name Type Description
inputElement Object

Input element finder

value String

The input value

Source:
Returns:

Promise resolving when value has been set

Type
Promise

clear() → {Promise}

Clears field value.

Source:
Returns:

Promise resolving when the field is cleared

Type
Promise
Example
myField.clear().then(function() {
  console.log('Field cleared');
});

getDescription() → {Promise}

Gets field description.

Source:
Returns:

Promise resolving with the description

Type
Promise
Example
myField.getDescription().then(function(description) {
  console.log('Field description is : ' + description);
});

getElement() → {Promise}

Gets field element wrapper.

Look for a form element label and return its parent.

Source:
Returns:

Promise resolving with the element

Type
Promise

getErrorMessage() → {Promise}

Gets field error message.

Source:
Returns:

Promise resolving with the error message

Type
Promise
Example
myField.getErrorMessage().then(function(errorMessage) {
  console.log('Error message : ' + errorMessage);
});

getLabel() → {Promise}

Gets field label.

Source:
Returns:

Promise resolving with the label

Type
Promise
Example
myField.getLabel().then(function(label) {
  console.log('Field label is : ' + label);
});

getText() → {Promise}

Gets field text representation in case of an inline editable field.

Source:
Returns:

Promise resolving with field text representation

Type
Promise
Example
myField.getText().then(function(text) {
  console.log(text);
});

getValue() → {Promise}

Gets field value.

Source:
Returns:

Promise resolving with field value

Type
Promise
Example
myField.getValue().then(function(value) {
  console.log(value);
});

isOnError() → {Promise}

Tests if a field is considered as on error.

Source:
Returns:

Promise resolving with a boolean indicating if the field is on error

Type
Promise
Example
myField.isOnError().then(function(isOnError) {
  console.log('Is field on error ? ' + isOnError);
});

setValue(valueopt) → {Promise}

Sets field value.

Parameters:
Name Type Attributes Description
value String | Object | Number | Boolean <optional>

Field's value depending on its type

Source:
Returns:

Promise resolving when the value is set

Type
Promise
Example
myField.setValue('new value').then(function() {
  console.log('Value set');
});