Class: TablePage

e2e/pages/TablePage~TablePage(provider)

TablePage

Constructor

new TablePage(provider)

Defines a TablePage representing a back end page with a table and form to add an entity.

Do not use this directly but extend it.

Parameters:
Name Type Description
provider Object

Provider to interact directly with the database

Source:
Example
var TablePage = require('@openveo/test').e2e.pages.TablePage;

function MyTablePage() {
  MyTablePage.super_.call(this);
  this.path = 'be/myTablePage';
}

module.exports = MyTablePage;
util.inherits(MyTablePage, TablePage);

var page = new MyTablePage();
page.logAsAdmin();
page.load().then(function() {
  console.log('Page fully loaded in the first language');
});

Extends

Members

(readonly) actionsButtonElement :Object

Main action button element to perform actions on all selected lines.

Type:
  • Object
Source:

(readonly) actionsElement :Object

Element holding the list of actions under main action button.

Type:
  • Object
Source:

(readonly) addButtonElement :Object

Submit button of the form to add a new entity.

Type:
  • Object
Source:

(readonly) addFormElement :Object

Form element to add a new entity.

Type:
  • Object
Source:

(readonly) addFormWrapperElement :Object

Wrapper of the add form element.

This element will be displayed when add form is displayed and hidden when add form is closed.

Type:
  • Object
Source:

(readonly) addLinkElement :Object

Link to open / close form element to add a new entity.

Type:
  • Object
Source:

(readonly) alertElements :Object

List of alert elements.

Type:
  • Object
Inherited From:
Source:

(readonly) bodyElement :Object

Body element.

Type:
  • Object
Inherited From:
Source:

(readonly) currentPageElement :Object

Element holding the current table page (pagination).

Type:
  • Object
Source:

(readonly) dialogCancelActionButtonElement :Object

Dialog box cancel button.

Type:
  • Object
Source:

(readonly) dialogConfirmActionButtonElement :Object

Dialog box confirmation button.

Type:
  • Object
Source:

(readonly) dialogElement :Object

Dialog box.

Type:
  • Object
Source:

(readonly) EC :Object

Protractor expected conditions.

Type:
  • Object
Inherited From:
Source:

(readonly) flow :Object

Protractor control flow.

Type:
  • Object
Inherited From:
Source:

(readonly) headerElements :Object

Table header elements.

Type:
  • Object
Source:

(readonly) itemsPerPageLinkElements :Object

List of per page links to select the number of elements to display per table page.

Type:
  • Object
Source:

(readonly) languageLinkElement :Object

Language link element to open the list of languages.

Type:
  • Object
Inherited From:
Source:

(readonly) leftMenuElement :Object

Left menu wrapper element.

Displayed or not as the left menu is opened or not.

Type:
  • Object
Inherited From:
Source:

(readonly) level1MenuLinkElements :Object

List of first level link elements in left menu.

Type:
  • Object
Inherited From:
Source:

(readonly) lineDetailElement :Object

Opened line detail containing information about the opened line.

Type:
  • Object
Source:

(readonly) logoutLinkElement :Object

Logout link element.

Type:
  • Object
Inherited From:
Source:

(readonly) pageElement :Object

Page element.

Page wrapper holding the content scrollbar.

Type:
  • Object
Inherited From:
Source:

(readonly) paginationElement :Object

Pagination links wrapper.

Type:
  • Object
Source:

(readonly) paginationLinkElements :Object

List of pagination links, including the previous and next range buttons.

Type:
  • Object
Source:

(readonly) paginationNextRangeElement :Object

Pagination next range link.

Type:
  • Object
Source:

(readonly) paginationPageLinkElements :Object

List of pagination links, excluding the previous and next range buttons.

Type:
  • Object
Source:

(readonly) paginationPreviousRangeElement :Object

Pagination previous range link.

Type:
  • Object
Source:

(readonly) popoverElement :Object

Popover element.

Type:
  • Object
Inherited From:
Source:

(readonly) profileLinkElement :Object

Profile link element.

Type:
  • Object
Inherited From:
Source:

(readonly) provider :Object

