☰ Reuse API
Constants
- common
Global namespace for common modules.
- util
Global namespace for util modules.
- ui5
Global namespace for UI5 modules.
- nonUi5
Global namespace for non UI5 modules.
- service
Global namespace for service modules.
- mobile
Global namespace for mobile modules.
common
Global namespace for common modules.
Kind: global constant
- common
- .assertion
- .date
- .getToday([format]) ⇒
String
- .getTomorrow([format]) ⇒
String
- .getNextMonth([format]) ⇒
String
- .getPreviousMonth([format]) ⇒
String
- .getNextYear([format]) ⇒
String
- .getPreviousYear([format]) ⇒
String
- .getSpecific(date, [format]) ⇒
String
- .calculate([date], [format]) ⇒
String
- .getToday([format]) ⇒
- .navigation
- .userInteraction
common.assertion
Kind: static class of common
assertion.expectEqual(value1, value2)
Expects the passed values to be equal.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value1 | Any |
Value (1) to be equal to value (2) |
value2 | Any |
Value (2) to be equal to value (1) |
Example
common.assertion.expectEqual(value1, value2);
assertion.expectUnequal(value1, value2)
Expects the passed values to be unequal.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value1 | Any |
Value (1) to be unequal to value (2) |
value2 | Any |
Value (2) to be unequal to value (1) |
Example
common.assertion.expectUnequal(value1, value2);
assertion.expectTrue(value)
Expects the passed value to be true.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value | Any |
Value to be equal to true |
Example
common.assertion.expectTrue(value);
assertion.expectFalse(value)
Expects the passed value to be false.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value | Boolean |
The value to be false. |
Example
common.assertion.expectFalse(false);
assertion.expectDefined(value)
Expects the passed values is defined.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value | Any |
Value to be defined (not undefined) |
Example
common.assertion.expectDefined(value);
assertion.expectUndefined(value)
Expects the passed values is undefined.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
value | Any |
Value to be undefined |
Example
common.assertion.expectUndefined(value);
assertion.expectUrlToBe()
Expects the url to be the passed value.
Kind: static method of assertion
Example
await common.assertion.expectUrlToBe("www.sap.com");
common.date
Kind: static class of common
- .date
- .getToday([format]) ⇒
String
- .getTomorrow([format]) ⇒
String
- .getNextMonth([format]) ⇒
String
- .getPreviousMonth([format]) ⇒
String
- .getNextYear([format]) ⇒
String
- .getPreviousYear([format]) ⇒
String
- .getSpecific(date, [format]) ⇒
String
- .calculate([date], [format]) ⇒
String
- .getToday([format]) ⇒
date.getToday([format]) ⇒ String
Returns the current day in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getToday("mm/dd/yyyy");
date.getTomorrow([format]) ⇒ String
Returns tomorrows date in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getTomorrow("mm/dd/yyyy");
date.getNextMonth([format]) ⇒ String
Returns the current day one month later in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getNextMonth("mm/dd/yyyy");
date.getPreviousMonth([format]) ⇒ String
Returns the current day one month before in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getPreviousMonth("mm/dd/yyyy");
date.getNextYear([format]) ⇒ String
Returns the current day one year later in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getNextYear("mm/dd/yyyy");
date.getPreviousYear([format]) ⇒ String
Returns the current day one year before in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getPreviousYear("mm/dd/yyyy");
date.getSpecific(date, [format]) ⇒ String
Returns a specific date in the given format.
Kind: static method of date
Returns: String
- The date in the given format.
Param | Type | Default | Description |
---|---|---|---|
date | String |
A specific date string. | |
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). |
Example
const date = await common.date.getSpecific("2020, 0, 17", "mm/dd/yyyy");
date.calculate([date], [format]) ⇒ String
Calculates the date based on the input parameter and returns it in the given format.
Kind: static method of date
Returns: String
- The calculated date in the given format.
Param | Type | Default | Description |
---|---|---|---|
[date] | String |
"today" |
Supported values: today, tomorrow, nextMonth, previousMonth, nextYear, previousYear |
[format] | String |
"object" |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "mmm d, yyyy", "datetime", "object"). |
Example
const date = await common.date.calculate("today", "mm/dd/yyyy");
common.navigation
Kind: static class of common
navigation.navigateToUrl(url)
Navigates to the passed url.
Kind: static method of navigation
Param | Type | Description |
---|---|---|
url | String |
The url. |
Example
await common.navigation.navigateToUrl("www.sap.com");
navigation.navigateToUrlAndRetry(url, [retries], [interval])
Navigates to the passed url and retries the function in case of a failure.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
url | String |
The url to navigate to. | |
[retries] | Integer |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Integer |
5000 |
The interval of the retries (ms), can be set in config for all functions under params stepRetriesIntervals. |
Example
await common.navigation.navigateToUrlAndRetry("www.sap.com");
common.userInteraction
Kind: static class of common
userInteraction.fillActive(value)
Fills the active input with the given value.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
value | String | Number |
The value to enter. |
Example
await common.userInteraction.fillActive("My Value");
userInteraction.fillActiveAndRetry(value, [retries], [interval])
Enters the given value to the active input field and retries the action in case it fails.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
value | String |
The value to enter. | |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await common.userInteraction.fillActiveAndRetry("My Value");
userInteraction.clearAndFillActive(value)
Clears and fills the active input.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
value | String |
The value to fill. |
Example
await common.userInteraction.clearAndFillActive("My Value");
userInteraction.clearAndFillActiveAndRetry(value, [retries], [interval])
CClears and fills the active input. Retries the action in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
value | String |
The value to fill. | |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await common.userInteraction.clearAndFillActiveAndRetry("My Value");
userInteraction.pressKey(keys)
Performs the specified keypress. Possible values: https://w3c.github.io/webdriver/#keyboard-actions
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
keys | String | Array.<String> |
The key or combination of keys to execute. |
Example
await common.userInteraction.pressKey("Enter");
await common.userInteraction.pressKey("\uE004");
await common.userInteraction.pressKey(["\uE009", "Alt"]);
userInteraction.pressEnter()
Performs the Enter keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressEnter();
userInteraction.pressTab()
Performs the Tab keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressTab();
userInteraction.pressF4()
Performs the F4 keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressF4();
userInteraction.pressBackspace()
Performs the Backspace keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressBackspace();
userInteraction.pressEscape()
Performs the Escape keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressEscape();
userInteraction.pressArrowLeft()
Performs the Arrow Left keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressArrowLeft();
userInteraction.pressArrowRight()
Performs the Arrow Right keypress.
Kind: static method of userInteraction
Example
await common.userInteraction.pressArrowRight();
util
Global namespace for util modules.
Kind: global constant
- util
- .browser
- .getBaseUrl() ⇒
String
- .setBaseUrl(baseUrl:)
- .logCurrentUrl()
- .getCurrentUrl()
- .resetFocus()
- .sleep([duration])
- .collectCoverage()
- .sleepAndCollectCoverage([duration])
- .refresh()
- .clearBrowser([clearLocal], [clearSession], [clearCookies])
- .getBrowserName() ⇒
String
- .getUI5Version([timeout])
- .logUI5Version()
- .executeScript(command) ⇒
Any
- .switchToNewWindow(titleOrUrl, [timeout])
- .switchToWindow(handle)
- .getCurrentWindow() ⇒
Object
- .switchToIframe(selector)
- .switchToDefaultContent()
- .back()
- .forward()
- .log(message)
- .warn(message)
- .error(message)
- .isMobile() ⇒
boolean
- .isAndroid() ⇒
boolean
- .isIos() ⇒
boolean
- .getBaseUrl() ⇒
- .component
- .console
- .data
- .getData(filename, [source]) ⇒
Object
- .getSecureData(filename, [source]) ⇒
Object
- .readDataFromFile(filePath) ⇒
Object
- .writeDataToFile(filePath, data)
- .decrypt(data) ⇒
String
- .getData(filename, [source]) ⇒
- .file
- .upload(files, [selector])
- .uploadWebGui(files, selector)
- .parsePdf(pdfStream, renderingMethod) ⇒
String
- .expectPdfContainsText(pdfStream, text, renderingMethod)
- .expectPdfNotContainsText(pdfStream, text, renderingMethod)
- .getExcelData(filePath, fileName, [sheetIndex], [conversionType])
- .getTextData(filePath)
- .expectTextDataToContain(filePath)
- .getXmlData(filePath)
- .getAttributeValuesFromJson(object)
- .findFilePathRecursively(directory, fileName)
- .getFileNamesByExtensions(dirPath, fileExtensions)
- .formatter
- .sliceStringAt(input, slicePoint, length) ⇒
String
- .sliceStringAfter(input, slicePoint, length) ⇒
String
- .trimString(input)
- .extractNumberFromString(input, [index]) ⇒
String
- .stringifyJSON(object) ⇒
String
- .addRemoveLeadingZeros(number, length) ⇒
String
- .formatDate(date, format, [locale]) ⇒
String
- .sliceStringAt(input, slicePoint, length) ⇒
- .function
- .system
- .getOS() ⇒
String
- .getOS() ⇒
- .browser
util.browser
Kind: static class of util
- .browser
- .getBaseUrl() ⇒
String
- .setBaseUrl(baseUrl:)
- .logCurrentUrl()
- .getCurrentUrl()
- .resetFocus()
- .sleep([duration])
- .collectCoverage()
- .sleepAndCollectCoverage([duration])
- .refresh()
- .clearBrowser([clearLocal], [clearSession], [clearCookies])
- .getBrowserName() ⇒
String
- .getUI5Version([timeout])
- .logUI5Version()
- .executeScript(command) ⇒
Any
- .switchToNewWindow(titleOrUrl, [timeout])
- .switchToWindow(handle)
- .getCurrentWindow() ⇒
Object
- .switchToIframe(selector)
- .switchToDefaultContent()
- .back()
- .forward()
- .log(message)
- .warn(message)
- .error(message)
- .isMobile() ⇒
boolean
- .isAndroid() ⇒
boolean
- .isIos() ⇒
boolean
- .getBaseUrl() ⇒
browser.getBaseUrl() ⇒ String
Retrieves the baseUrl from the configuration file.
Kind: static method of browser
Returns: String
- The baseUrl.
Example
const baseUrl = util.browser.getBaseUrl();
browser.setBaseUrl(baseUrl:)
Sets or overwrites the baseUrl in the configuration file.
Kind: static method of browser
Param | Type | Description |
---|---|---|
baseUrl: | String |
base URL to set |
Example
await util.browser.setBaseUrl("https://www.sap.com");
browser.logCurrentUrl()
Displays the current URL in the console.
Kind: static method of browser
Example
await util.browser.logCurrentUrl();
browser.getCurrentUrl()
Returns the current URL
Kind: static method of browser
Example
await util.browser.getCurrentUrl();
browser.resetFocus()
Resets the focus in case it set for a specific element.
Kind: static method of browser
Example
await util.browser.resetFocus();
browser.sleep([duration])
Sleeps (pauses execution) for the passed duration.
Kind: static method of browser
Param | Type | Default | Description |
---|---|---|---|
[duration] | Number |
1000 |
The time to pause (ms). |
Example
await util.browser.sleep(30000);
browser.collectCoverage()
Trigger collection of coverage by coverage service.
Kind: static method of browser
Example
await util.browser.collectCoverage();
browser.sleepAndCollectCoverage([duration])
Trigger collection of coverage by coverage service.
Kind: static method of browser
Param | Type | Default | Description |
---|---|---|---|
[duration] | Number |
1000 |
The time to pause (ms). |
Example
await util.browser.sleepAndCollectCoverage(3000);
browser.refresh()
Refreshes the page.
Kind: static method of browser
Example
await util.browser.refresh();
browser.clearBrowser([clearLocal], [clearSession], [clearCookies])
Clears the local and session cache and deletes all browser cookies.
Kind: static method of browser
Param | Type | Default | Description |
---|---|---|---|
[clearLocal] | Boolean |
true |
Specifies if the local cache will be cleared. |
[clearSession] | Boolean |
true |
Specifies if the session cache will be cleared. |
[clearCookies] | Boolean |
true |
Specifies if the cookies will be cleared. |
Example
await util.browser.clearBrowser();
browser.getBrowserName() ⇒ String
Retrieves the name of the current browser.
Kind: static method of browser
Returns: String
- The browser name.
Example
const browserName = util.browser.getBrowserName();
browser.getUI5Version([timeout])
Gets the UI5 version and creation date for UI5 based applications.
Kind: static method of browser
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await util.browser.getUI5Version();
browser.logUI5Version()
Logs the UI5 version and creation date for UI5 based applications to the console.
Kind: static method of browser
Example
await util.browser.logUI5Version();
browser.executeScript(command) ⇒ Any
Executes the specified JavaScript command.
Kind: static method of browser
Returns: Any
- The result from the executed function.
Param | Type | Description |
---|---|---|
command | String |
The command to execute. |
Example
await util.browser.executeScript(command);
browser.switchToNewWindow(titleOrUrl, [timeout])
Switches to the window or tab with the given title.
Kind: static method of browser
Param | Type | Default | Description |
---|---|---|---|
titleOrUrl | String | RegExp |
Window title or url of the expected window or tab (can be either a string or part of it as regular expression). | |
[timeout] | Number |
10000 |
The timeout to wait (ms). |
Example
await util.browser.switchToNewWindow("SAP - Home");
await util.browser.switchToNewWindow(/Home/);
await util.browser.switchToNewWindow("www.sap.com");
browser.switchToWindow(handle)
Switches to the passed window.
Kind: static method of browser
Param | Type | Description |
---|---|---|
handle | Object |
The window handle. |
Example
await util.browser.switchToWindow(originalWindowHandle);
browser.getCurrentWindow() ⇒ Object
Returns the current window handle.
Kind: static method of browser
Returns: Object
- The window handle.
Example
const originalWindowHandle = await util.browser.getCurrentWindow();
browser.switchToIframe(selector)
Switches to the passed iframe.
Kind: static method of browser
Param | Type | Description |
---|---|---|
selector | String |
The CSS selector describing the iframe element. |
Example
await util.browser.switchToIframe("iframe[id='frame01']");
browser.switchToDefaultContent()
Switches to the default content of the HTML page.
Kind: static method of browser
Example
await util.browser.switchToDefaultContent();
browser.back()
Go one step back in browser history.
Kind: static method of browser
Example
await util.browser.back();
browser.forward()
Go one step ahead in browser history.
Kind: static method of browser
Example
await util.browser.forward();
browser.log(message)
add log message to browser logs, can be viewed in the html report
Kind: static method of browser
Param | Type | Description |
---|---|---|
message | String |
string - The message to be logged. |
Example
await util.browser.log("Created PO 123456");
browser.warn(message)
add warning message to browser logs, can be viewed in the html report
Kind: static method of browser
Param | Type | Description |
---|---|---|
message | String |
string - The warning message to be logged. |
Example
await util.browser.warn("This is a warning message");
browser.error(message)
add error message to browser logs, can be viewed in the html report
Kind: static method of browser
Param | Type | Description |
---|---|---|
message | String |
string - The error message to be logged. |
Example
await util.browser.error("This is an error message");
browser.isMobile() ⇒ boolean
Indicates a mobile session
Kind: static method of browser
Returns: boolean
- Return true if its a mobile session driver.
Example
await util.browser.isMobile();
browser.isAndroid() ⇒ boolean
Indicates a mobile session
Kind: static method of browser
Returns: boolean
- Return true if its a Android session driver.
Example
await util.browser.isAndroid();
browser.isIos() ⇒ boolean
Indicates an iOS session
Kind: static method of browser
Returns: boolean
- Return true if its a iOS session driver.
Example
await util.browser.isIos();
util.component
Kind: static class of util
new component()
This class provides functions for writing component tests with qmate-proxy-service
component.loadEntryPoint([folderPath]) ⇒ Object
Will be called in component test scripts. Returns a previously stored entry point object for sharing information (like a draft id) between preparation and the actual component tests.
Kind: static method of component
Returns: Object
- The data object of the stored entry point.
Param | Type | Default | Description |
---|---|---|---|
[folderPath] | String |
"./entrypoints" |
Custom folder path where entry points are stored. |
Example
const entryPoint = util.component.loadEntryPoint();
component.storeEntryPoint(data, [folderPath])
Will be called in preparation scripts before component tests. Stores an entry point object for sharing information (like a draft id) between preparation and the actual component tests.
Kind: static method of component
Param | Type | Default | Description |
---|---|---|---|
data | Object |
The data object of the entry point to store. | |
[folderPath] | String |
"./entrypoints" |
Custom folder path where entry points are stored. |
Example
const entryPoint = util.component.storeEntryPoint({"draftId": "0123456789"});
util.console
Kind: static class of util
console.log(message, [textColor], [backgroundColor], [brightness])
Logs a message to the console in the given color.
Kind: static method of console
Param | Type | Description |
---|---|---|
message | String |
The message to log. |
[textColor] | String |
The color of the text: "black, white", "red", "yellow", "green", "blue", "cyan", "magenta". |
[backgroundColor] | String |
The color of the background: "black, white", "red", "yellow", "green", "blue", "cyan", "magenta". |
[brightness] | String |
Adjusts the brightness of the color: "bright", "dim". Leave empty for default. |
Example
util.console.log("The document has been saved.", "green");
console.error(message)
Logs a error message to the console in red.
Kind: static method of console
Param | Type | Description |
---|---|---|
message | String |
The message to log. |
Example
util.console.error("Error: Please investigate.");
console.warn(message)
Logs a warning message to the console in yellow.
Kind: static method of console
Param | Type | Description |
---|---|---|
message | String |
The message to log. |
Example
util.console.warn("Optional step not executed.");
console.success(message)
Logs a success message to the console in green.
Kind: static method of console
Param | Type | Description |
---|---|---|
message | String |
The message to log. |
Example
util.console.success("The document has been saved.");
console.info(message)
Logs a info message to the console in cyan.
Kind: static method of console
Param | Type | Description |
---|---|---|
message | String |
The message to log. |
Example
util.console.success("The document has been saved.");
util.data
Kind: static class of util
- .data
- .getData(filename, [source]) ⇒
Object
- .getSecureData(filename, [source]) ⇒
Object
- .readDataFromFile(filePath) ⇒
Object
- .writeDataToFile(filePath, data)
- .decrypt(data) ⇒
String
- .getData(filename, [source]) ⇒
data.getData(filename, [source]) ⇒ Object
Returns the data object with the given filename (JSON, stored in data folder).
Kind: static method of data
Returns: Object
- The data object.
Param | Type | Default | Description |
---|---|---|---|
filename | String |
The name of the data file. | |
[source] | String |
data |
The source key defined under params.import of the config file. |
Example
const data = util.data.getData("myTest");
data.getSecureData(filename, [source]) ⇒ Object
Returns and encrypts the data object with the given filename (JSON, stored in data folder). Will return the local file object if private key is not accessible.
Kind: static method of data
Returns: Object
- The encrypted or local data object.
Param | Type | Default | Description |
---|---|---|---|
filename | String |
The name of the data file (without suffix '.secure' or '.local'). | |
[source] | String |
data |
The source key defined under params.import of the config file. |
Example
const secureData = util.data.getSecureData("myTest");
data.readDataFromFile(filePath) ⇒ Object
Reads the data object from the given filepath.
Kind: static method of data
Returns: Object
- The data object.
Param | Type | Description |
---|---|---|
filePath | String |
The filepath. |
Example
const data = util.data.readDataFromFile("./data/myData.json");
data.writeDataToFile(filePath, data)
Writes the data object to the given filepath.
Kind: static method of data
Param | Type | Description |
---|---|---|
filePath | String |
The filepath. |
data | Object |
The data object to write. |
Example
const data = util.data.writeDataToFile("myTest");
data.decrypt(data) ⇒ String
Decrypts the passed input data.
Kind: static method of data
Returns: String
- The decrypted data.
Param | Type | Description |
---|---|---|
data | String | Array.<String> |
The encrypted data to decrypt. Single value or array of values for different keys. |
Example
const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7bef334d26a391a1934cf47338b749d99426980ee4cc7a81deaef21439c6894ab0324cdb29b9b6332635baca442651c5d37847f52bb90b8868e037271a7d456024b39b65fdf4dc62e8d82a3d5683a72e4324c59d339742fc79749f0ee74abef916d38e306218adc48e3547a2b346962249320c962d22cb46d9998de36d8219a2496c0997d0fc389f76fb1431a9b57c317886e9c9795c0a09ad98d9fa0b7687d10814dc7973397f3f72a227a04ead4c3d1d428c096a51922ffc4d7afc3952df1c130def5c5fb3e834605cbf1454885966cc65c77046343f4c678e74931fb2dd6cac8dae17837cf674f288d6550dd7fa6b01f5b7ea68aa6bd27d79dd5d53edb5fd4b4edce824bd31b3939352ad7a71a16bab8c54025c2bb92c54e022fcd23ff08bc54a17fc50d00dc3b884cadbfdefe1e75901fdf80e7324ad02a891f2c4863fa120ca238520b79126c65a03");
util.file
Kind: static class of util
- .file
- .upload(files, [selector])
- .uploadWebGui(files, selector)
- .parsePdf(pdfStream, renderingMethod) ⇒
String
- .expectPdfContainsText(pdfStream, text, renderingMethod)
- .expectPdfNotContainsText(pdfStream, text, renderingMethod)
- .getExcelData(filePath, fileName, [sheetIndex], [conversionType])
- .getTextData(filePath)
- .expectTextDataToContain(filePath)
- .getXmlData(filePath)
- .getAttributeValuesFromJson(object)
- .findFilePathRecursively(directory, fileName)
- .getFileNamesByExtensions(dirPath, fileExtensions)
file.upload(files, [selector])
Uploads all the file/s by the paths given in the Array.
Kind: static method of file
Param | Type | Default | Description |
---|---|---|---|
files | Array.<String> |
Array with path/s of file/s to be uploaded. | |
[selector] | String |
"input[type='file']" |
Custom selector of uploader control (in case there are more then one present). |
Example
await util.file.upload(["path/to/text1.txt", "path/to/text2.txt"]); // uses the default uploader control
await util.file.upload(["path/to/text1.txt", "path/to/text2.txt"], "input[id='myUpload']"); // upload to file uploader with matching selector
file.uploadWebGui(files, selector)
Uploads all the file/s by the paths given in the Array for SAP WebGUI apps.
Kind: static method of file
Param | Type | Description |
---|---|---|
files | Array.<String> |
Array with path/s of file/s to be uploaded. |
selector | String |
Custom selector of the input element |
Example
await util.file.uploadWebGui(["path/to/text1.txt"], "INPUT[title='External file name']");
file.parsePdf(pdfStream, renderingMethod) ⇒ String
Parses the text from PDF stream. Returned text can be asserted to verify the PDF document content.
Kind: static method of file
Returns: String
- The parsed PDF text.
See: Parse PDF
Param | Type | Description |
---|---|---|
pdfStream | Buffer |
PDF stream to be downloaded. |
renderingMethod | function |
Function to customize the parsing process. |
Example
await util.file.parsePdf(pdfStream, customRenderingMethod);
file.expectPdfContainsText(pdfStream, text, renderingMethod)
Parses the PDF and checks for given text to be contained in PDF.
Kind: static method of file
See: Parse pdf
Param | Type | Description |
---|---|---|
pdfStream | Buffer |
PDF stream to be downloaded. |
text | String |
The expected text. |
renderingMethod | function |
Function to customize the parsing process. |
Example
await util.file.expectPdfContainsText(pdfStream, "abc");
file.expectPdfNotContainsText(pdfStream, text, renderingMethod)
Parses the PDF and checks for given text not to be contained in PDF.
Kind: static method of file
See: Parse pdf
Param | Type | Description |
---|---|---|
pdfStream | Buffer |
PDF stream to be downloaded |
text | String |
The text expected to be not contained in the PDF. |
renderingMethod | function |
Function to customize the parsing process. |
Example
await util.file.expectPdfNotContainsText(pdfStream, "abc");
file.getExcelData(filePath, fileName, [sheetIndex], [conversionType])
- It returns the excel data based on the conversion type which is passed
Kind: static method of file
Param | Type | Description |
---|---|---|
filePath | string |
File path is required |
fileName | string |
File Name is required |
[sheetIndex] | number |
sheetIndex is required |
[conversionType] | string |
Value for this are [json, csv, txt] |
Example
const myTableContent = await util.file.getExcelData("/Users/path/myWork", "myTable.xlx");
file.getTextData(filePath)
- Returns the content of a .txt file.
Kind: static method of file
Param | Type | Description |
---|---|---|
filePath | string |
Path to the file. |
Example
const txtData = await util.file.getTextData(path.resolve(__dirname, "./testFiles/test3.txt"));
const isDateIncluded = txtData.includes("26.6.2023");
common.assertion.expectEqual(isDateIncluded, true);
file.expectTextDataToContain(filePath)
- Reads the specified .txt file and asserts if it includes a specific string.
Kind: static method of file
Param | Type | Description |
---|---|---|
filePath | string |
Path to the file. |
Example
await util.file.expectTextDataToContain("/Users/path/myWork", "supplierList.txt");
file.getXmlData(filePath)
- Returns the converted JSON object based on the passed XML file.
Kind: static method of file
Param | Type | Description |
---|---|---|
filePath | string |
Path to the file. |
Example
const xmlData = await util.file.getXmlData(path.resolve(__dirname, "./testFiles/test2.xml"));
file.getAttributeValuesFromJson(object)
- Traverses the passed JSON object and returns the value/s of the passed attribute if found. Else returns empty Array.
Kind: static method of file
Param | Type | Description |
---|---|---|
object | object |
The JSON Object to search through. |
Example
const attribute = util.file.getAttributeValuesFromJson(xmlData, "CtrlSum");
file.findFilePathRecursively(directory, fileName)
- Returns the absolute path of the file with the given filename. Searches Recursively for the file within the given directory.
Kind: static method of file
Param | Type | Description |
---|---|---|
directory | string |
The name of the directory. |
fileName | string |
The name of the file. |
Example
await util.file.findFilePathRecursively("/Users","test.xls");
file.getFileNamesByExtensions(dirPath, fileExtensions)
- Returns the filename/s of the given directory filtered by the given extensions.
Kind: static method of file
Param | Type | Description |
---|---|---|
dirPath | string |
The path to the directory. |
fileExtensions | string | Array.<string> |
The file extension as string or multiple as string array. |
Example
const fileName = await util.file.getFileNamesByExtensions("regression/downloads", "xml");
const fileNames = await util.file.getFileNamesByExtensions("regression/downloads", "["xml", "txt"]");
util.formatter
Kind: static class of util
- .formatter
- .sliceStringAt(input, slicePoint, length) ⇒
String
- .sliceStringAfter(input, slicePoint, length) ⇒
String
- .trimString(input)
- .extractNumberFromString(input, [index]) ⇒
String
- .stringifyJSON(object) ⇒
String
- .addRemoveLeadingZeros(number, length) ⇒
String
- .formatDate(date, format, [locale]) ⇒
String
- .sliceStringAt(input, slicePoint, length) ⇒
formatter.sliceStringAt(input, slicePoint, length) ⇒ String
Slices the given string beginning at a specific substring.
Kind: static method of formatter
Returns: String
- The sliced string.
Param | Type | Description |
---|---|---|
input | String |
The input string to slice. |
slicePoint | String |
The substring at which the input string is being sliced. |
length | number |
The required length of the returning string (starting at the index of the passed slice point). |
Example
const sliced = util.formatter.sliceStringAt("prefixNR12345postfix", "NR", 7);
// returns "NR12345"
formatter.sliceStringAfter(input, slicePoint, length) ⇒ String
Slices the given string after a specific substring.
Kind: static method of formatter
Returns: String
- The sliced string.
Param | Type | Description |
---|---|---|
input | String |
The input string to slice. |
slicePoint | String |
The substring after which the input string is being sliced. |
length | number |
The required length of the returning string (starting at the index after the passed slice point). |
Example
const sliced = util.formatter.sliceStringAfter("prefixNR12345postfix", "NR", 5);
// returns "12345"
formatter.trimString(input)
Removes whitespace from both sides of the given string.
Kind: static method of formatter
Param | Type | Description |
---|---|---|
input | String |
The input string to trim. |
Example
const trimmed = util.formatter.trimString(" value ");
// returns "value"
formatter.extractNumberFromString(input, [index]) ⇒ String
Extracts all numbers from a string.
Kind: static method of formatter
Returns: String
- The extracted number.
Param | Type | Default | Description |
---|---|---|---|
input | String |
The input string to extract the number. | |
[index] | number |
0 |
If there are multiple numbers in the string you can pass an index to return a specific number. |
Example
const extracted = util.formatter.extractNumberFromString("prefixNR12345postfix");
// returns "12345"
const extracted = util.formatter.extractNumberFromString("first12345 someText second 20 abc", 1);
// returns "20"
formatter.stringifyJSON(object) ⇒ String
Converts a JSON object to string.
Kind: static method of formatter
Returns: String
- The converted JSON object.
Param | Type | Description |
---|---|---|
object | Object |
The JSON to be converted. |
Example
console.log(`Printing the current selector: ${util.formatter.stringifyJSON(selector)}`);
formatter.addRemoveLeadingZeros(number, length) ⇒ String
Adds or removes leading zeros to the passed number to format it to the required length.
Kind: static method of formatter
Returns: String
- The formatted number.
Param | Type | Description |
---|---|---|
number | String |
The number to be formatted. |
length | Number |
The required length of the number. |
Example
const itemNumber = util.formatter.addRemoveLeadingZeros(10, 5);
formatter.formatDate(date, format, [locale]) ⇒ String
formats date.
Kind: static method of formatter
Returns: String
- The formatted date as string.
Param | Type | Default | Description |
---|---|---|---|
date | Date |
The date object to be formatted. | |
format | String |
The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "mmm d, yyyy", "datetime", "object"). | |
[locale] | String |
"en-US" |
The locale format of the date. E.g. "en-US", "de-DE", etc. |
Example
const date = new Date(2020, 0, 17);
const formattedDate = util.formatter.formatDate(date, "mm/dd/yyyy");
// returns "01/17/2020"
const date = new Date(2022, 3, 12);
const formattedDate = util.formatter.formatDate(date, "mmm dd, yyyy");
// returns "Apr 03, 2022"
util.function
Kind: static class of util
function.retry(fct, args, [retries], [interval], [scope])
Retries the passed function n times with a specific interval until it executed successfully.
Kind: static method of function
Param | Type | Default | Description |
---|---|---|---|
fct | function |
The function to retry. | |
args | Array |
An array of the arguments passed to the function. | |
[retries] | Integer |
3 |
The number of retries. Can be set in config for all functions under "params" - "stepsRetries". |
[interval] | Integer |
5000 |
The interval of the retries (ms). Can be set in config for all functions under "params" - "stepRetriesIntervals". |
[scope] | Object |
|
The function scope. Defaults is the global object. |
Example
await util.function.retry(ui5.userInteraction.fill, [selector, value], 4, 10000);
await util.function.retry(async () => {
await ui5.userInteraction.fill(selector, "ABC");
}, [], 2, 30000);
function.executeOptional(fct, args)
Executes the given function optionally. If it fails, a promise will be returned anyway.
Kind: static method of function
Param | Type | Description |
---|---|---|
fct | function |
The function to execute. |
args | Array |
An array of the arguments passed to the function. |
Example
await util.function.executeOptional(ui5.userInteraction.fill, [selector, value]);
await util.function.executeOptional(async () => {
await ui5.userInteraction.fill(selector, "ABC");
}, []);
util.system
Kind: static class of util
system.getOS() ⇒ String
Returns the current operating system.
Kind: static method of system
Returns: String
- AIX | Android | MacOS | FreeBSD | Linux | OpenBSD | Windows | SunOS
Example
const os = await util.system.getOS();
ui5
Global namespace for UI5 modules.
Kind: global constant
- ui5
- .assertion
- .expectAttributeToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectAttributeToContain(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectTextToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectValueToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectValueToBeDefined(selector, [index], [timeout])
- .expectToBeNotEnabled(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeEnabled(selector, [index], [timeout], [loadPropertyTimeout])
- .expectValidationError(selector, [index], [timeout], [loadPropertyTimeout])
- .expectValidationSuccess(selector, [index], [timeout], [loadPropertyTimeout])
- .expectBindingPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectBindingContextPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectToBeVisible(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeVisibleInViewport(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeNotVisible(selector, [index], [timeout])
- .expectMessageToastTextToBe(text, [timeout])
- .confirmationDialog
- .control
- .execute(callbackFunction, selectorOrElement, args)
- .focus(selector, [index], [timeout])
- .getProperty(selectorOrElement, propertyName)
- .getAggregationProperty(selectorOrElement, propertyName)
- .getAssociationProperty(selectorOrElement, propertyName)
- .getBindingContextPathProperty(selectorOrElement)
- .getPropertyBinding(selectorOrElement, propertyName) ⇒
Array
- .date
- .element
- .waitForAll(selector, [timeout])
- .getAllDisplayed(selector, [timeout]) ⇒
Array.<Object>
- .getDisplayed(selector, [index], [timeout]) ⇒
Object
- .getByText(selector, value, [index], [timeout]) ⇒
Object
- .getByChild(elementSelector, childSelector, [index], [timeout]) ⇒
Object
- .getByParent(elementSelector, parentSelector, [index], [timeout]) ⇒
Object
- .getId(selector, [index], [timeout]) ⇒
String
- .getPropertyValue(selector, property, [index], [timeout]) ⇒
any
- .getValue(selector, [index], [timeout]) ⇒
String
- .getBindingValue(selector, bindingContext, [index], [timeout]) ⇒
String
- .isVisible(selector, [index], [timeout]) ⇒
Boolean
- .highlight(selector, [duration], [color])
- .errorDialog
- .footerBar
- .mockserver
- .waitForUi5ApplicationLoad(interval)
- .interactWithMockServer(mockServerPath, fnCallback, oParams)
- .attachFunctionBefore(method, mockServerPath, fnBeforeCallback, oParams)
- .attachFunctionAfter(method, mockServerPath, fnAfterCallback, oParams)
- .addNewRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
- .removeRequest(method, mockServerPath, urlPathRegex)
- .addOrOverrideRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
- .startMockServer(mockServerPath)
- .initMockServer(mockServerPath, mockServerOptions)
- .initApplication(mockServerPath)
- .stopMockServer(mockServerPath)
- .loadMockDataFile(filePath, isText) ⇒
String
- .getEntitySetData(mockServerPath, entitySetName) ⇒
Array
- .setEntitySetData(mockServerPath, entitySetName, entries)
- .navigation
- .navigateToApplication(intent, [preventPopups], [verify], [refresh])
- .navigateToApplicationAndRetry(intent, [preventPopups], [verify], [retries], [interval])
- .navigateToSystemAndApplication(system, intent, [closePopups], [verify])
- .navigateToSystemAndApplicationAndRetry(system, intent, [closePopups], [verify], [retries], [interval])
- .navigateToApplicationWithQueryParams(intent, queryParams, [preventPopups], [verify])
- .navigateToApplicationWithQueryParamsAndRetry(intent, queryParams, [preventPopups], [verify], [retries], [interval])
- .closePopups([timeout])
- .expectUnsupportedNavigationPopup(navigationTarget)
- .navigationBar
- .qunit
- .session
- .login(username, [password], [verify], [timeout])
- .loginFiori(username, [password], [verify])
- .loginSapCloud(username, [password], [verify])
- .loginCustom(username, [password], usernameFieldSelector, passwordFieldSelector, logonButtonSelector, [verify])
- .loginCustomViaConfig(username, [password], [verify])
- .logout([verify])
- .switchUser(username, [password], [authenticator], [wait])
- .expectLogoutText()
- .table
- .userInteraction
- .click(selector, [index], [timeout])
- .clickAndRetry(selector, [index], [timeout], [retries], [interval])
- .doubleClick(selector, [index], [timeout])
- .rightClick(selector, [index], [timeout])
- .clickTab(selector, [index], [timeout])
- .clickListItem(selector, [index], [timeout])
- .check(selector, [index], [timeout])
- .uncheck(selector, [index], [timeout])
- .fill(selector, value, [index], [timeout])
- .fillAndRetry(selector, value, [index], [timeout], [retries], [interval])
- .clear(selector, [index], [timeout])
- .clearAndRetry(selector, [index], [timeout], [retries], [interval])
- .clearAndFill(selector, value, [index], [timeout])
- .clearAndFillAndRetry(selector, value, [index], [timeout], [retries], [interval], [verify])
- .clearSmartFieldInput(selector, [index], [timeout])
- .clearAndFillSmartFieldInput(selector, value, [index], [timeout])
- .clearAndFillSmartFieldInputAndRetry(selector, value, [index], [timeout], [retries], [interval])
- .selectBox(selector, value, [index])
- .selectComboBox(selector, value, [index])
- .selectMultiComboBox(selector, values, [index])
- .clickSelectArrow(selector, [index])
- .clickSelectArrowAndRetry(selector, [index], [retries], [interval])
- .selectFromTab(selector, value, [index], [timeout])
- .mouseOverElement(selector, [index], [timeout])
- .scrollToElement(selector, [index], [alignment], [timeout])
- .selectAll([selector], [index], [timeout])
- .openF4Help(selector, [index], [timeout], useF4Key)
- .searchFor(selector, [index], [timeout], useEnter)
- .resetSearch(selector, [index], [timeout])
- .assertion
ui5.assertion
Kind: static class of ui5
- .assertion
- .expectAttributeToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectAttributeToContain(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectTextToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectValueToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectValueToBeDefined(selector, [index], [timeout])
- .expectToBeNotEnabled(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeEnabled(selector, [index], [timeout], [loadPropertyTimeout])
- .expectValidationError(selector, [index], [timeout], [loadPropertyTimeout])
- .expectValidationSuccess(selector, [index], [timeout], [loadPropertyTimeout])
- .expectBindingPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectBindingContextPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
- .expectToBeVisible(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeVisibleInViewport(selector, [index], [timeout], [loadPropertyTimeout])
- .expectToBeNotVisible(selector, [index], [timeout])
- .expectMessageToastTextToBe(text, [timeout])
assertion.expectAttributeToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements attribute to be the compare value.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
attribute | String |
The attribute to be compared. | |
compareValue | String | Boolean | Number | Object |
The compare value. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectAttributeToBe(selector, "text", "Hello");
assertion.expectAttributeToContain(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements attribute to contain the compare value.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
attribute | String |
The attribute to be compared. | |
compareValue | String |
The compare value. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectAttributeToContain(selector, "text", "abc");
assertion.expectTextToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements text attribute to be the compare value.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
compareValue | String |
The compare value. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectTextToBe(selector, "Hello");
assertion.expectValueToBe(selector, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements value attribute to be the compare value.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
compareValue | String | Number |
The compare value. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectValueToBe(selector, "123");
assertion.expectValueToBeDefined(selector, [index], [timeout])
Expects the passed elements value to be defined.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.assertion.expectValueToBeDefined(selector);
assertion.expectToBeNotEnabled(selector, [index], [timeout], [loadPropertyTimeout])
Expects that the element is enabled to the user.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectToBeNotEnabled(selector);
assertion.expectToBeEnabled(selector, [index], [timeout], [loadPropertyTimeout])
Expects that the element is enabled to the user.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectToBeEnabled(selector);
assertion.expectValidationError(selector, [index], [timeout], [loadPropertyTimeout])
Expects the "valueState" of the element to be "Error".
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectValidationError(selector);
assertion.expectValidationSuccess(selector, [index], [timeout], [loadPropertyTimeout])
Expects the valueState of the element to be "None".
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectValidationSuccess(selector);
assertion.expectBindingPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements attribute binding-path to contain the compare value
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
attribute | String |
The attribute to be compared. | |
compareValue | String | Array.<String> |
The compare value(s). | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectBindingPathToBe(selector, "text", "Hello");
assertion.expectBindingContextPathToBe(selector, attribute, compareValue, [index], [timeout], [loadPropertyTimeout])
Expects the passed elements binding-context-path to be the compare value.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
attribute | String |
The attribute to be compared. | |
compareValue | String |
The compare value. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectBindingContextPathToBe(selector, "text", "Hello");
assertion.expectToBeVisible(selector, [index], [timeout], [loadPropertyTimeout])
Expects that the element is visible to the user.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectToBeVisible(selector);
assertion.expectToBeVisibleInViewport(selector, [index], [timeout], [loadPropertyTimeout])
Expects that the element is visible in the viewport.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[loadPropertyTimeout] | Number |
10000 |
The timeout to wait for a specific property to have the given compare value. |
Example
await ui5.assertion.expectToBeVisibleInViewport(selector);
assertion.expectToBeNotVisible(selector, [index], [timeout])
Expects that the element is not visible to the user.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). Recommendation is to lower the timeout since the element is not expected to show up. |
Example
await ui5.assertion.expectToBeNotVisible(selector, 0, 5000);
assertion.expectMessageToastTextToBe(text, [timeout])
Expects the message toast with the passed text.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
text | String |
The expected text. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.assertion.expectMessageToastTextToBe(text);
ui5.confirmationDialog
Kind: static class of ui5
confirmationDialog.clickButton(text, [timeout])
Clicks the button with the given text at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Default | Description |
---|---|---|---|
text | String |
The text of the button. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.confirmationDialog.clickButton("Ok");
confirmationDialog.clickOk([timeout])
Clicks the "OK" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.confirmationDialog.clickOk();
confirmationDialog.clickCancel([timeout])
Clicks the "Cancel" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.confirmationDialog.clickCancel();
confirmationDialog.clickYes([timeout])
Clicks the "Yes" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Description |
---|---|---|
[timeout] | Number |
The timeout to wait (default value: 30 sec). |
Example
await ui5.confirmationDialog.clickYes();
confirmationDialog.clickNo([timeout])
Clicks the "Yes" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Description |
---|---|---|
[timeout] | Number |
The timeout to wait (default value: 30 sec). |
Example
await ui5.confirmationDialog.clickNo();
confirmationDialog.clickCreate([timeout])
Clicks the create button in the confirmation dialog
Kind: static method of confirmationDialog
Param | Type | Description |
---|---|---|
[timeout] | Number |
The timeout to wait (default value: 30 sec). |
Example
await ui5.confirmationDialog.clickCreate();
confirmationDialog.clickDelete([timeout])
Clicks the "Delete" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Description |
---|---|---|
[timeout] | Number |
The timeout to wait (default value: 30 sec). |
Example
await ui5.confirmationDialog.clickDelete();
confirmationDialog.clickRevokeApproval([timeout])
Clicks the "Revoke Approval" button at the confirmation dialog.
Kind: static method of confirmationDialog
Param | Type | Description |
---|---|---|
[timeout] | Number |
The timeout to wait (default value: 30 sec). |
Example
await ui5.confirmationDialog.clickRevokeApproval();
ui5.control
Kind: static class of ui5
- .control
- .execute(callbackFunction, selectorOrElement, args)
- .focus(selector, [index], [timeout])
- .getProperty(selectorOrElement, propertyName)
- .getAggregationProperty(selectorOrElement, propertyName)
- .getAssociationProperty(selectorOrElement, propertyName)
- .getBindingContextPathProperty(selectorOrElement)
- .getPropertyBinding(selectorOrElement, propertyName) ⇒
Array
control.execute(callbackFunction, selectorOrElement, args)
Executes a native UI5 action as callback function in the browser on the given UI5 control.
Kind: static method of control
Param | Type | Description |
---|---|---|
callbackFunction | function |
The client script function to be used with the control instance. Caution: The first and last parameter is reserved for the mockserver instance and the promise resolve function - done. |
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed). |
args | Object |
An object containing the arguments to pass to the callback function. |
Example
const selector = {"elementProperties":{"metadata":"sap.m.StandardListItem", "id": "*categoryList-7"}};
const args = {"property": "text"};
const title = await ui5.control.execute(function (control, args, done) {
done(control.getProperty(args.property));
}, selector, args);
control.focus(selector, [index], [timeout])
Focuses on the element with the given selector to get it into view. If focus is not possible scrollToElement is used.
Kind: static method of control
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.control.focus(selector);
await ui5.control.focus(selector, 0, 5000);
control.getProperty(selectorOrElement, propertyName)
Gets the UI5 control property of the given element.
Kind: static method of control
Param | Type | Description |
---|---|---|
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed) |
propertyName | String |
The property name of the control to retrieve the value from. |
Example
const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "title":[{"path":"CategoryName"}] }};
const elem = await ui5.element.getDisplayed(selector);
const propertyName = "title";
const val = await ui5.control.getProperty(elem, propertyName);
control.getAggregationProperty(selectorOrElement, propertyName)
Gets the UI5 control aggregation property of the given element.
Kind: static method of control
Param | Type | Description |
---|---|---|
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed) |
propertyName | String |
The aggregation property name of the control to retrieve the value from. |
Example
const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "items":[{"path":"/Categories"}] }};
const elem = await ui5.element.getDisplayed(selector);
const propertyName = "tooltip";
const val = await ui5.control.getAggregationProperty(elem, propertyName);
control.getAssociationProperty(selectorOrElement, propertyName)
Get UI control property
Kind: static method of control
Param | Type | Description |
---|---|---|
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed) |
propertyName | String |
The association property name of the control to retrieve the value from. |
Example
const selector = { "elementProperties":{"metadata":"sap.m.MultiComboBox","mProperties":{}};
const elem = await ui5.element.getDisplayed(selector);
const propertyName = "selectedItems";
const propertyValue = await ui5.control.getAssociationProperty(elem, propertyName);
control.getBindingContextPathProperty(selectorOrElement)
Get UI control binding context path
Kind: static method of control
Param | Type | Description |
---|---|---|
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed) |
Example
const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{"title":[{"path":"CategoryName"}] }};
const elem = await ui5.element.getDisplayed(selector);
const context = await ui5.control.getBindingContextPathProperty(elem);
control.getPropertyBinding(selectorOrElement, propertyName) ⇒ Array
Get UI control property
Kind: static method of control
Returns: Array
- Array of bindings for the specific property
Param | Type | Description |
---|---|---|
selectorOrElement | Element | Ui5Selector | Ui5SelectorWithOptions |
The selector object, selector with options (selector, index, timeout) or the dom element (retrieved from ui5.element.getDisplayed) |
propertyName | String |
The property name to retrieve from the control binding |
Example
const selector = { "elementProperties":{"metadata":"sap.m.StandardListItem","mProperties":{ "title":[{"path":"CategoryName"}] }};
const elem = await ui5.element.getDisplayed(selector);
const propertyName = "title";
const binding = await ui5.control.getPropertyBinding(elem, propertyName);
ui5.date
Kind: static class of ui5
date.pick(selector, date, [index])
Picks the passed date using the "DatePicker" with the given selector.
Kind: static method of date
Param | Type | Default | Description |
---|---|---|---|
selector | Selector |
The selector describing the element. | |
date | Date |
The date object. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
const today = await common.date.calculate("today");
await ui5.date.pick(selector, today);
date.pickRange(selector, range, [index])
Picks the passed date range using the "DatePicker" with the given selector. Note that this will only work within the current month!
Kind: static method of date
Param | Type | Default | Description |
---|---|---|---|
selector | Selector |
The selector describing the element. | |
range | Array.<Object> |
The array of date objects containing start- and end date. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
const start = await common.date.calculate("2020, 9, 20");
const end = await common.date.calculate("2021, 1, 3");
const range = [start, end];
await ui5.date.pickRange(selector, range);
date.fillRange(selector, range, [index])
Enters the passed date range to the date input with the given selector by providing the start- and end date.
Kind: static method of date
Param | Type | Default | Description |
---|---|---|---|
selector | Selector |
The selector describing the element. | |
range | Array.<Object> |
The array of date objects containing start- and end date. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
const start = await common.date.calculate("2020, 9, 20", "dd.mm.yyyy");
const end = await common.date.calculate("2021, 1, 3", "dd.mm.yyyy");
const range = [start, end];
await ui5.date.fillRange(selector, range);
ui5.element
Kind: static class of ui5
- .element
- .waitForAll(selector, [timeout])
- .getAllDisplayed(selector, [timeout]) ⇒
Array.<Object>
- .getDisplayed(selector, [index], [timeout]) ⇒
Object
- .getByText(selector, value, [index], [timeout]) ⇒
Object
- .getByChild(elementSelector, childSelector, [index], [timeout]) ⇒
Object
- .getByParent(elementSelector, parentSelector, [index], [timeout]) ⇒
Object
- .getId(selector, [index], [timeout]) ⇒
String
- .getPropertyValue(selector, property, [index], [timeout]) ⇒
any
- .getValue(selector, [index], [timeout]) ⇒
String
- .getBindingValue(selector, bindingContext, [index], [timeout]) ⇒
String
- .isVisible(selector, [index], [timeout]) ⇒
Boolean
- .highlight(selector, [duration], [color])
element.waitForAll(selector, [timeout])
Waits for all elements matching the given selector.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the elements. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.element.waitForAll(selector);
element.getAllDisplayed(selector, [timeout]) ⇒ Array.<Object>
Returns the visible elements with the given selector.
Kind: static method of element
Returns: Array.<Object>
- - The found elements.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the elements. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await ui5.element.getAllDisplayed(selector);
element.getDisplayed(selector, [index], [timeout]) ⇒ Object
Returns the visible element.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await ui5.element.getDisplayed(selector);
element.getByText(selector, value, [index], [timeout]) ⇒ Object
Returns the element with the given selector and text value.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The text value of the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await ui5.element.getByText(selector, "Home");
element.getByChild(elementSelector, childSelector, [index], [timeout]) ⇒ Object
Gets an element by its selector and child selector. Can be used as unique combination between element and child properties when multiple elements have the same properties. Note: For nested selectors, all properties except of the "elementProperties" are being ignored.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
elementSelector | String |
The selector describing the requested element. | |
childSelector | String |
The selector describing a child element of the requested element. | |
[index] | Number |
0 |
The index of the element (in case the combination applies to more than one element). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elementSelector = {
"elementProperties": {...}
};
const childSelector = {
"elementProperties": {...}
};
const elem = await ui5.element.getByChild(elementSelector, childSelector);
element.getByParent(elementSelector, parentSelector, [index], [timeout]) ⇒ Object
Gets an element by its selector and parent selector. Can be used as unique combination between element and parent properties when multiple elements have the same properties. Note: For nested selectors, all properties except of the "elementProperties" are being ignored.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
elementSelector | String |
The selector describing the requested element. | |
parentSelector | String |
The selector describing the parent element of the requested element. | |
[index] | Number |
0 |
The index of the element (in case the combination applies to more than one element). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elementSelector = {
"elementProperties": {...}
};
const parentSelector = {
"elementProperties": {...}
};
const elem = await ui5.element.getByParent(elementSelector, parentSelector);
element.getId(selector, [index], [timeout]) ⇒ String
Returns the id of the element with the given selector.
Kind: static method of element
Returns: String
- The id of the element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elemId = await ui5.element.getId(selector);
element.getPropertyValue(selector, property, [index], [timeout]) ⇒ any
Returns the UI5 property value of the passed element.
Kind: static method of element
Returns: any
- The property value of the element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
property | String |
The property of the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elemValue = await ui5.element.getPropertyValue(selector, "text");
element.getValue(selector, [index], [timeout]) ⇒ String
Returns the inner value of the passed element.
Kind: static method of element
Returns: String
- The value of the element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elemValue = await ui5.element.getValue(selector);
element.getBindingValue(selector, bindingContext, [index], [timeout]) ⇒ String
Returns the value of the given binding property for a specific element.
Kind: static method of element
Returns: String
- The binding property value.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
bindingContext | String |
The binding property to retrieve. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elemBindingValue = await ui5.element.getBindingValue(selector, "InvoiceGrossAmount");
element.isVisible(selector, [index], [timeout]) ⇒ Boolean
Determines if the element is visible.
Kind: static method of element
Returns: Boolean
- The bool value 'true' or 'false' if the element is visible or not.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const isVisible = await ui5.element.isVisible(selector);
element.highlight(selector, [duration], [color])
Highlights the element with the given selector.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[duration] | Number |
2000 |
The duration of the highlighting (ms). |
[color] | String |
"red" |
The color of the highlighting (CSS color). |
Example
await ui5.element.highlight(selector, 3000, "green");
ui5.errorDialog
Kind: static class of ui5
errorDialog.expectToBeVisible()
Expects that the error dialog is visible on the page.
Kind: static method of errorDialog
Example
await ui5.errorDialog.expectToBeVisible();
errorDialog.clickClose()
Clicks the 'Close' button at the error dialog.
Kind: static method of errorDialog
Example
await ui5.errorDialog.clickClose();
ui5.footerBar
Kind: static class of ui5
footerBar.clickButton(text, [timeout])
Clicks the button with the given text at the footer bar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
text | String |
The text of the button. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickButton("Ok");
footerBar.clickApply([timeout])
Clicks the 'Apply' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickApply();
footerBar.clickSave([timeout])
Clicks the 'Save' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickSave();
footerBar.clickCreate([timeout])
Clicks the 'Create' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickCreate();
footerBar.clickCancel([timeout])
Clicks the 'Cancel' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickCancel();
footerBar.clickCheck([timeout])
Clicks the 'Check' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickCheck();
footerBar.clickOrder([timeout])
Clicks the 'Order' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickOrder();
footerBar.clickPost([timeout])
Clicks the 'Post' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickPost();
footerBar.clickAdd([timeout])
Clicks the 'Add' button at the footer toolbar.
Kind: static method of footerBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.footerBar.clickAdd();
ui5.mockserver
Kind: static class of ui5
- .mockserver
- .waitForUi5ApplicationLoad(interval)
- .interactWithMockServer(mockServerPath, fnCallback, oParams)
- .attachFunctionBefore(method, mockServerPath, fnBeforeCallback, oParams)
- .attachFunctionAfter(method, mockServerPath, fnAfterCallback, oParams)
- .addNewRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
- .removeRequest(method, mockServerPath, urlPathRegex)
- .addOrOverrideRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
- .startMockServer(mockServerPath)
- .initMockServer(mockServerPath, mockServerOptions)
- .initApplication(mockServerPath)
- .stopMockServer(mockServerPath)
- .loadMockDataFile(filePath, isText) ⇒
String
- .getEntitySetData(mockServerPath, entitySetName) ⇒
Array
- .setEntitySetData(mockServerPath, entitySetName, entries)
mockserver.waitForUi5ApplicationLoad(interval)
Waits for the UI5 framework to load and makes sure XHR request finished und busy indicators are not visible anymore.
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
interval | Integer |
The intervals to use when waiting UI5 to load. |
Example
await ui5.mockserver.waitForUi5ApplicationLoad(100);
mockserver.interactWithMockServer(mockServerPath, fnCallback, oParams)
Execute client script function to enable interaction with mockserver instance [you can write code in ui5 app context]
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver instance |
fnCallback | String | Object |
The client script function that you can use to interact with your mockserver instance. [Caution] The first and last parameter is reserved (1st param is the mockserver instance and last parameter the promise resolve function - done) |
oParams | String |
Additional parameters you would like to inject in your client script function |
Example
await ui5.mockserver.interactWithMockServer("path/to/project/localService/main/mockserver", fnCallback, oParams);
mockserver.attachFunctionBefore(method, mockServerPath, fnBeforeCallback, oParams)
Attaches a callback function in mockserver attachBefore event to be executed
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
method | String |
The attachAfter http method [GET or POST]. |
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method so the mockserver instance can be consumed]. |
fnBeforeCallback | String | Object |
The callback function to be used in the native attachBefore method as described (https://sapui5.hana.ondemand.com/#/api/sap.ui.core.ui5.mockserver%23methods/Summary) |
oParams | Object |
Additional parameters you would like to inject in your client script function |
Example
await ui5.mockserver.attachFunctionBefore("GET", "path/to/project/localService/main/mockserver", fnBeforeCallback, oParams);
mockserver.attachFunctionAfter(method, mockServerPath, fnAfterCallback, oParams)
Attaches a callback function in mockserver attachAfter event to be executed
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
method | String |
The attachAfter http method [GET or POST]. |
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method so the mockserver instance can be consumed]. |
fnAfterCallback | String | Object |
The callback function to be used in the native attachAfter method as described (https://sapui5.hana.ondemand.com/#/api/sap.ui.core.ui5.mockserver%23methods/Summary) |
oParams | Object |
Additional parameters you would like to inject in your client script function |
Example
await ui5.mockserver.attachFunctionAfter("GET", "path/to/project/localService/main/mockserver", fnAfterCallback);
mockserver.addNewRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
Adds new mock request
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
method | String |
The http method [GET,POST..]. |
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
urlPathRegex | String |
The url path regex to filter the requests |
responseJsonPath | String |
The json object or the path to your json file to be used as response [use relative path from the html page started]. |
returnCode | Integer |
The http response code to simulate for this mock request. |
isText | Boolean |
If true then content type is text/plain otherwise application/json. |
responseMessages | String |
Mocks the gw sap-message response messages [Don't forget to stringify your json before: JSON.stringify(msg)] |
responseLocation | String |
Mocks the location response messages header |
Example
await ui5.mockserver.addNewRequest("GET","path/to/project/localService/main/mockserver", "*.Headers.*", "path/to/project/localService/main/mockdata/test.json", 200, true, JSON.stringify(msg));
mockserver.removeRequest(method, mockServerPath, urlPathRegex)
Removes request mock [Doesn't work currently - Mockserver bug]
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
method | String |
The http method [GET,POST..]. |
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
urlPathRegex | String |
The url path regex to filter the requests |
Example
await ui5.mockserver.removeRequest("GET","path/to/project/localService/main/mockserver", "*.Headers.*");
mockserver.addOrOverrideRequest(method, mockServerPath, urlPathRegex, responseJsonPath, returnCode, isText, responseMessages, responseLocation)
Adds new or overrides an existing mock request
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
method | String |
The http method [GET,POST..]. |
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
urlPathRegex | String |
The url path regex to filter the requests |
responseJsonPath | String |
The json object or the path to your json file to be used as response [use relative path from the html page started]. |
returnCode | Integer |
The http response code to simulate for this mock request. |
isText | Boolean |
If true then content type is text/plain otherwise application/json. |
responseMessages | String |
Mocks the gw sap-message response messages [Don't forget to stringify your json before: JSON.stringify(msg)] |
responseLocation | String |
Mocks the location response messages header |
Example
await ui5.mockserver.addOrOverrideRequest("GET","path/to/project/localService/main/mockserver", "*.Headers.*", "path/to/project/localService/main/mockdata/test.json", 200, true, JSON.stringify(msg));
mockserver.startMockServer(mockServerPath)
(Re-)Starts mock server instance
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
Example
await ui5.mockserver.startMockServer("path/to/project/localService/main/mockserver");
mockserver.initMockServer(mockServerPath, mockServerOptions)
Initializes the provide mockserver instance on the fly
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
mockServerOptions | String |
The mock server options |
Example
await ui5.mockserver.initMockServer("path/to/project/localService/main/mockserver", mockServerOptions);
mockserver.initApplication(mockServerPath)
Initializes the application [Used in the beggining of script, once the mockserver is fully initialized and request mocking is done]
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
Example
await ui5.mockserver.initApplication("path/to/project/localService/main/mockserver");
mockserver.stopMockServer(mockServerPath)
Stops the mockserver instance
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
Example
await ui5.mockserver.stopMockServer("path/to/project/localService/main/mockserver");
mockserver.loadMockDataFile(filePath, isText) ⇒ String
Loads a mock data file
Kind: static method of mockserver
Returns: String
- The json object
Param | Type | Description |
---|---|---|
filePath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
isText | Boolean |
If true then content type is text/plain otherwise application/json. |
Example
await ui5.mockserver.loadMockDataFile("path/to/project/mockData/myData.json", true);
mockserver.getEntitySetData(mockServerPath, entitySetName) ⇒ Array
Retrieves entity data
Kind: static method of mockserver
Returns: Array
- An array of json objects
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
entitySetName | String |
The entity set name |
Example
await ui5.mockserver.getEntitySetData("path/to/project/localService/main/mockserver", "Headers");
mockserver.setEntitySetData(mockServerPath, entitySetName, entries)
Override entity data entries
Kind: static method of mockserver
Param | Type | Description |
---|---|---|
mockServerPath | String |
The full path to your mockserver file [make sure you implemented getMockServer method in this file to return the mockserver instance]. |
entitySetName | String |
The entity name |
entries | String |
The json object to be used as data to be inserted [use relative path from the html page started]. |
Example
await ui5.mockserver.setEntitySetData("path/to/project/localService/main/mockserver", "Headers", entries);
ui5.navigation
Kind: static class of ui5
- .navigation
- .navigateToApplication(intent, [preventPopups], [verify], [refresh])
- .navigateToApplicationAndRetry(intent, [preventPopups], [verify], [retries], [interval])
- .navigateToSystemAndApplication(system, intent, [closePopups], [verify])
- .navigateToSystemAndApplicationAndRetry(system, intent, [closePopups], [verify], [retries], [interval])
- .navigateToApplicationWithQueryParams(intent, queryParams, [preventPopups], [verify])
- .navigateToApplicationWithQueryParamsAndRetry(intent, queryParams, [preventPopups], [verify], [retries], [interval])
- .closePopups([timeout])
- .expectUnsupportedNavigationPopup(navigationTarget)
navigation.navigateToApplication(intent, [preventPopups], [verify], [refresh])
Navigates to the application via the passed intent. The intent will be added to the baseUrl maintained in the config.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
intent | String |
The intent of the application. | |
[preventPopups] | Boolean |
false |
Specifies if random popup appearance should be prevented. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
[refresh] | Boolean |
false |
Refresh the page after navigation. |
Example
await ui5.navigation.navigateToApplication("PurchaseOrder-manage");
navigation.navigateToApplicationAndRetry(intent, [preventPopups], [verify], [retries], [interval])
Navigates to the application via the passed intent, and retries in case it fails.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
intent | String |
The intent of the app. | |
[preventPopups] | Boolean |
false |
Specifies if random popup appearance should be prevented. Might not work for specific popups. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.navigation.navigateToApplicationAndRetry("PurchaseOrder-manage");
navigation.navigateToSystemAndApplication(system, intent, [closePopups], [verify])
Navigates within the passed system to the application via the passed intent.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
system | String |
The system url. | |
intent | String |
The intent of the application. | |
[closePopups] | Boolean |
false |
Specifies if random popups should be closed after the navigation. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
Example
await ui5.navigation.navigateToSystemAndApplication("yourFioriLaunchpad.domain", "PurchaseOrder-manage");
navigation.navigateToSystemAndApplicationAndRetry(system, intent, [closePopups], [verify], [retries], [interval])
Navigates within the passed system to the application via the passed intent, and retries in case it fails.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
system | String |
The system url. | |
intent | String |
The intent of the application. | |
[closePopups] | Boolean |
false |
Specifies if random popups should be closed after the navigation. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.navigation.navigateToSystemAndApplicationAndRetry("yourFioriLaunchpad.domain", "PurchaseOrder-manage");
navigation.navigateToApplicationWithQueryParams(intent, queryParams, [preventPopups], [verify])
Navigates to the application with the passed queryParams via the passed intent.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
intent | String |
The intent of the app. | |
queryParams | String |
[OPTIONAL] Add url query params. | |
[preventPopups] | Boolean |
false |
Specifies if random popup appearance should be prevented. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
Example
const intent = "PurchaseOrder-manage"
const queryParams = "?sap-language=EN&responderOn=true";
await ui5.navigation.navigateToApplicationWithQueryParams(intent, queryParams);
navigation.navigateToApplicationWithQueryParamsAndRetry(intent, queryParams, [preventPopups], [verify], [retries], [interval])
Navigates to the application via the passed intent, and retries in case it fails.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
intent | String |
The intent of the app. | |
queryParams | String |
[OPTIONAL] Add url query params. | |
[preventPopups] | Boolean |
false |
Specifies if random popup appearance should be prevented. |
[verify] | Boolean |
false |
Specifies if the url should be asserted after the navigation. |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
const intent = "PurchaseOrder-manage"
const queryParams = "?sap-language=EN&responderOn=true";
await ui5.navigation.navigateToApplicationWithQueryParamsAndRetry(intent, queryParams);
navigation.closePopups([timeout])
Closes all popups if they occur after navigating to a specific page.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait. |
Example
await ui5.navigation.closePopups();
navigation.expectUnsupportedNavigationPopup(navigationTarget)
Expects navigation to an app that is not supported. This can be the case for Mocked tests when the application does not exist or when the app is not included in a role.
Kind: static method of navigation
Param | Type | Description |
---|---|---|
navigationTarget | String |
The selector describing the element. |
Example
await ui5.navigation.expectUnsupportedNavigationPopup("#SupplierInvoice-display?FiscalYear=1234&SupplierInvoice=1234567890");
ui5.navigationBar
Kind: static class of ui5
navigationBar.clickBack([timeout])
Navigates one layer back.
Kind: static method of navigationBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.navigationBar.clickBack();
navigationBar.clickSapLogo([timeout])
Clicks at the SAP Logo.
Kind: static method of navigationBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.navigationBar.clickSapLogo();
navigationBar.clickUserIcon([timeout])
Clicks at the Account Icon.
Kind: static method of navigationBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.navigationBar.clickUserIcon();
navigationBar.expectPageTitle(compareValue)
Expects the page title of the current page to be the compare value.
Kind: static method of navigationBar
Param | Type | Description |
---|---|---|
compareValue | String |
The compare value. |
Example
await ui5.navigationBar.expectPageTitle("Home");
navigationBar.expectShellHeader([timeout])
Expects the shell header to be visible
Kind: static method of navigationBar
Param | Type | Default | Description |
---|---|---|---|
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.navigationBar.expectShellHeader();
ui5.qunit
Kind: static class of ui5
qunit.executeTests(path)
Executes QUnit & OPA5 tests. Qmate acts like a runner.
Kind: static method of qunit
Param | Type | Description |
---|---|---|
path | String |
Relative path to the QUnit/OPA5 html file. |
Example
await ui5.qunit.executeTests("path/to/qunit.html");
ui5.session
Kind: static class of ui5
- .session
- .login(username, [password], [verify], [timeout])
- .loginFiori(username, [password], [verify])
- .loginSapCloud(username, [password], [verify])
- .loginCustom(username, [password], usernameFieldSelector, passwordFieldSelector, logonButtonSelector, [verify])
- .loginCustomViaConfig(username, [password], [verify])
- .logout([verify])
- .switchUser(username, [password], [authenticator], [wait])
- .expectLogoutText()
session.login(username, [password], [verify], [timeout])
Login with specific username and password. This function works for both fiori and sap-cloud login.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
[password] | String |
The password. | |
[verify] | Boolean |
false |
Specifies if the function will check the shell header after logging in. |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.session.login("PURCHASER");
await ui5.session.login("JOHN_DOE", "abc123!", true);
session.loginFiori(username, [password], [verify])
Login with fioriForm and specific username and password.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
[password] | String |
The password. | |
[verify] | Boolean |
false |
Specifies if the function will check the shell header after logging in. |
Example
await ui5.session.loginFiori("john", "abc123!");
session.loginSapCloud(username, [password], [verify])
Login with sapCloud form and specific username and password.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
[password] | String |
The password. | |
[verify] | Boolean |
false |
Specifies if the function will check the shell header after logging in. |
Example
await ui5.session.loginSapCloud("john", "abc123!");
session.loginCustom(username, [password], usernameFieldSelector, passwordFieldSelector, logonButtonSelector, [verify])
Login with custom form and specific username and password.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
[password] | String |
"super-duper-sensitive-pw" |
The password. |
usernameFieldSelector | String |
The CSS selector of the username field. | |
passwordFieldSelector | String |
The CSS selector of the password field. | |
logonButtonSelector | String |
The CSS selector of the login button. | |
[verify] | Boolean |
false |
Specifies if the function will check the shell header after logging in. |
Example
await ui5.session.loginCustom("JOHN_DOE", "abc123!", "#username", #password, "#logon");
session.loginCustomViaConfig(username, [password], [verify])
Login with specific username and password. The selectors will be taken from the config.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. Can be specified in spec or config. If specified in both credentials will be taken from config. | |
[password] | String |
The password. Can be specified in spec or config. If specified in both credentials will be taken from config. | |
[verify] | Boolean |
false |
Specifies if the function will check the shell header after logging in. |
Example
// config - SAMPLE 1
auth: {
formType: 'plain',
usernameFieldSelector: "#USERNAME_BLOCK input",
passwordFieldSelector: "#PASSWORD_BLOCK input",
logonButtonSelector: "#LOGIN_LINK"
},
// spec
await ui5.session.loginCustomViaConfig("JOHN_DOE", "abc123!");
// config - SAMPLE 2
auth: {
formType: "plain",
username: "PURCH_EXT",
password: "super-duper-sensitive-pw",
usernameFieldSelector: "#USERNAME_BLOCK input",
passwordFieldSelector: "#PASSWORD_BLOCK input",
logonButtonSelector: "#LOGIN_LINK"
},
// spec
await ui5.session.loginCustomViaConfig();
session.logout([verify])
Logs the user out.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
[verify] | Boolean |
"true" |
Specifies if the function will check the logout text after logging out. Set this to false if the system does not show the text after logging out. |
Example
await ui5.session.logout();
session.switchUser(username, [password], [authenticator], [wait])
switches the user according to the passed username and password.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
[password] | String |
The password. | |
[authenticator] | Object |
The login form type. Set to null to use generic login. | |
[wait] | Number |
10000 |
The waiting time between logout and login (ms). |
Example
await ui5.session.switchUser("PURCHASER");
const authenticator = ui5.authenticators.fioriForm;
await ui5.session.switchUser("PURCHASER", "super-duper-sensitive-pw", authenticator, 30000);
session.expectLogoutText()
Expects the logout text after logout to be "You have been logged off. This is essential for chaining scripts, so that no static browser sleep in the spec itself is required anymore.
Kind: static method of session
Example
await ui5.session.expectLogoutText();
ui5.table
Kind: static class of ui5
table.sortColumnAscending(columnName, [tableSelector])
Sorts the given column "Ascending".
Kind: static method of table
Param | Type | Description |
---|---|---|
columnName | String |
The name of the column to sort. |
[tableSelector] | Object |
The selector describing the table element (in case there are more then one). |
Example
await ui5.table.sortColumnAscending("Supplier");
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);
table.sortColumnDescending(columnName, [tableSelector])
Sorts the given column "Descending".
Kind: static method of table
Param | Type | Description |
---|---|---|
columnName | String |
The name of the column to sort. |
[tableSelector] | Object |
The selector describing the table element (in case there are more then one). |
Example
await ui5.table.sortColumnDescending("Supplier");
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);
table.clickSettingsButton([tableSelector])
Opens the user Settings.
Kind: static method of table
Param | Type | Description |
---|---|---|
[tableSelector] | Object |
The selector describing the table element (in case there are more then one). |
Example
await ui5.table.clickSettingsButton();
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);
ui5.userInteraction
Kind: static class of ui5
- .userInteraction
- .click(selector, [index], [timeout])
- .clickAndRetry(selector, [index], [timeout], [retries], [interval])
- .doubleClick(selector, [index], [timeout])
- .rightClick(selector, [index], [timeout])
- .clickTab(selector, [index], [timeout])
- .clickListItem(selector, [index], [timeout])
- .check(selector, [index], [timeout])
- .uncheck(selector, [index], [timeout])
- .fill(selector, value, [index], [timeout])
- .fillAndRetry(selector, value, [index], [timeout], [retries], [interval])
- .clear(selector, [index], [timeout])
- .clearAndRetry(selector, [index], [timeout], [retries], [interval])
- .clearAndFill(selector, value, [index], [timeout])
- .clearAndFillAndRetry(selector, value, [index], [timeout], [retries], [interval], [verify])
- .clearSmartFieldInput(selector, [index], [timeout])
- .clearAndFillSmartFieldInput(selector, value, [index], [timeout])
- .clearAndFillSmartFieldInputAndRetry(selector, value, [index], [timeout], [retries], [interval])
- .selectBox(selector, value, [index])
- .selectComboBox(selector, value, [index])
- .selectMultiComboBox(selector, values, [index])
- .clickSelectArrow(selector, [index])
- .clickSelectArrowAndRetry(selector, [index], [retries], [interval])
- .selectFromTab(selector, value, [index], [timeout])
- .mouseOverElement(selector, [index], [timeout])
- .scrollToElement(selector, [index], [alignment], [timeout])
- .selectAll([selector], [index], [timeout])
- .openF4Help(selector, [index], [timeout], useF4Key)
- .searchFor(selector, [index], [timeout], useEnter)
- .resetSearch(selector, [index], [timeout])
userInteraction.click(selector, [index], [timeout])
Clicks on the element with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.click(selector);
userInteraction.clickAndRetry(selector, [index], [timeout], [retries], [interval])
Clicks on the element with the given selector and retries the action in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.userInteraction.clickAndRetry(selector);
userInteraction.doubleClick(selector, [index], [timeout])
Double Clicks on the passed element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.doubleClick(selector);
userInteraction.rightClick(selector, [index], [timeout])
Right Clicks on the passed element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await nonUi5.element.getById("button01");
await ui5.userInteraction.rightClick(elem);
userInteraction.clickTab(selector, [index], [timeout])
Clicks on the tab with the given selector and checks if the tab got selected successfully. The function retries the click for maximal 3 times if the selection of the tab (blue underline) was not successful.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clickTab(selector);
userInteraction.clickListItem(selector, [index], [timeout])
Clicks or opens the list item with the given selector (e.g. ColumnListItem, StandardListItem). In some cases the default click function is not working correctly (clicks an element within the list item). Therefore we recommend to use this function to open a specific list item.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clickListItem(selector);
userInteraction.check(selector, [index], [timeout])
Checks the checkbox with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.check(selector);
userInteraction.uncheck(selector, [index], [timeout])
Unchecks the checkbox with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.uncheck(selector);
userInteraction.fill(selector, value, [index], [timeout])
Fills the input field with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String | Number |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.fill(selector, "My Value");
userInteraction.fillAndRetry(selector, value, [index], [timeout], [retries], [interval])
Fills the input field with the given selector and retries the action in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String | Number |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.userInteraction.fillAndRetry(selector, "My Value");
userInteraction.clear(selector, [index], [timeout])
Clears the input with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clear(selector);
userInteraction.clearAndRetry(selector, [index], [timeout], [retries], [interval])
Clears the input with the given selector and retries the action in case of a failure
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.userInteraction.clearAndRetry(selector);
userInteraction.clearAndFill(selector, value, [index], [timeout])
Clears the input field with the given selector and fills the given value.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String | Number |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clearAndFill(selector, "My Value");
userInteraction.clearAndFillAndRetry(selector, value, [index], [timeout], [retries], [interval], [verify])
Clears the input field with the given selector and fills the given value. Retries the action in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
[verify] | Boolean |
true |
Specifies if the filled value should be verified. |
Example
await ui5.userInteraction.clearAndFillAndRetry(selector, "My Value");
userInteraction.clearSmartFieldInput(selector, [index], [timeout])
Clears the smart filed with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clearSmartFieldInput(selector);
userInteraction.clearAndFillSmartFieldInput(selector, value, [index], [timeout])
Clears the smart filed with the given selector and fills the given value.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.clearAndFillSmartFieldInput(selector, "My Value");
userInteraction.clearAndFillSmartFieldInputAndRetry(selector, value, [index], [timeout], [retries], [interval])
Clears the smart filed with the given selector and fills the given value and retries the action in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to enter. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.userInteraction.clearAndFillSmartFieldInputAndRetry(selector, "My Value");
userInteraction.selectBox(selector, value, [index])
Selects the passed value of the Select box. Please note that the function will only work for the default select Box. In special cases, please use the clickSelectArrow function.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to select. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
await ui5.userInteraction.selectBox(selector, "Germany");
userInteraction.selectComboBox(selector, value, [index])
Selects the passed value from the ComboBox with the given selector. Please note that the function will only work for the default ComboBox. In special cases you need to use the 'clickSelectArrow' function.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to select. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
await ui5.userInteraction.selectComboBox(selector, "Germany");
userInteraction.selectMultiComboBox(selector, values, [index])
Selects the passed values of the MultiComboBox with the given selector. Please note that the function will only work for the default MultiComboBox. In special cases, please use the clickSelectArrow function.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
values | Array |
The values to select. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
await ui5.userInteraction.selectMultiComboBox(selector, ["Option 1", "Option 2"]);
userInteraction.clickSelectArrow(selector, [index])
Clicks the arrow icon at the passed selector (select box).
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
Example
await ui5.userInteraction.clickSelectArrow(selector);
userInteraction.clickSelectArrowAndRetry(selector, [index], [retries], [interval])
Clicks the arrow icon at the passed selector (select box), and retries in case it fails.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
await ui5.userInteraction.clickSelectArrowAndRetry(selector);
userInteraction.selectFromTab(selector, value, [index], [timeout])
Selects the passed value on the tab with the given selector and checks if the tab got selected successfully. The function retries the click for maximal 3 times if the selection of the tab (blue underline) was not successful.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
value | String |
The value to select. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.selectFromTab(selector);
userInteraction.mouseOverElement(selector, [index], [timeout])
Moves the cursor/focus to the element with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.mouseOverElement(selector);
userInteraction.scrollToElement(selector, [index], [alignment], [timeout])
Scrolls the element with the given selector into view.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[alignment] | String | Object |
"center" |
The alignment option for scrolling. Can be one of: "start", "center", "end", "nearest", or an object with properties: - block: Vertical alignment ("start", "center", "end", "nearest"). - inline: Horizontal alignment ("start", "center", "end", "nearest"). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
// Scroll to element with center alignment.
await nonUi5.userInteraction.scrollToElement(selector, 0, "center");
// Scroll to element with custom alignment.
const alignment = {
block: "start",
inline: "center"
};
await nonUi5.userInteraction.scrollToElement(selector, 0, alignment);
userInteraction.selectAll([selector], [index], [timeout])
Performs "select all" (ctrl + a) at the element with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
[selector] | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector, in case there are more than one elements visible at the same time. |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.selectAll(selector);
userInteraction.openF4Help(selector, [index], [timeout], useF4Key)
Opens the F4-help of the element with the given selector.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
useF4Key | Boolean |
Specifies if the help is opened by pressing the F4-key or via the button. The default value is true (triggered by pressing the F4-key). Set "useF4Key" to false, to trigger the search by clicking the button. |
Example
await ui5.userInteraction.openF4Help(selector, 0, 30000, false);
userInteraction.searchFor(selector, [index], [timeout], useEnter)
Searches for the passed value and executes the search. In case that the search is already filled, it will reset the field first.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
useEnter | Boolean |
Specifies if the search is triggered by pressing the Enter-key or via the search button. The default value is true (triggered by pressing the Enter-key). Set "useEnter" to false, to trigger the search by clicking the search button. |
Example
await ui5.userInteraction.searchFor(selector, "My Value", 0, 30000, false);
userInteraction.resetSearch(selector, [index], [timeout])
Resets the search field.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The selector describing the element. | |
[index] | Number |
0 |
The index of the selector (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await ui5.userInteraction.resetSearch(selector);
nonUi5
Global namespace for non UI5 modules.
Kind: global constant
- nonUi5
- .assertion
- .element
- .waitForAll(selector, [timeout])
- .waitToBePresent(selector, [timeout])
- .waitToBeVisible(selector, [timeout])
- .waitToBeClickable(selector, [timeout])
- .getAllDisplayed(selector, [timeout]) ⇒
Array.<Object>
- .getAll(selector, [timeout])
- .getByCss(selector, [index], [timeout], [includeHidden]) ⇒
Object
- .getByCssContainingText(selector, [text], [index], [timeout], [includeHidden], [strict]) ⇒
Object
- .getById(id, [timeout], [includeHidden]) ⇒
Object
- .getByClass(elemClass, [index], [timeout], [includeHidden]) ⇒
Object
- .getByName(name, [index], [timeout], [includeHidden]) ⇒
Object
- .getByXPath(xpath, [index], [timeout], [includeHidden]) ⇒
Object
- .getByChild(elementSelector, childSelector, [index], [timeout], [includeHidden]) ⇒
Object
- .getByParent(elementSelector, parentSelector, [index], [timeout], [includeHidden]) ⇒
Object
- .isVisible(element, [strict]) ⇒
Boolean
- .isPresent(elem) ⇒
Boolean
- .isPresentByCss(css, [index], [timeout]) ⇒
boolean
- .isPresentByXPath(xpath, [index], [timeout]) ⇒
boolean
- .isSelected(elem) ⇒
boolean
- .getAttributeValue(elem, [attribute]) ⇒
String
- .getValue(elem) ⇒
String
- .setInnerHTML(elem) ⇒
String
- .highlight(elem, [duration], [color])
- .navigation
- .session
- .userInteraction
- .click(elementOrSelector, [timeout])
- .clickAndRetry(elementOrSelector, [timeout], [retries], [interval])
- .doubleClick(elementOrSelector, [timeout])
- .rightClick(elementOrSelector, [timeout])
- .check(elementOrSelector)
- .uncheck(elementOrSelector)
- .fill(elementOrSelector, value)
- .fillAndRetry(elementOrSelector, value, [retries], [interval])
- .clear(elementOrSelector)
- .clearAndRetry(elementOrSelector, [retries], [interval])
- .clearAndFill(elementOrSelector, value)
- .clearAndFillAndRetry(elementOrSelector, value, [retries], [interval], [verify])
- .mouseOverElement(elementOrSelector, [xOffset], [yOffset])
- .scrollToElement(elem, [alignment])
- .dragAndDrop(elementOrSelector, targetElem)
- .moveCursorAndClick(elementOrSelector)
- .clickElementInSvg(elementOrSelector, innerSelector)
nonUi5.assertion
Kind: static class of nonUi5
assertion.expectAttributeToBe(elementOrSelector, compareValue, [attribute])
Expects the attributes value of the passed element to be the compare value.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
compareValue | String |
The compare value. |
[attribute] | String |
The attribute to compare. If not passed, it will compare the inner HTML content of the element. |
Example
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectAttributeToBe(element, "Save");
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectAttributeToBe(element, "Save", "title");
assertion.expectAttributeToContain(elementOrSelector, compareValue, [attribute])
Expects the attributes value of the passed element to contain the compare value.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
compareValue | String |
The compare value. |
[attribute] | String |
The attribute to compare. If not passed, it will compare the inner HTML content of the element. |
Example
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectAttributeToContain(element, "Save", "title");
assertion.expectValueToBe(elementOrSelector, compareValue)
Expects the attributes value of the passed element to be the compare value.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
compareValue | String |
The compare value. |
Example
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectValueToBe(element, "Save");
assertion.expectToBeVisible(elementOrSelector)
Expects that the element is visible to the user.
Kind: static method of assertion
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
Example
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectToBeVisible(elem);
assertion.expectToBeNotVisible(elementOrSelector, [timeout])
Expects that the element is not visible to the user.
Kind: static method of assertion
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). Recommendation is to lower the timeout since the element is not expected to show up. |
Example
const element = await nonUi5.element.getById("button01");
await nonUi5.assertion.expectToBeNotVisible(element, 5000);
nonUi5.element
Kind: static class of nonUi5
- .element
- .waitForAll(selector, [timeout])
- .waitToBePresent(selector, [timeout])
- .waitToBeVisible(selector, [timeout])
- .waitToBeClickable(selector, [timeout])
- .getAllDisplayed(selector, [timeout]) ⇒
Array.<Object>
- .getAll(selector, [timeout])
- .getByCss(selector, [index], [timeout], [includeHidden]) ⇒
Object
- .getByCssContainingText(selector, [text], [index], [timeout], [includeHidden], [strict]) ⇒
Object
- .getById(id, [timeout], [includeHidden]) ⇒
Object
- .getByClass(elemClass, [index], [timeout], [includeHidden]) ⇒
Object
- .getByName(name, [index], [timeout], [includeHidden]) ⇒
Object
- .getByXPath(xpath, [index], [timeout], [includeHidden]) ⇒
Object
- .getByChild(elementSelector, childSelector, [index], [timeout], [includeHidden]) ⇒
Object
- .getByParent(elementSelector, parentSelector, [index], [timeout], [includeHidden]) ⇒
Object
- .isVisible(element, [strict]) ⇒
Boolean
- .isPresent(elem) ⇒
Boolean
- .isPresentByCss(css, [index], [timeout]) ⇒
boolean
- .isPresentByXPath(xpath, [index], [timeout]) ⇒
boolean
- .isSelected(elem) ⇒
boolean
- .getAttributeValue(elem, [attribute]) ⇒
String
- .getValue(elem) ⇒
String
- .setInnerHTML(elem) ⇒
String
- .highlight(elem, [duration], [color])
element.waitForAll(selector, [timeout])
Waits until all elements with the given selector are rendered. Will fail if no element is found.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.waitForAll(".inputField");
element.waitToBePresent(selector, [timeout])
Waits until the element with the given selector is present.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.waitToBePresent(".input01");
await nonUi5.element.waitToBePresent("#button12");
await nonUi5.element.waitToBePresent("p:first-child");
element.waitToBeVisible(selector, [timeout])
Waits until the element with the given selector is visible.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.waitToBeVisible(".input01");
await nonUi5.element.waitToBeVisible("#button12");
await nonUi5.element.waitToBeVisible("p:first-child");
element.waitToBeClickable(selector, [timeout])
Waits until the element with the given selector is clickable.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.waitToBeClickable(".input01");
await nonUi5.element.waitToBeClickable("#button12");
await nonUi5.element.waitToBeClickable("p:first-child");
element.getAllDisplayed(selector, [timeout]) ⇒ Array.<Object>
Gets all visible elements with the passed selector.
Kind: static method of element
Returns: Array.<Object>
- The array of elements.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.getAllDisplayed(".inputField");
element.getAll(selector, [timeout])
Returns all elements found by the given selector despite visible or not.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const hiddenElements = await nonUi5.element.getAll(".sapUiInvisibleText");
const isPresent = await nonUi5.element.isPresent(hiddenElements[0]);
await common.assertion.expectTrue(isPresent);
element.getByCss(selector, [index], [timeout], [includeHidden]) ⇒ Object
Gets the element with the given CSS selector.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByCss(".button01");
element.getByCssContainingText(selector, [text], [index], [timeout], [includeHidden], [strict]) ⇒ Object
Gets the element with the given CSS selector containing the given text value.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[text] | String |
"" |
The containing text value of the element. |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
[strict] | Boolean |
false |
Specifies if the values match should be exact |
Example
const elem = await nonUi5.element.getByCssContainingText(".input01", "Jack Jackson");
element.getById(id, [timeout], [includeHidden]) ⇒ Object
Gets the element with the given ID.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
id | String |
The id of the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if the function will check for the elements visibility. |
Example
const elem = await nonUi5.element.getById("button01");
element.getByClass(elemClass, [index], [timeout], [includeHidden]) ⇒ Object
Gets the element with the given class.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
elemClass | String |
The class describing the element | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByClass("button01");
const elem = await nonUi5.element.getByClass("sapMIBar sapMTB sapMTBNewFlex sapContrastPlus");
element.getByName(name, [index], [timeout], [includeHidden]) ⇒ Object
Gets the element with the given name.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
name | String |
The name attribute of the element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByName(".button01");
element.getByXPath(xpath, [index], [timeout], [includeHidden]) ⇒ Object
Gets the element with the given XPath.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
xpath | String |
The XPath describing the element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByXPath("//ul/li/a");
element.getByChild(elementSelector, childSelector, [index], [timeout], [includeHidden]) ⇒ Object
Gets an element by its selector and child selector. Can be used when multiple elements have the same properties.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
elementSelector | String |
The CSS selector describing the element. | |
childSelector | String |
The CSS selector describing the child element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByChild(".form01", ".input01");
element.getByParent(elementSelector, parentSelector, [index], [timeout], [includeHidden]) ⇒ Object
Gets an element by its selector and parent selector. Can be used when multiple elements have the same properties.
Kind: static method of element
Returns: Object
- The found element.
Param | Type | Default | Description |
---|---|---|---|
elementSelector | String |
The CSS selector describing the element. | |
parentSelector | String |
The CSS selector describing the parent element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[includeHidden] | Boolean |
false |
Specifies if hidden elements are also considered. By default it checks only for visible ones. |
Example
const elem = await nonUi5.element.getByParent(".form01", ".input01");
element.isVisible(element, [strict]) ⇒ Boolean
Returns a boolean if the element is visible to the user.
Kind: static method of element
Returns: Boolean
- Returns true or false.
Param | Type | Default | Description |
---|---|---|---|
element | Object |
The element. | |
[strict] | Boolean |
true |
If strict mode is enabled it will only return "true" if the element is visible on the page and within the viewport. If disabled, it will be sufficient if the element is visible on the page but not inside the current viewport. |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.element.isVisible(elem);
element.isPresent(elem) ⇒ Boolean
Returns a boolean if the element is present at the DOM or not. It might be hidden.
Kind: static method of element
Returns: Boolean
- Returns true or false.
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.element.isPresent(elem);
element.isPresentByCss(css, [index], [timeout]) ⇒ boolean
Returns a boolean if the element is present at the DOM or not.
Kind: static method of element
Returns: boolean
- Returns true or false.
Param | Type | Default | Description |
---|---|---|---|
css | String |
The CSS selector describing the element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.isPresentByCss(".button01");
element.isPresentByXPath(xpath, [index], [timeout]) ⇒ boolean
Returns a boolean if the element is present at the DOM or not.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
xpath | String |
The XPath describing the element. | |
[index] | Number |
0 |
The index of the element (in case there are more than one elements visible at the same time). |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await nonUi5.element.isPresentByXPath(".//*[text()='Create']");
element.isSelected(elem) ⇒ boolean
Returns a boolean if the element (e.g. checkbox) is selected.
Kind: static method of element
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
const elem = await nonUi5.element.getById("elem01");
const isSelected = await nonUi5.element.isSelected(elem);
element.getAttributeValue(elem, [attribute]) ⇒ String
Returns the attributes value of the passed element.
Kind: static method of element
Returns: String
- The attributes value of the element.
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
[attribute] | String |
The attribute of the element. Leave empty to return the inner HTML value of the element. |
Example
const elem = await nonUi5.element.getById("elem01");
const text = await nonUi5.element.getAttributeValue(elem, "text");
const elem = await nonUi5.element.getById("elem02");
const innerHTML = await nonUi5.element.getAttributeValue(elem);
element.getValue(elem) ⇒ String
Returns the value of the passed element.
Kind: static method of element
Returns: String
- The value of the element.
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
const elem = await nonUi5.element.getById("elem02");
const innerHTML = await nonUi5.element.getValue(elem);
element.setInnerHTML(elem) ⇒ String
Sets the innerHTML value of the given element. CAUTION: Only use this if filling the value in the normal way is not working and if it is unavoidable. Keep in mind, that a user is not able to perform such actions.
Kind: static method of element
Returns: String
- The value to set.
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
const elem = await nonUi5.element.getById("text-editor");
await nonUi5.element.setInnerHTML(elem, "Hello World!");
element.highlight(elem, [duration], [color])
Highlights the passed element.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
elem | Object |
The element. | |
[duration] | Integer |
2000 |
The duration of the highlighting (ms). |
[color] | String |
"red" |
The color of the highlighting (CSS value). |
Example
const elem = await nonUi5.element.getById("text01");
await nonUi5.element.highlight(elem);
const elem = await nonUi5.element.getById("text01");
await nonUi5.element.highlight(elem, 3000, "green");
nonUi5.navigation
Kind: static class of nonUi5
navigation.navigateToApplication(relativeReference, [refresh])
Navigates to the application via the passed relative reference. The path will be added to the baseUrl maintained in the config.
Kind: static method of navigation
Param | Type | Default | Description |
---|---|---|---|
relativeReference | String |
Relative reference of an application (path, query and fragment) | |
[refresh] | Boolean |
true |
Refresh the page after navigation. |
Example
await nonUi5.navigation.navigateToApplication("categories");
nonUi5.session
Kind: static class of nonUi5
session.loginSapNetWeaver(username, password, [clickContinue], [iframeCssSelector])
Login for SAP NetWebGUI form and specific username and password.
Kind: static method of session
Param | Type | Default | Description |
---|---|---|---|
username | String |
The username. | |
password | String |
The password. | |
[clickContinue] | Boolean |
true |
Specifies if the function will press continue if applicable. |
[iframeCssSelector] | String |
"iframe" |
The specific iframe selector the login form is contained. |
Example
await nonUi5.session.loginSapNetWeaver("john", "abc123!");
nonUi5.userInteraction
Kind: static class of nonUi5
- .userInteraction
- .click(elementOrSelector, [timeout])
- .clickAndRetry(elementOrSelector, [timeout], [retries], [interval])
- .doubleClick(elementOrSelector, [timeout])
- .rightClick(elementOrSelector, [timeout])
- .check(elementOrSelector)
- .uncheck(elementOrSelector)
- .fill(elementOrSelector, value)
- .fillAndRetry(elementOrSelector, value, [retries], [interval])
- .clear(elementOrSelector)
- .clearAndRetry(elementOrSelector, [retries], [interval])
- .clearAndFill(elementOrSelector, value)
- .clearAndFillAndRetry(elementOrSelector, value, [retries], [interval], [verify])
- .mouseOverElement(elementOrSelector, [xOffset], [yOffset])
- .scrollToElement(elem, [alignment])
- .dragAndDrop(elementOrSelector, targetElem)
- .moveCursorAndClick(elementOrSelector)
- .clickElementInSvg(elementOrSelector, innerSelector)
userInteraction.click(elementOrSelector, [timeout])
Clicks on the passed element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.userInteraction.click(elem);
userInteraction.clickAndRetry(elementOrSelector, [timeout], [retries], [interval])
Clicks on the passed element, retries in case it fails.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.userInteraction.clickAndRetry(elem);
userInteraction.doubleClick(elementOrSelector, [timeout])
Double Clicks on the passed element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.userInteraction.doubleClick(elem);
userInteraction.rightClick(elementOrSelector, [timeout])
Right Clicks on the passed element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await nonUi5.element.getById("button01");
await nonUi5.userInteraction.rightClick(elem);
userInteraction.check(elementOrSelector)
Checks the given checkbox.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
Example
await nonUi5.userInteraction.check(selector);
userInteraction.uncheck(elementOrSelector)
Unchecks the given checkbox.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
Example
await nonUi5.userInteraction.uncheck(selector);
userInteraction.fill(elementOrSelector, value)
Fills the given value into the passed input.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
value | String | Number |
The value to enter. |
Example
const elem = await nonUi5.element.getById("input01");
await nonUi5.userInteraction.fill(elem, "Service 01");
userInteraction.fillAndRetry(elementOrSelector, value, [retries], [interval])
Fills the given value into the passed input, retries in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
value | String | Number |
The value to enter. | |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
const elem = await nonUi5.element.getById("input01");
await nonUi5.userInteraction.fillAndRetry(elem, "Service 01");
userInteraction.clear(elementOrSelector)
Clears the passed input element.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
Example
const elem = await nonUi5.element.getById("input01");
await nonUi5.userInteraction.clear(elem);
userInteraction.clearAndRetry(elementOrSelector, [retries], [interval])
Clears the passed input element, retries in case of a failure.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
Example
const elem = await nonUi5.element.getById("input01", 10000);
await nonUi5.userInteraction.clearAndRetry(elem);
userInteraction.clearAndFill(elementOrSelector, value)
Clears and fills the passed input element.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
value | String | Number |
The value to enter in. |
Example
const elem = await nonUi5.element.getById("input01");
await nonUi5.userInteraction.clearAndFill(elem, "Service 01");
userInteraction.clearAndFillAndRetry(elementOrSelector, value, [retries], [interval], [verify])
Clears and fills the passed input, retries in case it fails.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. | |
value | String | Number |
The value to enter in. | |
[retries] | Number |
3 |
The number of retries, can be set in config for all functions under params stepsRetries. |
[interval] | Number |
5000 |
The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. |
[verify] | Boolean |
true |
Specifies if the filled value should be verified. |
Example
const elem = await nonUi5.element.getById("input01");
await nonUi5.userInteraction.clearAndFillAndRetry(elem, "Service 01");
userInteraction.mouseOverElement(elementOrSelector, [xOffset], [yOffset])
Moves the cursor/focus to the passed element.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
[xOffset] | Number |
X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. |
[yOffset] | Number |
Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. |
Example
const elem = await nonUi5.element.getById("dropdown42");
await nonUi5.userInteraction.mouseOverElement(elem);
userInteraction.scrollToElement(elem, [alignment])
Scrolls an element into view.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
elem | Element |
The target element to scroll to. | |
[alignment] | String | Object |
"center" |
The alignment option for scrolling. Can be one of: "start", "center", "end", "nearest", or an object with properties: - block: Vertical alignment ("start", "center", "end", "nearest"). - inline: Horizontal alignment ("start", "center", "end", "nearest"). |
Example
// Scroll to element with center alignment.
const elem = await nonUi5.userInteraction.getElementById("footer01");
await nonUi5.userInteraction.scrollToElement(elem, "center");
// Scroll to element with custom alignment.
const elem = await nonUi5.userInteraction.getElementById("footer01");
const alignment = {
block: "start",
inline: "center"
};
await nonUi5.userInteraction.scrollToElement(elem, alignment);
userInteraction.dragAndDrop(elementOrSelector, targetElem)
Drags and drops the given element to the given target element.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
targetElem | Object |
The target element to drop the element. |
Example
const elem = await nonUi5.element.getById("drag01");
const targetElem = await nonUi5.element.getById("drop02");
await nonUi5.userInteraction.dragAndDrop(elem, targetElem);
userInteraction.moveCursorAndClick(elementOrSelector)
Moves the cursor to the target element and clicks on it. Can be used for charts.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Element | string |
The element or CSS selector describing the element. |
Example
const elem = await nonUi5.element.getById("chartPartToClick");
await nonUi5.userInteraction.moveCursorAndClick(elem);
userInteraction.clickElementInSvg(elementOrSelector, innerSelector)
Clicks on an inner element within a SVG element.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
elementOrSelector | Object | string |
The SVG element or CSS selector describing the element. |
innerSelector | String |
The CSS selector describing the inner element to be clicked. |
Example
const svgElem = await nonUi5.element.getByCss("svg");
const innerSelector = "circle:nth-child(6)";
await nonUi5.userInteraction.clickElementInSvg(svgElem, innerSelector);
service
Global namespace for service modules.
Kind: global constant
- service
- .odata
- .init(url, username, password, [loggingEnabled], [params], [authType], [headers]) ⇒
Object
- .get(srv, entitySet, keys, [raw], [headers], [queryParams]) ⇒
Promise
- .getEntitySet(srv, entitySet, [filterString], [selectionFields], [queryParams]) ⇒
Promise
- .post(srv, entitySet, payload, [raw], [headers], [queryParams]) ⇒
Promise
- .merge(srv, entitySet, payload, [headers]) ⇒
Promise
- .delete(srv, entitySet, options, [headers]) ⇒
Promise
- .callFunctionImport(srv, functionImportName, options) ⇒
Promise
- .isFeatureToggleActivated(srv, featureName) ⇒
Promise
- .getOutputManagementPdfStream(outputConf, url, username, password)
- .readPdfFromDirectUrl(url, [username], [password], [isSaml])
- .init(url, username, password, [loggingEnabled], [params], [authType], [headers]) ⇒
- .rest
- .init([customConfig]) ⇒
Object
- .get(uri, [config]) ⇒
Object
- .post(uri, payload, [config]) ⇒
Object
- .delete(uri, [config]) ⇒
Object
- .patch(uri, payload, [config]) ⇒
Object
- .put(uri, payload, [config]) ⇒
Object
- .init([customConfig]) ⇒
- .odata
service.odata
Kind: static class of service
- .odata
- .init(url, username, password, [loggingEnabled], [params], [authType], [headers]) ⇒
Object
- .get(srv, entitySet, keys, [raw], [headers], [queryParams]) ⇒
Promise
- .getEntitySet(srv, entitySet, [filterString], [selectionFields], [queryParams]) ⇒
Promise
- .post(srv, entitySet, payload, [raw], [headers], [queryParams]) ⇒
Promise
- .merge(srv, entitySet, payload, [headers]) ⇒
Promise
- .delete(srv, entitySet, options, [headers]) ⇒
Promise
- .callFunctionImport(srv, functionImportName, options) ⇒
Promise
- .isFeatureToggleActivated(srv, featureName) ⇒
Promise
- .getOutputManagementPdfStream(outputConf, url, username, password)
- .readPdfFromDirectUrl(url, [username], [password], [isSaml])
- .init(url, username, password, [loggingEnabled], [params], [authType], [headers]) ⇒
odata.init(url, username, password, [loggingEnabled], [params], [authType], [headers]) ⇒ Object
Initializes the OData Service. XCSRF-Token will be automatically fetched and stored in the service instance. Cookies will also automatically assembled and stored in the service instance.
Kind: static method of odata
Returns: Object
- The initialized service object.
Param | Type | Default | Description |
---|---|---|---|
url | String |
The base url of the service. | |
username | String |
The username to authenticate the service. | |
password | String |
The password of the username. | |
[loggingEnabled] | Boolean |
false |
The boolean param to control whether user wants to see logs during build run. |
[params] | Object |
{} |
JSON object with key-value pairs of parameter names and corresponding values. By default we send { "client": "715", "documentation": ["heading", "quickinfo"], "language": "EN" } These can be overridden by sending params as JSON object with additional params as shown in example. |
[authType] | String |
authentication type, in case you want to override the default SAML authentication. Set this to "basic", to use basic authentication for communication users for whom SAML login doesn't work. Or "none" for no authentication. | |
[headers] | Object |
JSON object with key-value pairs of optional headers. |
Example
const url = "<urlToSystem>/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/";
const params = {
"saml2": "disabled",
"language": "de"
}
const srv = await service.odata.init(url, user, password, false, params);
const base64Credentials = Buffer.from(`${user}:${password}`).toString("base64");
const authHeaders = {
"Authorization": `Basic ${base64Credentials}`,
"DwC-Tenant": tenant
};
const srv = await service.odata.init(url, user, password, true, params, "headers", authHeaders);
odata.get(srv, entitySet, keys, [raw], [headers], [queryParams]) ⇒ Promise
Sends a GET request to retrieve data from the specified OData entity set.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Default | Description |
---|---|---|---|
srv | Object |
An instance of the service. | |
entitySet | String |
The entity set from which data is to be retrieved. | |
keys | Object |
The required keys for the GET request. | |
[raw] | Boolean |
false |
Specifies whether the response should include all header contents. |
[headers] | Object |
Optional headers to be included in the request. | |
[queryParams] | Object |
JSON object of key value pairs of custom query parameters. |
Example
const url = "<baseUrl>/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/";
const srv = await service.odata.init(url, user, password);
const keys = {
PurchaseOrder: "4100000000"
};
const queryParams = {
"$top" : 5,
"$skip" : 10,
};
const headers = {
'X-Custom-Header': 'foobar'
}
const res = await service.odata.get(srv, "A_PurchaseOrder", keys, false, headers, queryParams);
odata.getEntitySet(srv, entitySet, [filterString], [selectionFields], [queryParams]) ⇒ Promise
GET's the EntitySet collection.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Description |
---|---|---|
srv | Object |
Instance of the service |
entitySet | String |
The entitySet you want to GET from. |
[filterString] | String |
The filters to be applied on get query |
[selectionFields] | String |
comma separated list of fields to be selected |
[queryParams] | Object |
JSON object of key value pairs of custom query parameters. |
Example
const url = "<baseUrl>/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/";
srv = await service.odata.init(url, user, password);
let filterString = "Status eq '01'";
let res = await service.odata.getEntitySet(srv, "A_PurchaseOrder", filterString);
let select = "CentralPurchaseContract,PurchasingProcessingStatus" ;
let res = await service.odata.getEntitySet(srv, "A_PurchaseOrder", filterString, select);
let queryParams = {
"$top" : 5,
"$skip" : 10,
};
let res = await service.odata.getEntitySet(srv, "A_PurchaseOrder", filterString, select, queryParams);
odata.post(srv, entitySet, payload, [raw], [headers], [queryParams]) ⇒ Promise
Sends a POST request to retrieve data from the specified OData entity set for the given payload.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Default | Description |
---|---|---|---|
srv | Object |
Instance of the service | |
entitySet | String |
The entitySet you want to POST against. | |
payload | Object |
The payload of the POST request. | |
[raw] | Boolean |
false |
Specifies whether the response should include all header contents. |
[headers] | Object |
Optional headers to be included in the request. | |
[queryParams] | Object |
JSON object of key value pairs of custom query parameters. |
Example
const payload = {
"PurchaseOrder": "4500007108",
"DraftUUID": "00000000-0000-0000-0000-000000000000",
"IsActiveEntity": "true"
};
const res = await service.odata.post(srv, "A_PurchaseOrder", payload);
odata.merge(srv, entitySet, payload, [headers]) ⇒ Promise
@description Sends a MERGE request to merge data from the specified OData entity set for the given payload.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Description |
---|---|---|
srv | Object |
Instance of the service |
entitySet | String |
The entitySet you want to MERGE in. |
payload | Object |
The payload of the MERGE request. |
[headers] | Object |
Optional headers to be included in the request. |
Example
const res = await service.odata.merge(srv, "A_PurchaseOrderScheduleLine", {
"PurchasingDocument": "4500007108",
"PurchasingDocumentItem": "10",
"ScheduleLine": "1",
"ScheduleLineDeliveryDate": new Date()
};
odata.delete(srv, entitySet, options, [headers]) ⇒ Promise
Sends a DELETE request to the specified OData entity set.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Description |
---|---|---|
srv | Object |
Instance of the service. |
entitySet | String |
The entitySet you want to DELETE. |
options | Object |
The options for the DELETE request. |
[headers] | Object |
Optional headers to be included in the request. |
Example
const options = {
"PurchaseOrder": "",
"DraftUUID": draftUUID,
"IsActiveEntity": false
};
const res = await service.odata.delete(srv, "C_PurchaseOrderTP", options);
odata.callFunctionImport(srv, functionImportName, options) ⇒ Promise
Sends a function import request to the OData service instance.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to the response data.
Param | Type | Description |
---|---|---|
srv | Object |
Instance of the service. |
functionImportName | String |
Name of Function Import. |
options | Object |
Parameters for function import. |
Example
const options = {
CentralRequestForQuotation : "7500000026",
Supplier : "100006"
};
const res = await service.odata.callFunctionImport(srv, "Cancel", options);
odata.isFeatureToggleActivated(srv, featureName) ⇒ Promise
Checks if a feature toggle is switched on or off.
Kind: static method of odata
Returns: Promise
- A Promise that resolves to a bool value.
Param | Type | Description |
---|---|---|
srv | Object |
Instance of the service |
featureName | String |
The name of the feature you want know the status of. |
Example
const url = browser.params.systemUrl + "/sap/opu/odata/SAP/CA_FM_FEATURE_TOGGLE_STATUS_SRV/";
const srv = await service.odata.init(url, user, password);
let isFeatureActive = await service.odata.isFeatureToggleActivated(srv, "MM_PUR_PO_BATCHES_IN_MANAGE_PO");
odata.getOutputManagementPdfStream(outputConf, url, username, password)
returns a stream of output management pdf file.
Kind: static method of odata
Param | Type | Description |
---|---|---|
outputConf | Object |
Configuration for the output management pdf. |
url | String |
system url |
username | String |
username for login |
password | String |
password for login |
Example
const outputConf =
ApplObjectType: "REQUEST_FOR_QUOTATION",
ApplObjectId: "7000002653",
ItemId: "1"
};
const pdfStream = await service.odata.getOutputManagementPdfStream(outputConf, url, user, password);
odata.readPdfFromDirectUrl(url, [username], [password], [isSaml])
returns a stream of pdf file which is part of attachment.
Kind: static method of odata
Param | Type | Default | Description |
---|---|---|---|
url | String |
system url | |
[username] | String |
username for login | |
[password] | String |
password for login | |
[isSaml] | Boolean |
false |
use SAML login if true |
Example
const url = "https://domain.com/getPdfFile";
const pdfStream = await service.odata.readPdfFromDirectUrl(url, "username", "Password");
service.rest
Kind: static class of service
- .rest
- .init([customConfig]) ⇒
Object
- .get(uri, [config]) ⇒
Object
- .post(uri, payload, [config]) ⇒
Object
- .delete(uri, [config]) ⇒
Object
- .patch(uri, payload, [config]) ⇒
Object
- .put(uri, payload, [config]) ⇒
Object
- .init([customConfig]) ⇒
rest.init([customConfig]) ⇒ Object
Returns an axios instance for custom axios handling.
Kind: static method of rest
Returns: Object
- The axios instance.
Param | Type | Default | Description |
---|---|---|---|
[customConfig] | Object |
{} |
Custom config for axios. If not specified axios defaults will be taken. |
Example
const customConfig = {
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {
'X-Custom-Header': 'foobar'
}
const axios = service.rest.init(customConfig);
rest.get(uri, [config]) ⇒ Object
makes a GET request.
Kind: static method of rest
Returns: Object
- The response of the GET request.
Param | Type | Description |
---|---|---|
uri | String |
The uri to the data source you want to GET. |
[config] | Object |
The config options for the request. |
Example
const uri = https://api.predic8.de/shop/products/";
let res = await service.rest.get(uri);
common.assertion.expectEqual(res.data.title, "qmate-service");
rest.post(uri, payload, [config]) ⇒ Object
makes a POST request.
Kind: static method of rest
Returns: Object
- The response of the POST request.
Param | Type | Description |
---|---|---|
uri | String |
The uri to the data source you want to POST against. |
payload | Object |
The data you want to POST against your entity set. |
[config] | Object |
The config options for the request. |
Example
const payload = {
id: 99,
title: "qmate-service",
author: "marvin"
};
const config = {
headers: {
"X-CSRF-TOKEN": "<CSRF TOKEN>",
"Cookie": "<COOKIE>",
"Content-Type": "application/json"
}
};
let res = await service.rest.post(`${browser.config.baseUrl}/posts/99`, payload, config);
rest.delete(uri, [config]) ⇒ Object
makes a DELETE request.
Kind: static method of rest
Returns: Object
- The response of the DELETE request.
Param | Type | Description |
---|---|---|
uri | String |
The uri to the data source you want to DELETE. |
[config] | Object |
The config options for the request. |
Example
const config = {
auth: {
"username": "<username>",
"password": "<password>"
}
};
let res = await service.rest.delete(`${browser.config.baseUrl}/posts/99`, config);
rest.patch(uri, payload, [config]) ⇒ Object
makes a PATCH request.
Kind: static method of rest
Returns: Object
- The response of the PATCH request.
Param | Type | Description |
---|---|---|
uri | String |
The uri to the data source you want to PATCH. |
payload | Object |
The data to be used for updating the entity. |
[config] | Object |
The config options for the request. |
Example
const config = {
auth: {
"username": "<username>",
"password": "<password>"
}
};
const payload = {
"title": "patched-qmate-service",
"author": "qmate-tester"
},
let res = await service.rest.patch(`${browser.config.baseUrl}/posts/99`, payload, config);
rest.put(uri, payload, [config]) ⇒ Object
makes a PUT request.
Kind: static method of rest
Returns: Object
- The response of the PUT request.
Param | Type | Description |
---|---|---|
uri | String |
The uri to the data source you want to PUT. |
payload | Object |
The data to be used for updating the entity. |
[config] | Object |
The config options for the request. |
Example
const config = {
auth: {
"username": "<username>",
"password": "<password>"
}
}
const payload = {
"id": 99,
"title": "put-qmate-service",
"author": "qmate-tester"
},
let res = await service.rest.put(`${browser.config.baseUrl}/posts/99`, payload, config);
mobile
Global namespace for mobile modules.
Kind: global constant
- mobile
mobile.android
Kind: static class of mobile
android.pressKeyByName(keyName)
Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
Kind: static method of android
Param | Type | Description |
---|---|---|
keyName | string |
The name of the key (e.g., "back", "home", "volumeUp", etc.) |
Example
await mobile.device.pressKeyByName("back");
await mobile.device.pressKeyByName("home");
await mobile.device.pressKeyByName("volumeUp");
await mobile.device.pressKeyByName("volumeDown");
await mobile.device.pressKeyByName("volumeMute");
await mobile.device.pressKeyByName("power");
await mobile.device.pressKeyByName("enter");
await mobile.device.pressKeyByName("space");
await mobile.device.pressKeyByName("delete");
await mobile.device.pressKeyByName("menu");
await mobile.device.pressKeyByName("search");
await mobile.device.pressKeyByName("camera");
await mobile.device.pressKeyByName("focus");
await mobile.device.pressKeyByName("notification");
await mobile.device.pressKeyByName("call");
await mobile.device.pressKeyByName("calendar");
await mobile.device.pressKeyByName("recent");
await mobile.device.pressKeyByName("settings");
android.pressKeyByCode(keyCode)
Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
Kind: static method of android
Param | Type | Description |
---|---|---|
keyCode | string |
The code of the key (e.g., 4 (back), 3 (home) , etc.) |
Example
await mobile.android.pressKeyByCode(4);
mobile.device
Kind: static class of mobile
device.isAppInstalled(packageIdorBundleId) ⇒ boolean
Check wether given package/bundle app is installed or not in the device.
Kind: static method of device
Returns: boolean
- Returns true if specified app package/bundled installed in the device, or false.
Param | Type | Description |
---|---|---|
packageIdorBundleId | string |
Android package Id, or iOS bundle Id. |
Example
await mobile.device.isAppInstalled("com.google.android.apps.maps");
device.installApp(appPath)
Install the appropriate app based on the platform the test is being executed on.
Kind: static method of device
Param | Type | Description |
---|---|---|
appPath | string |
Path of the app(.apk, .ipa) |
Example
await mobile.device.installApp("/path/to/your/app.apk");
await mobile.device.installApp("/path/to/your/app.ipa");
mobile.element
Kind: static class of mobile
element.isVisible(element, [strict]) ⇒ Boolean
Returns a boolean if the mobile element is visible to the user.
Kind: static method of element
Returns: Boolean
- Returns true or false.
Param | Type | Default | Description |
---|---|---|---|
element | Object |
The Mobile Ui element. | |
[strict] | Boolean |
true |
If strict mode is enabled it will only return "true" if the element is visible on the mobile view and within the viewport. If "false", it will be sufficient if the element is visible on the view but not inside the current viewport. |
Example
const elem = await mobile.element.isVisible("button01");
await mobile.element.isVisible(elem);
element.isPresent(elem) ⇒ Boolean
Returns a boolean if the element is present at the DOM or not. It might be hidden.
Kind: static method of element
Returns: Boolean
- Returns true or false.
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
await mobile.element.isPresent(elem);
element.waitToBePresent(selector, [timeout])
Waits until the element with the given selector is present.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await mobile.element.waitToBePresent(".input01");
await mobile.element.waitToBePresent("#button12");
await mobile.element.waitToBePresent("p:first-child");
element.waitToBeVisible(selector, [timeout])
Waits until the element with the given selector is visible.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await mobile.element.waitToBeVisible(".input01");
await mobile.element.waitToBeVisible("#button12");
await mobile.element.waitToBeVisible("p:first-child");
element.waitToBeClickable(selector, [timeout])
Waits until the element with the given selector is clickable.
Kind: static method of element
Param | Type | Default | Description |
---|---|---|---|
selector | Object |
The CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
await mobile.element.waitToBeClickable(".input01");
await mobile.element.waitToBeClickable("#button12");
await mobile.element.waitToBeClickable("p:first-child");
element.isSelected(elem) ⇒ boolean
Returns a boolean if the element (e.g. checkbox) is selected.
Kind: static method of element
Param | Type | Description |
---|---|---|
elem | Object |
The element. |
Example
const elem = await mobile.element.getById("elem01");
const isSelected = await mobile.element.isSelected(elem);
mobile.gestures
Kind: static class of mobile
gestures.waitToBeClickable(startX, startY, endX, endY, duration) ⇒ Promise.<void>
Swipe from one point to another on the screen.
Kind: static method of gestures
Param | Type | Description |
---|---|---|
startX | number |
The starting X coordinate of the swipe |
startY | number |
The starting Y coordinate of the swipe |
endX | number |
The ending X coordinate of the swipe |
endY | number |
The ending Y coordinate of the swipe |
duration | number |
The duration of the swipe in milliseconds (optional, default is 1000ms) |
mobile.ios
Kind: static class of mobile
mobile.userInteraction
Kind: static class of mobile
userInteraction.tap(element, [timeout])
Tap's on the mobile element.
Kind: static method of userInteraction
Param | Type | Default | Description |
---|---|---|---|
element | Element | string |
The element or CSS selector describing the element. | |
[timeout] | Number |
30000 |
The timeout to wait (ms). |
Example
const elem = await mobile.userInteraction.tap(elem);
userInteraction.check(element)
Checks the given checkbox.
Kind: static method of userInteraction
Param | Type | Description |
---|---|---|
element | Element |
The element or CSS selector describing the element. |
Example
await mobile.userInteraction.check(selector);