@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
287 lines (286 loc) • 16.2 kB
TypeScript
import { Ui5Selector, Ui5ControlMetadata, MatchMode } from "./types/ui5.types";
/**
* @class table
* @memberof ui5
*/
export declare class Table {
private vlf;
private ErrorHandler;
private static readonly SMART_TABLE_METADATA;
private static readonly TABLE_METADATA;
private static readonly UI_TABLE_METADATA;
private static readonly TREE_TABLE_METADATA;
private static readonly MDC_TABLE_METADATA;
private static readonly COLUMN_LIST_ITEM_METADATA;
private static readonly TABLE_ROW_METADATA;
private static readonly CHECKBOX_METADATA;
private static readonly SUPPORTED_TABLES_METADATA;
/**
* @function sortColumnAscending
* @memberOf ui5.table
* @description Sorts the given column "Ascending".
* @param {String} columnName - The name of the column to sort.
* @param {Ui5Selector} tableSelector - The selector describing the table element (in case there are more then one).
* @example await ui5.table.sortColumnAscending("Supplier");
* @example const glAccountItemsTable = {
* "elementProperties": {
* "viewName": "ui.s2p.mm.supplinvoice.manage.s1.view.S1",
* "metadata": "sap.m.Table",
* "id": "*idS2P.MM.MSI.TableGLAccountItems"
* }
* };
* await ui5.table.sortColumnAscending("Amount", glAccountItemsTable);
*/
sortColumnAscending(columnName: string, tableSelector: Ui5Selector, timeout?: number): Promise<void>;
/**
* @function sortColumnDescending
* @memberOf ui5.table
* @description Sorts the given column "Descending".
* @param {String} columnName The name of the column to sort.
* @param {Ui5Selector} tableSelector - The selector describing the table element (in case there are more then one).
* @example await ui5.table.sortColumnDescending("Supplier");
* @example const glAccountItemsTable = {
* "elementProperties": {
* "viewName": "ui.s2p.mm.supplinvoice.manage.s1.view.S1",
* "metadata": "sap.m.Table",
* "id": "*idS2P.MM.MSI.TableGLAccountItems"
* }
* };
* await ui5.table.sortColumnDescending("Amount", glAccountItemsTable);
*/
sortColumnDescending(columnName: string, tableSelector: Ui5Selector, timeout?: number): Promise<void>;
/**
* @function clickSettingsButton
* @memberOf ui5.table
* @description Opens the user Settings.
* @param {Ui5Selector} tableSelector - The selector describing the table element (in case there are more then one).
* @example await ui5.table.clickSettingsButton();
* @example const glAccountItemsTable = {
* "elementProperties": {
* "viewName": "ui.s2p.mm.supplinvoice.manage.s1.view.S1",
* "metadata": "sap.m.Table",
* "id": "*idS2P.MM.MSI.TableGLAccountItems"
* }
* };
* await ui5.table.clickSettingsButton(glAccountItemsTable);
*/
clickSettingsButton(tableSelector: Ui5Selector): Promise<void>;
/**
* @function getTotalNumberOfRows
* @memberOf ui5.table
* @description Returns the total number of rows in the table.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @returns {Number} The total number of rows in the table.
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* const numberOfRows = await ui5.table.getTotalNumberOfRows(selector);
*/
getTotalNumberOfRows(tableSelectorOrId: Ui5Selector | string): Promise<number>;
/**
* @function getTotalNumberOfRowsByValues
* @memberOf ui5.table
* @description Returns the total number of rows in the table that match the given values.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {String | Array<String>} values - The value(s) to match in the table rows.
* @param {Boolean} [enableHighlighting=true] - Enable or disable highlighting of found elements.
* @param {String} [matchMode="contains"] - The match mode for the values. Can be "contains", "exact" or "wordBoundary".
* @returns {Number} The total number of matching rows in the table.
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* const numberOfRows = await ui5.table.getTotalNumberOfRowsByValues(selector, ["value1", "value2"]);
* const numberOfRows = await ui5.table.getTotalNumberOfRowsByValues(selector, "value");
**/
getTotalNumberOfRowsByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, enableHighlighting?: boolean, matchMode?: MatchMode): Promise<number>;
/**
* @function getSelectorsForRowsByValues
* @memberOf ui5.table
* @description Gets the selectors of rows in the table that contain the given values. If multiple values are provided, it only returns the selectors of rows that contain all of them.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {String | Array<String>} values - The value(s) to match in the table rows.
* @param {Boolean} [enableHighlighting=true] - Enable or disable highlighting of found elements.
* @param {String} [matchMode="contains"] - The match mode for the values. Can be "contains", "exact" or "wordBoundary".
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable"
* await ui5.table.getSelectorsForRowsByValues(id, "February");
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.getSelectorsForRowsByValues(selector, ["January", "2022"]);
* @example
* await ui5.table.getSelectorsForRowsByValues(selector, ["January", "2022"], true, "exact");
*/
getSelectorsForRowsByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, enableHighlighting?: boolean, matchMode?: MatchMode): Promise<Array<Ui5Selector>>;
/**
* @function getSelectorForRowByIndex
* @memberOf ui5.table
* @description Gets the selector of a row in the table by its index.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {Number} index - The index of the item to open.
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* const rowSelector = await ui5.table.getSelectorForRowByIndex(selector, 0);
* @example id = "application-ReportingTask-run-component---ReportList--ReportingTable"
* const rowSelector = await ui5.table.getSelectorForRowByIndex(id, 0);
*/
getSelectorForRowByIndex(tableSelectorOrId: any, index: number): Promise<Ui5Selector>;
private getAllColumnValuesByName;
/**
* @function selectRowByIndex
* @memberOf ui5.table
* @description Selects a row in the table by its index.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {Number} index - The index of the row to select.
* @example await ui5.table.selectRowByIndex("application-ReportingTask-run-component---ReportList--ReportingTable", 0);
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.selectRowByIndex(selector, 0);
*/
selectRowByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
/**
* @function selectAllRows
* @memberOf ui5.table
* @description Selects all rows in the table.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @example await ui5.table.selectAllRows("application-ReportingTask-run-component---ReportList--ReportingTable");
* await ui5.table.selectAllRows(selector);
*/
selectAllRows(tableSelectorOrId: Ui5Selector | string): Promise<void>;
/**
* @function deselectRowByIndex
* @memberOf ui5.table
* @description Deselects a row in the table by its index.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.deselectRowByIndex(selector, 0);
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
* await ui5.table.deselectRowByIndex(id, 0);
*/
deselectRowByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
/**
* @function deselectAllRows
* @memberOf ui5.table
* @description Deselects all rows in the table.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @example await ui5.table.deselectAllRows("application-ReportingTask-run-component---ReportList--ReportingTable");
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.deselectAllRows(selector);
*/
deselectAllRows(tableSelectorOrId: Ui5Selector | string): Promise<void>;
/**
* @function selectRowByValues
* @memberOf ui5.table
* @description Selects a row in the table by matching value(s). First, all rows containing the given value(s) are collected.
* Then, the row at the given index within that list of matching rows is selected.
* This is useful when multiple rows match the same value(s) and you need to target a specific one.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table.
* @param {String | Array<String>} values - The value(s) to match in the table rows. If multiple values are provided, only rows containing all of them will match.
* @param {Number} [index=0] - The index within the list of matching rows (not the table row index). Defaults to 0 (first match). For example, if 3 rows match the given values, use index 1 to select the second match.
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.selectRowByValues(selector, ["value1", "value2"]);
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
* // Selects the second row that contains "value" (index 1 among matches, not table row index 1)
* await ui5.table.selectRowByValues(id, "value", 1);
*/
selectRowByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, index?: number): Promise<undefined>;
/**
* @function openItemByIndex
* @memberOf ui5.table
* @description Opens the item in the table by its index via right arrow icon or direct click.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {Number} index - The index of the item to open.
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.openItemByIndex(selector, 0);
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
* await ui5.table.openItemByIndex(id, 0);
*/
openItemByIndex(tableSelectorOrId: Ui5Selector | string, index: number): Promise<void>;
/**
* @function openItemByValues
* @memberOf ui5.table
* @description Opens the item in the table containing the given values. First, all rows containing the given value(s) are collected.
* Then, the row at the given index within that list of matching rows is opened.
* This is useful when multiple rows match the same value(s) and you need to target a specific one.
* @param {Ui5Selector | String} tableSelectorOrId - The selector or ID describing the table (sap.m.Table | sap.ui.comp.smarttable.SmartTable).
* @param {String | Array<String>} values - The value(s) to match in the table rows. If multiple values are provided, only rows containing all of them will match.
* @param {Number} [index=0] - The index within the list of matching rows (not the table row index). Defaults to 0 (first match). For example, if 3 rows match the given values, use index 1 to open the second match.
* @param {Boolean} [enableHighlighting=true] - Enable or disable highlighting of found elements.
* @param {String} [matchMode="contains"] - The match mode for the values. Can be "contains", "exact" or "wordBoundary".
* @example const selector = {
* elementProperties: {
* viewName: "gs.fin.runstatutoryreports.s1.view.ReportList",
* metadata: "sap.ui.comp.smarttable.SmartTable",
* id: "application-ReportingTask-run-component---ReportList--ReportingTable"
* }
* };
* await ui5.table.openItemByValues(selector, ["value1", "value2"]);
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
* await ui5.table.openItemByValues(id, "value");
* @example const id = "application-ReportingTask-run-component---ReportList--ReportingTable";
* await ui5.table.openItemByValues(id, "value", 0, false, "exact");
*/
openItemByValues(tableSelectorOrId: Ui5Selector | string, values: string | Array<string>, index?: number, enableHighlighting?: boolean, matchMode?: MatchMode): Promise<undefined>;
private static _resolveTableSelectorOrId;
private static _getId;
_getTableMetadata(tableId: string): Promise<Ui5ControlMetadata>;
private _constructTableSelector;
private _constructRowSelector;
private _getRowMetadataByTableMetadata;
private _extractRowCountFromTitle;
private _clickColumn;
private _getSortValueGridTable;
private _getSortIndicatorValue;
private _prepareAncestorSelector;
private _getSelectorTypeForRowSelection;
private _buildRowSelectionSelector;
private _selectRow;
private _clickRowOrArrowIcon;
}
declare const _default: Table;
export default _default;