The entity provider.

Type:
  • Object
Source:

(readonly) rowElements :Object

Table row elements.

Type:
  • Object
Source:

(readonly) searchFormElement :Object

Search engine form to filter lines in the table.

Type:
  • Object
Source:

(readonly) searchLinkElement :Object

Link to open / close search engine.

Type:
  • Object
Source:

(readonly) selectAllElement :Object

Checkbox to select all line.

Type:
  • Object
Source:

(readonly) tableElement :Object

Table element.

Type:
  • Object
Source:

(readonly) toggleLeftMenuLinkElement :Object

Button to toggle left menu.

Type:
  • Object
Inherited From:
Source:

(readonly) totalLinesElement :Object

Element holding the total number of lines in all table pages (pagination).

Type:
  • Object
Source:

(readonly) totalPagesElement :Object

Element holding the total number of table pages (pagination).

Type:
  • Object
Source:

translations :Object

List of back end translations.

Type:
  • Object
Inherited From:
Source:

Methods

(private, static) getAllLineDetailsByIndex(lines, indexopt) → {Promise}

Gets column and field values for a list of lines.

Iterates through the given list of lines and get all information (column values and field values) for each line.

This:
Parameters:
Name Type Attributes Default Description
lines Array

The lines in the page (tr elements)

index Number <optional>
0

Current line index being inspected

Source:
Returns:

Promise resolving with values

Type
Promise

(private, static) getAllLineDetailsByPage(totalPages) → {Promise}

Gets line fields values in all pages.

Iterate through all lines of all pages and get columns / fields values for each line. It starts at current page.

This:
Parameters:
Name Type Description
totalPages Number

The total number of pages

Source:
Returns:

Promise resolving with values

Type
Promise

(private, static) getHeaderIndex(name) → {Promise}

Gets the index of a table column in the list of columns.

This:
Parameters:
Name Type Description
name String

The name of the header to look for

Source:
Returns:

Promise resolving with the index of the column

Type
Promise

(private, static) getLineByIndex(lines, name, indexopt) → {Promise}

Finds a line.

Iterate through the given list of lines to look for the expected one.

This:
Parameters:
Name Type Attributes Description
lines Array

The list of line elements (tr elements) to look into

name String

The name of the line to look for (this value will be compared to the value of each cell)

index Number <optional>

The index in lines to start from

Source:
Returns:

Promise resolving with the tr element

Type
Promise

(private, static) getLineByPage(name, totalPages) → {Promise}

Finds a line by page.

Iterate through all lines of all pages to look for the expected line. It starts at current page.

This:
Parameters:
Name Type Description
name String

The name of the line to look for (this value will be compared to the value of each cell)

totalPages Number

The total number of pages

Source:
Returns:

Promise resolving with the searched line (tr element)

Type
Promise

(private, static) getLineValuesByIndex(lines, headerIndex, indexopt) → {Promise}

Gets column value for a list of lines.

Iterates through the given list of lines and find its value in the given column.

This:
Parameters:
Name Type Attributes Default Description
lines Array

The lines in the page (tr elements)

headerIndex Number

The index of the column to read

index Number <optional>
0

Current line index being inspected

Source:
Returns:

Promise resolving with lines values

Type
Promise

(private, static) getLineValuesByPage(headerIndex, totalPages) → {Promise}

Gets line column values in all pages.

Iterate through all lines of all pages and get column value for each line. It starts at current page.

This:
Parameters:
Name Type Description
headerIndex Number

The index of the column to read

totalPages Number

The total number of pages

Source:
Returns:

Promise resolving with column values

Type
Promise

(private, static) selectPageByRange(page) → {Promise}

Selects a page.

Look for page link in pagination links, if page link is not in the pagination actual range, it will search for the page link in the other pagination ranges.

This:
Parameters:
Name Type Description
page String

The page to select (starting at 1 instead of 0)

Source:
Returns:

Promise resolving when the page is selected

Type
Promise

addLine(name, dataopt) → {Promise}

Adds a new line.

User must be logged and have permission to create line on this page.

Parameters:
Name Type Attributes Description
name String

