Constructor
new TableAssert(page, helper)
Defines a table assertion helper to help writing assertions for table pages.
Parameters:
Name | Type | Description |
---|---|---|
page |
module:e2e/pages/TablePage~TablePage | The table page to test |
helper |
module:e2e/helpers/Helper~Helper | The helper to manipulate entities without interacting with the web browser |
- Source:
Example
var TableAssert = require('@openveo/test').e2e.asserts.TableAssert;
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
Members
(readonly) helper :module:e2e/helpers/Helper~Helper
The helper to manipulate entities.
Type:
- Source:
(readonly) page :module:e2e/pages/TablePage~TablePage
The page containing the table to test.
Type:
- Source:
Methods
(private, static) checkItemsPerPageButtons() → {Promise}
Checks if buttons to change the number of displayed items per page are displayed correctly depending on the actual number of lines in the table.
This:
- Source:
Returns:
Promise resolving when buttons have been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkItemsPerPageButtons();
(private, static) checkNavigation(totalElements, numberPerPage, indexopt) → {Promise}
Checks that table navigation is working.
Use table navigation links to navigate on pages and verify, on each page, the current page, total pages, total lines and the number of lines in the page.
This:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
totalElements |
Number | The total number of elements |
|
numberPerPage |
Number | The number of elements displayed per page |
|
index |
Number |
<optional> |
The page index |
- Source:
Returns:
Promise resolving when navigation has been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkPagination(50, 10);
checkActions(expectedActions) → {Promise}
Checks that line actions and global actions are the same.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
Parameters:
Name | Type | Description |
---|---|---|
expectedActions |
Array | Expected actions |
- Source:
Returns:
Promise resolving when actions have been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkActions(['Action 1', 'Action 2']);
checkCancelRemove() → {Promise}
Checks if canceling a remove action is working correctly.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
- Source:
Returns:
Promise resolving when cancel is checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkCancelRemove();
checkItemsPerPage() → {Promise}
Checks if buttons to change the number of displayed items per page are correctly displayed regarding the total number of lines.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
- Source:
Returns:
Promise resolving when buttons per page have been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkItemsPerPage();
checkLinesSelection(nameProperty) → {Promise}
Checks if selecting lines works.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
Parameters:
Name | Type | Description |
---|---|---|
nameProperty |
String | The property holding the name of the entity |
- Source:
Returns:
Promise resolving when selection have been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkLinesSelection();
checkMassiveRemove() → {Promise}
Checks if removing several lines at the same time works correctly.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
- Source:
Returns:
Promise resolving when massive remove has been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkMassiveRemove();
checkPagination() → {Promise}
Checks if pagination works correctly.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using page addEntitiesAuto / removeEntities methods.
- Source:
Returns:
Promise resolving when pagination has been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkPagination();
checkSearch(search, expectedValues, columnName) → {Promise}
Checks if search engine works correctly.
Parameters:
Name | Type | Description |
---|---|---|
search |
Object | A search description object |
expectedValues |
Array | The expected list of line values corresponding to the research |
columnName |
String | The name of the column to extract value from and compare to expectedValues |
- Source:
Returns:
Promise resolving when search has been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
var expectedValues = ['Test 1', 'Test 2'];
var search = { name: 'Name' };
// Execute search and get all values of column 'Name' then compare this values to the expected values
tableAssert.checkSearch(search, expectedValues, 'Name');
checkSort(property) → {Promise}
Checks if lines are correctly sorted for both ascending and descending order.
You don't need to add lines to the table before calling this method. Necessary lines are automatically added and then removed using helper addEntitiesAuto / removeEntities methods.
Parameters:
Name | Type | Description |
---|---|---|
property |
String | The name of the column to sort on |
- Source:
Returns:
Promise resolving when sort has been checked
- Type
- Promise
Example
// With MyTablePage extending TablePage
var page = new MyTablePage();
var helper = new MyHelper(new MyProvider());
var tableAssert = new TableAssert(page, helper);
tableAssert.checkSort('My column');