Line name

data Object <optional>

Additional data depending on page type

Source:
Returns:

Promise resolving when the line has been added

Type
Promise

cancelAction() → {Promise}

Cancels the confirmation dialog.

Confirmation dialog must be displayed.

Source:
Returns:

Promise resolving when confirmation dialog has been canceled

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectAllLines();
page.performMultipleAction('Remove');
page.cancelAction().then(function() {
  console.Log('Remoe action canceled');
});

clearSearch() → {Promise}

Clears search fields.

Source:
Returns:

Promise resolving when fields are cleared

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.clearSearch().then(function() {
  console.Log('Search engine cleared');
});

clickMenu(itemName) → {Promise}

Clicks on a menu item.

This will look for the item in menu and sub menus to find the item by its name.

Parameters:
Name Type Description
itemName String

The name of the menu item

Inherited From:
Source:
Returns:

Promise resolving when menu is clicked

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.clickMenu('Roles').then(function() {
  console.log('Roles menu item clicked');
});

clickProfile() → {Promise}

Clicks on profile link.

Inherited From:
Source:
Returns:

Promise resolving when profile link is clicked

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.clickProfile().then(function() {
  console.log('Profile link clicked');
});

closeAddForm() → {Promise}

Closes formular to add an item.

Source:
Returns:

Promise resolving when add form is closed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.openAddForm();
page.closeAddForm().then(function() {
  console.log('Add form closed');
});

closeAlerts() → {Promise}

Closes all alerts.

Inherited From:
Source:
Returns:

Promise resolving when all alerts are closed

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.closeAlerts().then(function() {
  console.log('All alerts closed');
});

closeLine() → {Promise}

Closes opened line.

Source:
Returns:

Promise resolving when line is closed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.closeLine('My line').then(function() {
  console.log('My line closed');
});

closeMenu() → {Promise}

Closes menu.

Inherited From:
Source:
Returns:

Promise resolving when menu is closed

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.closeMenu().then(function() {
  console.log('Left menu closed');
});

closeSearchEngine() → {Promise}

Closes search engine.

Source:
Returns:

Promise resolving when search engine is closed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.closeSearchEngine().then(function() {
  console.log('Search engine closed');
});

closeSubMenu(itemName) → {Promise}

Closes an item sub menu by its name.

Parameters:
Name Type Description
itemName String

The name of the menu item having a sub menu

Inherited From:
Source:
Returns:

Promise resolving when sub menu is closed

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.closeSubMenu('Rights').then(function() {
  console.log('Rights sub menu closed');
});

confirmAction() → {Promise}

Accepts the confirmation dialog.

Confirmation dialog must be displayed.

Source:
Returns:

Promise resolving when confirmation dialog has been accepted

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectAllLines();
page.performMultipleAction('Remove');
page.confirmAction().then(function() {
  console.Log('Dialog confirmed, thus all selected lines are removed');
});

deleteCookies() → {Promise}

Removes all cookies on the actual page.

Inherited From:
Source:
Returns:

Promise resolving when all cookies are deleted

Type
Promise

deselectLine(lineFinder) → {Promise}

Deselects a line by clicking on the line checkbox.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving when line is deselected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.deselectLine('My line').then(function() {
  console.log('My line is deselected');
});

getAddFormFields(Add) → {Object}

Gets add form fields.

Parameters:
Name Type Description
Add Object

form element

Source:
Returns:

The list of fields

Type
Object

getAlertMessages() → {Promise}

Gets all alert messages.

Inherited From:
Source:
Returns:

Promise resolving with all alert messages

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.getAlertMessages().then(function(messages) {
  console.log(messages);
});

getAllLineDetails() → {Promise}

Gets all column / fields values for all lines in all pages.

Source:
Returns:

Promise resolving with the list of line details

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getAllLineDetails().then(function(data) {
 console.log(data);
});

getCurrentPage() → {Promise}

Gets current page number.

Source:
Returns:

Promise resolving with the current page (starting at 1)

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getCurrentPage().then(function(currentPage) {
  console.log('Current page is ' + currentPage);
});

getEditFormFields(Edit) → {Object}

Gets edit form fields.

Parameters:
Name Type Description
Edit Object

form element

Source:
Returns:

The list of fields

Type
Object

getEditionFormErrors() → {Promise}

Gets the list of edition form error messages.

Source:
Returns:

Promise resolving with the list of errors

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getEditionFormErrors().then(function(errors) {
  console.log(errors);
});

getGlobalActions() → {Promise}

Gets the list of global actions available.

Source:
Returns:

Promise resolving whith the list of global actions

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getGlobalActions().then(function(actions) {
  console.log(actions);
});

getLanguageOption(languageCode) → {Object}

Gets language link element.

Parameters:
Name Type Description
languageCode String

The language code to load (e.g. en)

Inherited From:
Source:
Returns:

The language option element

Type
Object
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.click(page.getLanguageOption('fr')).then(function() {
  console.log('Page is now in french');
});

getLanguages() → {Array}

Gets the list of available languages.

Inherited From:
Source:
Returns:

The list of available languages

Type
Array
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
console.log(page.getLanguages());

getLevel1MenuItems(itemNameopt) → {Promise}

Gets level 1 menu items.

All level 1 menu items will be returned with the promise unless itemName is specified then all elements corresponding to the item name will be returned.

Parameters:
Name Type Attributes Description
itemName String <optional>

The translated name of the menu item to look for, leave empty to get all level 1 menu items

Inherited From:
Source:
Returns:

Promise resolving with the list of elements

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.getLevel1MenuItems('Rights').then(function(elements) {
  console.log(elements);
});

getLevel2MenuItems(level1ItemName, level2ItemNameopt) → {Promise}

Gets level 2 menu items.

All level 2 menu items will be returned with the promise unless itemName is specified then all elements corresponding to the item name will be returned.

Parameters:
Name Type Attributes Description
level1ItemName String

The translated name of the first level menu item to look for

level2ItemName String <optional>

The translated name of the second menu item to look for, leave empty to get all level 2 menu items

Inherited From:
Source:
Returns:

Promise resolving with the list of elements

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.getLevel2MenuItems('Rights', 'Users').then(function(elements) {
  console.log(elements);
});

getLine(lineFinder) → {Promise}

Gets a line.

Looks for a line in all pages.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with the line (tr element)

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLine('My line').then(function(line) {
  console.log(line);
});

getLineActions(lineFinder) → {Promise}

Gets the list of available actions for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving whith the list of actions

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineActions('My line').then(function(actions) {
  console.log(actions);
});

getLineCells(lineFinder) → {Promise}

Gets all column values for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with the line column values

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineCells('My line').then(function(data) {
  console.log(data);
});

getLineCellValue(lineFinder, index) → {Promise}

Gets column value for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

index Number

Index of the column to read

Source:
Returns:

Promise resolving with the cell value

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();

// Get value of the third column for the line "Line name"
page.getLineCellValue('Line name', 3).then(function(text) {
  console.log(text);
});

getLineCellValues(lineFinder) → {Promise}

Gets all column values for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with all cell values

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineCellValues('Line name').then(function(cellValues) {
  console.log(cellValues);
});

getLineDetails(lineFinder) → {Promise}

Gets all column / field values of a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with the line details

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineDetails('My line').then(function(data) {
  console.log(data);
});

getLineFieldText(lineFinder, field) → {Promise}

Gets a field text for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

field String

The field id as described by getEditFormFields() method

Source:
Returns:

Promise resolving with the field text

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();

// Get text value of the "title" field for the line "Line name"
// "title" field must be defined by getEditFormFields() method
page.getLineFieldText('Line name', 'title').then(function(text) {
  console.log(text);
});

getLineFieldValues(lineFinder) → {Promise}

Gets all fields values for a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with the line fields values

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineFieldValues('My line').then(function(data) {
  console.log(data);
});

getLineInPage(name) → {Promise}

Gets a line within the current page.

Parameters:
Name Type Description
name String

The name of the line to look for (each column will be compared to this value)

Source:
Returns:

Promise resolving with the line (tr element)

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineInPage('My line').then(function(line) {
  console.log(line);
});

getLineInPageValues(headerTitle) → {Promise}

Gets values of a column for all lines in current page.

Parameters:
Name Type Description
headerTitle String

Title of the column to extract values from

Source:
Returns:

Promise resolving with the list of values

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineInPageValues('Name').then(function(values) {
 console.log(values);
});

getLinesInPage() → {Promise}

Gets all lines in the table page except the opened one.

Source:
Returns:

Promise resolving with the list of lines elements in the page (tr elements)

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLinesInPage().then(function(lines) {
  console.log(lines);
});

getLinesInPageNumber() → {Promise}

Gets the number of lines in the current page.

Source:
Returns:

Promise resolving with the number of lines in the page

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLinesInPageNumber().then(function(linesNumber) {
  console.log('This page contains ' + linesNumber + ' lines');
});

getLineValues(headerTitle) → {Promise}

Gets values of a column for all lines in all pages.

Parameters:
Name Type Description
headerTitle String

Title of the column to extract values from

Source:
Returns:

Promise resolving with the list of values

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getLineValues('Name').then(function(values) {
 console.log(values);
});

getPath() → {Promise}

Helper Url Get only current url path without host

Inherited From:
Source:
Returns:

Promise resolving with current path

Type
Promise

getSearchFields(Search) → {Object}

Gets search engine fields.

Parameters:
Name Type Description
Search Object

engine form element

Source:
Returns:

The list of fields

Type
Object

getTableHeaderIndex(name) → {Promise}

Gets the index of a header in the list of headers.

Be careful, the header index starts at 1 (not 0) due to the checkboxes occupying first column on each line.

Parameters:
Name Type Description
name String

The title of the header to look for

Source:
Returns:

Promise resolving with the index of the header

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getTableHeaderIndex('Action').then(function(index) {
  console.log('Action header index is ' + index);
});

getTitle() → {Promise}

Gets page title as described by the HTMLTitleElement.

Inherited From:
Source:
Returns:

Promise resolving with the title of the page

Type
Promise
Example
// With MyPage extending Page
var page = new MyPage();
assert.eventually.equal(page.getTitle(), 'My page title');

getTotalLines() → {Promise}

Gets total number of lines.

Source:
Returns:

Promise resolving with the total number of lines

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getTotalLines().then(function(totalLines) {
  console.log('There are ' + totalLines + ' lines');
});

getTotalPages() → {Promise}

Gets total number of pages.

Source:
Returns:

Promise resolving with the total number of pages

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getTotalPages().then(function(totalPages) {
  console.log('There are ' + totalPages + ' pages');
});

Gets the total number of page links.

Gets the number of page links in the pagination.

Source:
Returns:

Promise resolving with the total number of links

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.getTotalPaginationLinks().then(function(totalLinks) {
  console.log('There are ' + totalLinks + ' pagination links');
});

getUser() → {Object}

Gets current logged in user.

Inherited From:
Source:
Returns:

The current logged in user

Type
Object
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin().then(function() {
  console.log(page.getUser());
});

isEditionFormOnError() → {Promise}

Tests if the edition form is in error.

Source:
Returns:

Promise resolving with a boolean indicating if the edition form is on error

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isEditionFormOnError().then(function(isOnError) {
  console.log('Is edition form on error ? ' + isOnError);
});

isNextRangeLinkEnabled() → {Promise}

Tests if next page range link is enabled.

Source:
Returns:

Promise resolving whith a boolean indicating if the next range link is enabled

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isNextRangeLinkEnabled().then(function(isEnabled) {
  console.log('Is next range link enabled ?' + isEnabled);
});

isOpenedLine() → {Promise}

Tests if a line is opened.

As only one line can be opened at a time, no name is required.

Source:
Returns:

Promise resolving with a boolean indicating if a line is opened or not

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isOpenedLine().then(function(isOpened) {
  console.log('Is a line opened ? ' + isOpened);
});

isPreviousRangeLinkEnabled() → {Promise}

Tests if previous page range link is enabled.

Source:
Returns:

Promise resolving whith a boolean indicating if the previous range link is enabled

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isPreviousRangeLinkEnabled().then(function(isEnabled) {
  console.log('Is previous range link enabled ?' + isEnabled);
});

isSelectedLine(lineFinder) → {Promise}

Tests if a line is selected.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving with a boolean indicating if line is selected or not

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isSelectedLine('my line name').then(function(isSelected) {
  console.log('Is line selected ? ' + isSelected);
});

isSubMenuOpened(itemName) → {Promise}

Tests if a sub menu is opened.

Parameters:
Name Type Description
itemName String

The name of the menu item

Inherited From:
Source:
Returns:

Promise resolving with true if the sub menu is opened, false if it's closed

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.isSubMenuOpened('Rights').then(function(isOpened) {
  console.log('Is sub menu opened ?' + isOpened);
});

isTableHeader(name) → {Promise}

Tests if a header exists.

Parameters:
Name Type Description
name String

The title of the header to look for

Source:
Returns:

Promise resolving with a boolean indicating if the table header exists or not

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.isTableHeader('Action').then(function(isHeader) {
  console.log('Is there a column title named "Action" ? ' + isHeader);
});

lineCellContain(lineFinder, value) → {Promise}

Tests if line cells contain a text.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

value String

Value to look for

Source:
Returns:

Promise resolving with a boolean indicating if the given value correspond to a cell

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.lineCellContain('Line name', 'Text').then(function(contain) {
  console.log('Does my line "Line name" have a cell containing "Text" ? ' + contain);
});

load() → {Promise}

Loads the page and select the first available language.

This will automatically select the first language in the list of available languages.

Inherited From:
Source:
Returns:

Promise resolving when the page is loaded and language changed

Type
Promise
Example
var BackEndPage = require('@openveo/test').e2e.pages.BackEndPage;

function MyBackEndPage() {
  MyBackEndPage.super_.call(this);
  this.path = 'be/myBackEndPage';
}

module.exports = MyBackEndPage;
util.inherits(MyBackEndPage, BackEndPage);

var page = new MyBackEndPage();
page.logAsAdmin();
page.load().then(function() {
  console.log('Page fully loaded in the first language');
});

logAs(user) → {Promise}

Authenticates to the back end using the given account.

If an account is already logged in, it will be logged out.

Parameters:
Name Type Description
user Object

Information about the user

Inherited From:
Source:
Returns:

Promise resolving when authenticated to the back end

Type
Promise
Example
var user = {
  "email": "some-user@veo-labs.com",
  "password": "some-user"
}

// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAs(user).then(function() {
  console.log('Logged as some-user');
});

logAsAdmin() → {Promise}

Logs to the back end using the super administrator account.

The super administrator can perform any actions. If an account is already logged in, it will be logged out.

Inherited From:
Source:
Returns:

Promise resolving when authenticated as the super administrator

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin().then(function() {
  console.log('Logged as super admin');
});

logout() → {Promise}

Logs out current authenticated user.

This will lead to the login page.

Inherited From:
Source:
Returns:

Promise resolving when user is logged out and login page is displayed

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.logout().then(function() {
  console.log('Logged out');
});

logToCasAs(user) → {Promise}

Authenticates to the back end using the given CAS account.

cas-server-mock module must be used for this to work. Also process.protractorConf.casConf.userIdAttribute should be set to the name of the CAS user attribute which must be used as user's login. If an account is already logged in, it will be logged out.

Parameters:
Name Type Description
user Object

Information about the CAS user

Inherited From:
Source:
Returns:

Promise resolving when authenticated to the back end

Type
Promise
Example
var user =   {
  name: 'test',
  attributes: {
    name: 'test',
    mail: 'test@openveo.com',
    groups: ['test-group1', 'test-group2']
  }
};

// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logToCasAs(user).then(function() {
  console.log('Logged as test');
});

logToLdapAs(user) → {Promise}

Authenticates to the back end using the given LDAP account.

process.protractorConf.ldapConf.userIdAttribute should be set to the name of the LDAP user attribute which must be used as user's login. If an account is already logged in, it will be logged out.

Parameters:
Name Type Description
user Object

Information about the LDAP user

Inherited From:
Source:
Returns:

Promise resolving when authenticated to the back end

Type
Promise
Example
var user = {
  dn: 'cn=test,dc=test',
  cn: 'test',
  groups: 'test-group1,test-group2',
  mail: 'test@openveo.com'
};

// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logToLdapAs(user).then(function() {
  console.log('Logged as test');
});

onLoaded() → {Promise}

Handles page loaded.

Use this method to perform actions after the page is loaded. Typically, verify that the page is loaded by waiting for elements to be present on the page.

By default it does nothing, override it to define your own behaviour.

Inherited From:
Source:
Returns:

Promise resolving when the page is fully loaded

Type
Promise

openAddForm() → {Promise}

Opens add form.

Source:
Returns:

Promise resolving when add form is opened

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.openAddForm().then(function() {
  console.log('Add form opened');
});

openLine(lineFinder) → {Promise}

Opens a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving when line is opened

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.openLine('My line').then(function() {
  console.log('My line opened');
});

openMenu() → {Promise}

Opens left menu.

Inherited From:
Source:
Returns:

Promise resolving when left menu is opened

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.openMenu().then(function() {
  console.log('Left menu opened');
});

openSearchEngine() → {Promise}

Opens search engine.

Source:
Returns:

Promise resolving when search engine is opened

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.openSearchEngine().then(function() {
  console.log('Search engine opened');
});

openSubMenu(itemName) → {Promise}

Opens an item sub menu.

Parameters:
Name Type Description
itemName String

The name of the menu item

Inherited From:
Source:
Returns:

Promise resolving when sub menu is opened

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
page.logAsAdmin();
page.openSubMenu('Rights').then(function() {
  console.log('Rights sub menu opened');
});

performAction(lineFinder, action, confirmopt) → {Promise}

Performs an action on a single line.

Parameters:
Name Type Attributes Default Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

action String

The translated name of the action to perform

confirm Boolean <optional>
false

true to confirm the action, false otherwise

Source:
Returns:

Promise resolving when action is performed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.performAction('My line', 'Remove').then(function() {
  console.log('Action "Remove" has been performed on line "My line", confirmation dialog is opened');
});

mple

page.performAction('My line', 'Remove', true).then(function() {
  console.log('"My line" removed');
});

performMultipleAction(action, confirmopt) → {Promise}

Performs a grouped action.

At least one line must be selected.

Parameters:
Name Type Attributes Default Description
action String

The translated name of the action to perform

confirm Boolean <optional>
false

true to confirm the action, false otherwise

Source:
Returns:

Promise resolving when the action is performed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectAllLines();
page.performMultipleAction('Remove').then(function() {
  console.log('Action "Remove" performed on all selected lines, confirmation dialog is opened');
});

mple

page.performMultipleAction('Remove', true).then(function() {
  console.log('All lines removed');
});

refresh() → {Promise}

Refreshes actual page.

Inherited From:
Source:
Returns:

Promise resolving when the page is fully loaded

Type
Promise

removeAllLinesInPage() → {Promise}

Removes all lines in the page.

Source:
Returns:

Promise resolving when lines have been removed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.removeAllLinesInPage().then(function() {
  console.log('All lines in the page have been removed');
});

removeAllSelectedLinesInPage() → {Promise}

Removes all selected lines in the page.

Source:
Returns:

Promise resolving when lines have been removed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.removeAllLinesInPage().then(function() {
  console.log('Selected lines in the page have been removed');
});

removeLine(lineFinder) → {Promise}

Removes a line.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving when the line has been removed

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.removeLine('My line').then(function() {
  console.log('Line removed');
});

Searches in the list of lines using search engine.

Fills search fields.

Parameters:
Name Type Description
fields Object

List of values for fields returned by method getSearchFields

Source:
Returns:

Promise resolving when search is done

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();

var searchFieldsValues = {
  myField: 'Value'
};

page.search(searchFieldsValues).then(function() {
  console.Log('Search done');
});

selectAllLines() → {Promise}

Selects all lines.

At least, one line must be in the table.

Source:
Returns:

Promise resolving when all lines are selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectAllLines().then(function() {
  console.log('All lines selected');
});

selectFirstPage() → {Promise}

Selects the first page in pagination.

Source:
Returns:

Promise resolving when first page is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectFirstPage().then(function() {
  console.log('First page selected');
});

selectFirstPageRange() → {Promise}

Selects first page range in pagination.

Source:
Returns:

Promise resolving when first page range is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectFirstPageRange().then(function() {
  console.log('First range selected');
});

selectLanguage(language) → {Promise}

Sets page language.

It uses the top menu to change the language, a page reload will be performed.

Parameters:
Name Type Description
language Object

The language to load

Inherited From:
Source:
Returns:

Promise resolving when the page is reloaded with the expected language

Type
Promise
Example
// With MyBackEndPage extending BackEndPage
var page = new MyBackEndPage();
var languages = page.getLanguages();

page.logAsAdmin();
page.selectLanguage(languages[1]).then(function() {
  console.log('Page reloaded in french');
});

selectLastPage() → {Promise}

Selects the last page in pagination.

Source:
Returns:

Promise resolving when last page is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectLastPage().then(function() {
  console.log('Last page selected');
});

selectLastPageRange() → {Promise}

Selects last page range in pagination.

Source:
Returns:

Promise resolving when last page range is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectLastPageRange().then(function() {
  console.log('Last range selected');
});

selectLine(lineFinder) → {Promise}

Selects a line by checking the line checkbox.

Parameters:
Name Type Description
lineFinder String | Object

The name of the line (each column will be compared to this value) or the line element

Source:
Returns:

Promise resolving when line is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectLine('My line').then(function() {
  console.log('My line is selected');
});

selectNextPageRange() → {Promise}

Selects next page range in pagination.

Source:
Returns:

Promise resolving when next page range is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectNextPageRange().then(function() {
  console.log('Next range selected');
});

selectPage(page) → {Promise}

Selects a page in pagination.

Parameters:
Name Type Description
page Number

The page to select (starting at 1)

Source:
Returns:

Promise resolving when page is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectPage(5).then(function() {
  console.log('Page 5 selected');
});

selectPreviousPageRange() → {Promise}

Selects previous page range in pagination.

Source:
Returns:

Promise resolving when previous page range is selected

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.selectPreviousPageRange().then(function() {
  console.log('Previous range selected');
});

sendRequest(path, method, data) → {Promise}

Sends an http request and return its reponse.

This will execute the request from the page.

Parameters:
Name Type Description
path String

Request's path

method String

HTTP method to use

data Object

Request's data to send in body

Inherited From:
Source:
Returns:

Promise resolving with the request's response

Type
Promise

setLinesNumber(linesNumbers) → {Promise}

Sets the desired number of lines to display in the table.

Parameters:
Name Type Description
linesNumbers Number

Either 5, 10, 20 or 30

Source:
Returns:

Promise resolving when the expected number of lines is set

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.setLinesNumber(20).then(function() {
  console.log('20 lines are now displayed per page');
});

setSelectAllMouseOver() → {Promise}

Moves the cursor over the "select all" checkbox to display the information popover.

Source:
Returns:

Promise resolving when the mouse is over the "select all" checkbox

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.setSelectAllMouseOver().then(function() {
  console.log('Mouse over the "select all" checkbox');
});

sortBy(name, asc) → {Promise}

Sorts lines.

Parameters:
Name Type Description
name String

The value of the column to act on, each column will be compared to this value

asc Boolean

true to sort in ascendant order, false to sort in descendant order

Source:
Returns:

Promise resolving when column is clicked

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.sortBy('Name', true).then(function() {
  console.log('Lines sorted by Name');
});

submitAddForm() → {Promise}

Submit formular to add an item.

Source:
Returns:

Promise resolving when add form submit button has been clicked

Type
Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
page.logAsAdmin();
page.load();
page.submitAddForm().then(function() {
  console.log('Add form submitted');
});