UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

1,366 lines (1,071 loc) 249 kB
## Constants <dl> <dt><a href="#common">common</a></dt> <dd><p>Global namespace for common modules.</p> </dd> <dt><a href="#util">util</a></dt> <dd><p>Global namespace for util modules.</p> </dd> <dt><a href="#ui5">ui5</a></dt> <dd><p>Global namespace for UI5 modules.</p> </dd> <dt><a href="#nonUi5">nonUi5</a></dt> <dd><p>Global namespace for non UI5 modules.</p> </dd> <dt><a href="#service">service</a></dt> <dd><p>Global namespace for service modules.</p> </dd> </dl> <a name="common"></a> ## common Global namespace for common modules. **Kind**: global constant * [common](#common) * [.assertion](#common.assertion) * [.expectEqual(value1, value2)](#common.assertion.expectEqual) * [.expectUnequal(value1, value2)](#common.assertion.expectUnequal) * [.expectTrue(value)](#common.assertion.expectTrue) * [.expectFalse(value)](#common.assertion.expectFalse) * [.expectDefined(value)](#common.assertion.expectDefined) * [.expectUndefined(value)](#common.assertion.expectUndefined) * [.expectUrlToBe()](#common.assertion.expectUrlToBe) * [.date](#common.date) * [.getToday([format])](#common.date.getToday) ⇒ <code>String</code> * [.getTomorrow([format])](#common.date.getTomorrow) ⇒ <code>String</code> * [.getNextMonth([format])](#common.date.getNextMonth) ⇒ <code>String</code> * [.getPreviousMonth([format])](#common.date.getPreviousMonth) ⇒ <code>String</code> * [.getNextYear([format])](#common.date.getNextYear) ⇒ <code>String</code> * [.getPreviousYear([format])](#common.date.getPreviousYear) ⇒ <code>String</code> * [.getSpecific(date, [format])](#common.date.getSpecific) ⇒ <code>String</code> * [.calculate([date], [format])](#common.date.calculate) ⇒ <code>String</code> * [.navigation](#common.navigation) * [.navigateToUrl(url)](#common.navigation.navigateToUrl) * [.navigateToUrlAndRetry(url, [retries], [interval])](#common.navigation.navigateToUrlAndRetry) * [.userInteraction](#common.userInteraction) * [.fillActive(value)](#common.userInteraction.fillActive) * [.fillActiveAndRetry(value, [retries], [interval])](#common.userInteraction.fillActiveAndRetry) * [.clearAndFillActive(value)](#common.userInteraction.clearAndFillActive) * [.clearAndFillActiveAndRetry(value, [retries], [interval])](#common.userInteraction.clearAndFillActiveAndRetry) * [.pressKey(keys)](#common.userInteraction.pressKey) * [.pressEnter()](#common.userInteraction.pressEnter) * [.pressTab()](#common.userInteraction.pressTab) * [.pressF4()](#common.userInteraction.pressF4) * [.pressBackspace()](#common.userInteraction.pressBackspace) * [.pressEscape()](#common.userInteraction.pressEscape) * [.pressArrowLeft()](#common.userInteraction.pressArrowLeft) * [.pressArrowRight()](#common.userInteraction.pressArrowRight) <a name="common.assertion"></a> ### common.assertion **Kind**: static class of [<code>common</code>](#common) * [.assertion](#common.assertion) * [.expectEqual(value1, value2)](#common.assertion.expectEqual) * [.expectUnequal(value1, value2)](#common.assertion.expectUnequal) * [.expectTrue(value)](#common.assertion.expectTrue) * [.expectFalse(value)](#common.assertion.expectFalse) * [.expectDefined(value)](#common.assertion.expectDefined) * [.expectUndefined(value)](#common.assertion.expectUndefined) * [.expectUrlToBe()](#common.assertion.expectUrlToBe) <a name="common.assertion.expectEqual"></a> #### assertion.expectEqual(value1, value2) Expects the passed values to be equal. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value1 | <code>Any</code> | Value (1) to be equal to value (2) | | value2 | <code>Any</code> | Value (2) to be equal to value (1) | **Example** ```js common.assertion.expectEqual(value1, value2); ``` <a name="common.assertion.expectUnequal"></a> #### assertion.expectUnequal(value1, value2) Expects the passed values to be unequal. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value1 | <code>Any</code> | Value (1) to be unequal to value (2) | | value2 | <code>Any</code> | Value (2) to be unequal to value (1) | **Example** ```js common.assertion.expectUnequal(value1, value2); ``` <a name="common.assertion.expectTrue"></a> #### assertion.expectTrue(value) Expects the passed value to be true. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value | <code>Any</code> | Value to be equal to true | **Example** ```js common.assertion.expectTrue(value); ``` <a name="common.assertion.expectFalse"></a> #### assertion.expectFalse(value) Expects the passed value to be false. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value | <code>Boolean</code> | The value to be false. | **Example** ```js common.assertion.expectFalse(false); ``` <a name="common.assertion.expectDefined"></a> #### assertion.expectDefined(value) Expects the passed values is defined. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value | <code>Any</code> | Value to be defined (not undefined) | **Example** ```js common.assertion.expectDefined(value); ``` <a name="common.assertion.expectUndefined"></a> #### assertion.expectUndefined(value) Expects the passed values is undefined. **Kind**: static method of [<code>assertion</code>](#common.assertion) | Param | Type | Description | | --- | --- | --- | | value | <code>Any</code> | Value to be undefined | **Example** ```js common.assertion.expectUndefined(value); ``` <a name="common.assertion.expectUrlToBe"></a> #### assertion.expectUrlToBe() Expects the url to be the passed value. **Kind**: static method of [<code>assertion</code>](#common.assertion) **Example** ```js await common.assertion.expectUrlToBe("www.sap.com"); ``` <a name="common.date"></a> ### common.date **Kind**: static class of [<code>common</code>](#common) * [.date](#common.date) * [.getToday([format])](#common.date.getToday) ⇒ <code>String</code> * [.getTomorrow([format])](#common.date.getTomorrow) ⇒ <code>String</code> * [.getNextMonth([format])](#common.date.getNextMonth) ⇒ <code>String</code> * [.getPreviousMonth([format])](#common.date.getPreviousMonth) ⇒ <code>String</code> * [.getNextYear([format])](#common.date.getNextYear) ⇒ <code>String</code> * [.getPreviousYear([format])](#common.date.getPreviousYear) ⇒ <code>String</code> * [.getSpecific(date, [format])](#common.date.getSpecific) ⇒ <code>String</code> * [.calculate([date], [format])](#common.date.calculate) ⇒ <code>String</code> <a name="common.date.getToday"></a> #### date.getToday([format]) ⇒ <code>String</code> Returns the current day in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getToday("mm/dd/yyyy"); ``` <a name="common.date.getTomorrow"></a> #### date.getTomorrow([format]) ⇒ <code>String</code> Returns tomorrows date in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getTomorrow("mm/dd/yyyy"); ``` <a name="common.date.getNextMonth"></a> #### date.getNextMonth([format]) ⇒ <code>String</code> Returns the current day one month later in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getNextMonth("mm/dd/yyyy"); ``` <a name="common.date.getPreviousMonth"></a> #### date.getPreviousMonth([format]) ⇒ <code>String</code> Returns the current day one month before in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getPreviousMonth("mm/dd/yyyy"); ``` <a name="common.date.getNextYear"></a> #### date.getNextYear([format]) ⇒ <code>String</code> Returns the current day one year later in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getNextYear("mm/dd/yyyy"); ``` <a name="common.date.getPreviousYear"></a> #### date.getPreviousYear([format]) ⇒ <code>String</code> Returns the current day one year before in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getPreviousYear("mm/dd/yyyy"); ``` <a name="common.date.getSpecific"></a> #### date.getSpecific(date, [format]) ⇒ <code>String</code> Returns a specific date in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | date | <code>String</code> | | A specific date string. | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | The expected format ("mm/dd/yyyy", "dd.mm.yyyy", "dd/mm/yyyy", "yyyymmdd", "yyyy/mm/dd", "mmm dd, yyyy", "datetime", "object"). | **Example** ```js const date = await common.date.getSpecific("2020, 0, 17", "mm/dd/yyyy"); ``` <a name="common.date.calculate"></a> #### date.calculate([date], [format]) ⇒ <code>String</code> Calculates the date based on the input parameter and returns it in the given format. **Kind**: static method of [<code>date</code>](#common.date) **Returns**: <code>String</code> - The calculated date in the given format. | Param | Type | Default | Description | | --- | --- | --- | --- | | [date] | <code>String</code> | <code>&quot;today&quot;</code> | Supported values: today, tomorrow, nextMonth, previousMonth, nextYear, previousYear | | [format] | <code>String</code> | <code>&quot;object&quot;</code> | 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** ```js const date = await common.date.calculate("today", "mm/dd/yyyy"); ``` <a name="common.navigation"></a> ### common.navigation **Kind**: static class of [<code>common</code>](#common) * [.navigation](#common.navigation) * [.navigateToUrl(url)](#common.navigation.navigateToUrl) * [.navigateToUrlAndRetry(url, [retries], [interval])](#common.navigation.navigateToUrlAndRetry) <a name="common.navigation.navigateToUrl"></a> #### navigation.navigateToUrl(url) Navigates to the passed url. **Kind**: static method of [<code>navigation</code>](#common.navigation) | Param | Type | Description | | --- | --- | --- | | url | <code>String</code> | The url. | **Example** ```js await common.navigation.navigateToUrl("www.sap.com"); ``` <a name="common.navigation.navigateToUrlAndRetry"></a> #### navigation.navigateToUrlAndRetry(url, [retries], [interval]) Navigates to the passed url and retries the function in case of a failure. **Kind**: static method of [<code>navigation</code>](#common.navigation) | Param | Type | Default | Description | | --- | --- | --- | --- | | url | <code>String</code> | | The url to navigate to. | | [retries] | <code>Integer</code> | <code>3</code> | The number of retries, can be set in config for all functions under params stepsRetries. | | [interval] | <code>Integer</code> | <code>5000</code> | The interval of the retries (ms), can be set in config for all functions under params stepRetriesIntervals. | **Example** ```js await common.navigation.navigateToUrlAndRetry("www.sap.com"); ``` <a name="common.userInteraction"></a> ### common.userInteraction **Kind**: static class of [<code>common</code>](#common) * [.userInteraction](#common.userInteraction) * [.fillActive(value)](#common.userInteraction.fillActive) * [.fillActiveAndRetry(value, [retries], [interval])](#common.userInteraction.fillActiveAndRetry) * [.clearAndFillActive(value)](#common.userInteraction.clearAndFillActive) * [.clearAndFillActiveAndRetry(value, [retries], [interval])](#common.userInteraction.clearAndFillActiveAndRetry) * [.pressKey(keys)](#common.userInteraction.pressKey) * [.pressEnter()](#common.userInteraction.pressEnter) * [.pressTab()](#common.userInteraction.pressTab) * [.pressF4()](#common.userInteraction.pressF4) * [.pressBackspace()](#common.userInteraction.pressBackspace) * [.pressEscape()](#common.userInteraction.pressEscape) * [.pressArrowLeft()](#common.userInteraction.pressArrowLeft) * [.pressArrowRight()](#common.userInteraction.pressArrowRight) <a name="common.userInteraction.fillActive"></a> #### userInteraction.fillActive(value) Fills the active input with the given value. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) | Param | Type | Description | | --- | --- | --- | | value | <code>String</code> \| <code>Number</code> | The value to enter. | **Example** ```js await common.userInteraction.fillActive("My Value"); ``` <a name="common.userInteraction.fillActiveAndRetry"></a> #### 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 [<code>userInteraction</code>](#common.userInteraction) | Param | Type | Default | Description | | --- | --- | --- | --- | | value | <code>String</code> | | The value to enter. | | [retries] | <code>Number</code> | <code>3</code> | The number of retries, can be set in config for all functions under params stepsRetries. | | [interval] | <code>Number</code> | <code>5000</code> | The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. | **Example** ```js await common.userInteraction.fillActiveAndRetry("My Value"); ``` <a name="common.userInteraction.clearAndFillActive"></a> #### userInteraction.clearAndFillActive(value) Clears and fills the active input. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) | Param | Type | Description | | --- | --- | --- | | value | <code>String</code> | The value to fill. | **Example** ```js await common.userInteraction.clearAndFillActive("My Value"); ``` <a name="common.userInteraction.clearAndFillActiveAndRetry"></a> #### userInteraction.clearAndFillActiveAndRetry(value, [retries], [interval]) CClears and fills the active input. Retries the action in case of a failure. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) | Param | Type | Default | Description | | --- | --- | --- | --- | | value | <code>String</code> | | The value to fill. | | [retries] | <code>Number</code> | <code>3</code> | The number of retries, can be set in config for all functions under params stepsRetries. | | [interval] | <code>Number</code> | <code>5000</code> | The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals. | **Example** ```js await common.userInteraction.clearAndFillActiveAndRetry("My Value"); ``` <a name="common.userInteraction.pressKey"></a> #### userInteraction.pressKey(keys) Performs the specified keypress. Possible values: https://w3c.github.io/webdriver/#keyboard-actions **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) | Param | Type | Description | | --- | --- | --- | | keys | <code>String</code> \| <code>Array.&lt;String&gt;</code> | The key or combination of keys to execute. | **Example** ```js await common.userInteraction.pressKey("Enter"); ``` **Example** ```js await common.userInteraction.pressKey("\uE004"); ``` **Example** ```js await common.userInteraction.pressKey(["\uE009", "Alt"]); ``` <a name="common.userInteraction.pressEnter"></a> #### userInteraction.pressEnter() Performs the Enter keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressEnter(); ``` <a name="common.userInteraction.pressTab"></a> #### userInteraction.pressTab() Performs the Tab keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressTab(); ``` <a name="common.userInteraction.pressF4"></a> #### userInteraction.pressF4() Performs the F4 keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressF4(); ``` <a name="common.userInteraction.pressBackspace"></a> #### userInteraction.pressBackspace() Performs the Backspace keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressBackspace(); ``` <a name="common.userInteraction.pressEscape"></a> #### userInteraction.pressEscape() Performs the Escape keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressEscape(); ``` <a name="common.userInteraction.pressArrowLeft"></a> #### userInteraction.pressArrowLeft() Performs the Arrow Left keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressArrowLeft(); ``` <a name="common.userInteraction.pressArrowRight"></a> #### userInteraction.pressArrowRight() Performs the Arrow Right keypress. **Kind**: static method of [<code>userInteraction</code>](#common.userInteraction) **Example** ```js await common.userInteraction.pressArrowRight(); ``` <a name="util"></a> ## util Global namespace for util modules. **Kind**: global constant * [util](#util) * [.browser](#util.browser) * [.getBaseUrl()](#util.browser.getBaseUrl) ⇒ <code>String</code> * [.setBaseUrl(baseUrl:)](#util.browser.setBaseUrl) * [.logCurrentUrl()](#util.browser.logCurrentUrl) * [.getCurrentUrl()](#util.browser.getCurrentUrl) * [.resetFocus()](#util.browser.resetFocus) * [.sleep([duration])](#util.browser.sleep) * [.collectCoverage()](#util.browser.collectCoverage) * [.sleepAndCollectCoverage([duration])](#util.browser.sleepAndCollectCoverage) * [.refresh()](#util.browser.refresh) * [.clearBrowser([clearLocal], [clearSession], [clearCookies])](#util.browser.clearBrowser) * [.getBrowserName()](#util.browser.getBrowserName) ⇒ <code>String</code> * [.getUI5Version([timeout])](#util.browser.getUI5Version) * [.logUI5Version()](#util.browser.logUI5Version) * [.executeScript(command)](#util.browser.executeScript) ⇒ <code>Any</code> * [.switchToNewWindow(titleOrUrl, [timeout])](#util.browser.switchToNewWindow) * [.switchToWindow(handle)](#util.browser.switchToWindow) * [.getCurrentWindow()](#util.browser.getCurrentWindow) ⇒ <code>Object</code> * [.switchToIframe(selector)](#util.browser.switchToIframe) * [.switchToDefaultContent()](#util.browser.switchToDefaultContent) * [.back()](#util.browser.back) * [.forward()](#util.browser.forward) * [.log(message)](#util.browser.log) * [.warn(message)](#util.browser.warn) * [.error(message)](#util.browser.error) * [.component](#util.component) * [new component()](#new_util.component_new) * [.loadEntryPoint([folderPath])](#util.component.loadEntryPoint) ⇒ <code>Object</code> * [.storeEntryPoint(data, [folderPath])](#util.component.storeEntryPoint) * [.console](#util.console) * [.log(message, [textColor], [backgroundColor], [brightness])](#util.console.log) * [.error(message)](#util.console.error) * [.warn(message)](#util.console.warn) * [.success(message)](#util.console.success) * [.info(message)](#util.console.info) * [.data](#util.data) * [.getData(filename, [source])](#util.data.getData) ⇒ <code>Object</code> * [.getSecureData(filename, [source])](#util.data.getSecureData) ⇒ <code>Object</code> * [.readDataFromFile(filePath)](#util.data.readDataFromFile) ⇒ <code>Object</code> * [.writeDataToFile(filePath, data)](#util.data.writeDataToFile) * [.decrypt(data)](#util.data.decrypt) ⇒ <code>String</code> * [.file](#util.file) * [.upload(files, [selector])](#util.file.upload) * [.uploadWebGui(files, selector)](#util.file.uploadWebGui) * [.parsePdf(pdfStream, renderingMethod)](#util.file.parsePdf) ⇒ <code>String</code> * [.expectPdfContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfContainsText) * [.expectPdfNotContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfNotContainsText) * [.getExcelData(filePath, fileName, [sheetIndex], [conversionType])](#util.file.getExcelData) * [.getTextData(filePath)](#util.file.getTextData) * [.expectTextDataToContain(filePath)](#util.file.expectTextDataToContain) * [.getXmlData(filePath)](#util.file.getXmlData) * [.getAttributeValuesFromJson(object)](#util.file.getAttributeValuesFromJson) * [.findFilePathRecursively(directory, fileName)](#util.file.findFilePathRecursively) * [.getFileNamesByExtensions(dirPath, fileExtensions)](#util.file.getFileNamesByExtensions) * [.formatter](#util.formatter) * [.sliceStringAt(input, slicePoint, length)](#util.formatter.sliceStringAt) ⇒ <code>String</code> * [.sliceStringAfter(input, slicePoint, length)](#util.formatter.sliceStringAfter) ⇒ <code>String</code> * [.trimString(input)](#util.formatter.trimString) * [.extractNumberFromString(input, [index])](#util.formatter.extractNumberFromString) ⇒ <code>String</code> * [.stringifyJSON(object)](#util.formatter.stringifyJSON) ⇒ <code>String</code> * [.addRemoveLeadingZeros(number, length)](#util.formatter.addRemoveLeadingZeros) ⇒ <code>String</code> * [.formatDate(date, format, [locale])](#util.formatter.formatDate) ⇒ <code>String</code> * [.function](#util.function) * [.retry(fct, args, [retries], [interval], [scope])](#util.function.retry) * [.executeOptional(fct, args)](#util.function.executeOptional) * [.system](#util.system) * [.getOS()](#util.system.getOS) ⇒ <code>String</code> <a name="util.browser"></a> ### util.browser **Kind**: static class of [<code>util</code>](#util) * [.browser](#util.browser) * [.getBaseUrl()](#util.browser.getBaseUrl) ⇒ <code>String</code> * [.setBaseUrl(baseUrl:)](#util.browser.setBaseUrl) * [.logCurrentUrl()](#util.browser.logCurrentUrl) * [.getCurrentUrl()](#util.browser.getCurrentUrl) * [.resetFocus()](#util.browser.resetFocus) * [.sleep([duration])](#util.browser.sleep) * [.collectCoverage()](#util.browser.collectCoverage) * [.sleepAndCollectCoverage([duration])](#util.browser.sleepAndCollectCoverage) * [.refresh()](#util.browser.refresh) * [.clearBrowser([clearLocal], [clearSession], [clearCookies])](#util.browser.clearBrowser) * [.getBrowserName()](#util.browser.getBrowserName) ⇒ <code>String</code> * [.getUI5Version([timeout])](#util.browser.getUI5Version) * [.logUI5Version()](#util.browser.logUI5Version) * [.executeScript(command)](#util.browser.executeScript) ⇒ <code>Any</code> * [.switchToNewWindow(titleOrUrl, [timeout])](#util.browser.switchToNewWindow) * [.switchToWindow(handle)](#util.browser.switchToWindow) * [.getCurrentWindow()](#util.browser.getCurrentWindow) ⇒ <code>Object</code> * [.switchToIframe(selector)](#util.browser.switchToIframe) * [.switchToDefaultContent()](#util.browser.switchToDefaultContent) * [.back()](#util.browser.back) * [.forward()](#util.browser.forward) * [.log(message)](#util.browser.log) * [.warn(message)](#util.browser.warn) * [.error(message)](#util.browser.error) <a name="util.browser.getBaseUrl"></a> #### browser.getBaseUrl() ⇒ <code>String</code> Retrieves the baseUrl from the configuration file. **Kind**: static method of [<code>browser</code>](#util.browser) **Returns**: <code>String</code> - The baseUrl. **Example** ```js const baseUrl = util.browser.getBaseUrl(); ``` <a name="util.browser.setBaseUrl"></a> #### browser.setBaseUrl(baseUrl:) Sets or overwrites the baseUrl in the configuration file. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | baseUrl: | <code>String</code> | base URL to set | **Example** ```js await util.browser.setBaseUrl("https://www.sap.com"); ``` <a name="util.browser.logCurrentUrl"></a> #### browser.logCurrentUrl() Displays the current URL in the console. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.logCurrentUrl(); ``` <a name="util.browser.getCurrentUrl"></a> #### browser.getCurrentUrl() Returns the current URL **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.getCurrentUrl(); ``` <a name="util.browser.resetFocus"></a> #### browser.resetFocus() Resets the focus in case it set for a specific element. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.resetFocus(); ``` <a name="util.browser.sleep"></a> #### browser.sleep([duration]) Sleeps (pauses execution) for the passed duration. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Default | Description | | --- | --- | --- | --- | | [duration] | <code>Number</code> | <code>1000</code> | The time to pause (ms). | **Example** ```js await util.browser.sleep(30000); ``` <a name="util.browser.collectCoverage"></a> #### browser.collectCoverage() Trigger collection of coverage by coverage service. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.collectCoverage(); ``` <a name="util.browser.sleepAndCollectCoverage"></a> #### browser.sleepAndCollectCoverage([duration]) Trigger collection of coverage by coverage service. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Default | Description | | --- | --- | --- | --- | | [duration] | <code>Number</code> | <code>1000</code> | The time to pause (ms). | **Example** ```js await util.browser.sleepAndCollectCoverage(3000); ``` <a name="util.browser.refresh"></a> #### browser.refresh() Refreshes the page. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.refresh(); ``` <a name="util.browser.clearBrowser"></a> #### browser.clearBrowser([clearLocal], [clearSession], [clearCookies]) Clears the local and session cache and deletes all browser cookies. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Default | Description | | --- | --- | --- | --- | | [clearLocal] | <code>Boolean</code> | <code>true</code> | Specifies if the local cache will be cleared. | | [clearSession] | <code>Boolean</code> | <code>true</code> | Specifies if the session cache will be cleared. | | [clearCookies] | <code>Boolean</code> | <code>true</code> | Specifies if the cookies will be cleared. | **Example** ```js await util.browser.clearBrowser(); ``` <a name="util.browser.getBrowserName"></a> #### browser.getBrowserName() ⇒ <code>String</code> Retrieves the name of the current browser. **Kind**: static method of [<code>browser</code>](#util.browser) **Returns**: <code>String</code> - The browser name. **Example** ```js const browserName = util.browser.getBrowserName(); ``` <a name="util.browser.getUI5Version"></a> #### browser.getUI5Version([timeout]) Gets the UI5 version and creation date for UI5 based applications. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Default | Description | | --- | --- | --- | --- | | [timeout] | <code>Number</code> | <code>30000</code> | The timeout to wait (ms). | **Example** ```js await util.browser.getUI5Version(); ``` <a name="util.browser.logUI5Version"></a> #### browser.logUI5Version() Logs the UI5 version and creation date for UI5 based applications to the console. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.logUI5Version(); ``` <a name="util.browser.executeScript"></a> #### browser.executeScript(command) ⇒ <code>Any</code> Executes the specified JavaScript command. **Kind**: static method of [<code>browser</code>](#util.browser) **Returns**: <code>Any</code> - The result from the executed function. | Param | Type | Description | | --- | --- | --- | | command | <code>String</code> | The command to execute. | **Example** ```js await util.browser.executeScript(command); ``` <a name="util.browser.switchToNewWindow"></a> #### browser.switchToNewWindow(titleOrUrl, [timeout]) Switches to the window or tab with the given title. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Default | Description | | --- | --- | --- | --- | | titleOrUrl | <code>String</code> \| <code>RegExp</code> | | Window title or url of the expected window or tab (can be either a string or part of it as regular expression). | | [timeout] | <code>Number</code> | <code>10000</code> | The timeout to wait (ms). | **Example** ```js await util.browser.switchToNewWindow("SAP - Home"); ``` **Example** ```js await util.browser.switchToNewWindow(/Home/); ``` **Example** ```js await util.browser.switchToNewWindow("www.sap.com"); ``` <a name="util.browser.switchToWindow"></a> #### browser.switchToWindow(handle) Switches to the passed window. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | handle | <code>Object</code> | The window handle. | **Example** ```js await util.browser.switchToWindow(originalWindowHandle); ``` <a name="util.browser.getCurrentWindow"></a> #### browser.getCurrentWindow() ⇒ <code>Object</code> Returns the current window handle. **Kind**: static method of [<code>browser</code>](#util.browser) **Returns**: <code>Object</code> - The window handle. **Example** ```js const originalWindowHandle = await util.browser.getCurrentWindow(); ``` <a name="util.browser.switchToIframe"></a> #### browser.switchToIframe(selector) Switches to the passed iframe. **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | selector | <code>String</code> | The CSS selector describing the iframe element. | **Example** ```js await util.browser.switchToIframe("iframe[id='frame01']"); ``` <a name="util.browser.switchToDefaultContent"></a> #### browser.switchToDefaultContent() Switches to the default content of the HTML page. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.switchToDefaultContent(); ``` <a name="util.browser.back"></a> #### browser.back() Go one step back in browser history. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.back(); ``` <a name="util.browser.forward"></a> #### browser.forward() Go one step ahead in browser history. **Kind**: static method of [<code>browser</code>](#util.browser) **Example** ```js await util.browser.forward(); ``` <a name="util.browser.log"></a> #### browser.log(message) add log message to browser logs, can be viewed in the html report **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | string - The message to be logged. | **Example** ```js await util.browser.log("Created PO 123456"); ``` <a name="util.browser.warn"></a> #### browser.warn(message) add warning message to browser logs, can be viewed in the html report **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | string - The warning message to be logged. | **Example** ```js await util.browser.warn("This is a warning message"); ``` <a name="util.browser.error"></a> #### browser.error(message) add error message to browser logs, can be viewed in the html report **Kind**: static method of [<code>browser</code>](#util.browser) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | string - The error message to be logged. | **Example** ```js await util.browser.error("This is an error message"); ``` <a name="util.component"></a> ### util.component **Kind**: static class of [<code>util</code>](#util) * [.component](#util.component) * [new component()](#new_util.component_new) * [.loadEntryPoint([folderPath])](#util.component.loadEntryPoint) ⇒ <code>Object</code> * [.storeEntryPoint(data, [folderPath])](#util.component.storeEntryPoint) <a name="new_util.component_new"></a> #### new component() This class provides functions for writing component tests with qmate-proxy-service <a name="util.component.loadEntryPoint"></a> #### component.loadEntryPoint([folderPath]) ⇒ <code>Object</code> 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 [<code>component</code>](#util.component) **Returns**: <code>Object</code> - The data object of the stored entry point. | Param | Type | Default | Description | | --- | --- | --- | --- | | [folderPath] | <code>String</code> | <code>&quot;./entrypoints&quot;</code> | Custom folder path where entry points are stored. | **Example** ```js const entryPoint = util.component.loadEntryPoint(); ``` <a name="util.component.storeEntryPoint"></a> #### 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 [<code>component</code>](#util.component) | Param | Type | Default | Description | | --- | --- | --- | --- | | data | <code>Object</code> | | The data object of the entry point to store. | | [folderPath] | <code>String</code> | <code>&quot;./entrypoints&quot;</code> | Custom folder path where entry points are stored. | **Example** ```js const entryPoint = util.component.storeEntryPoint({"draftId": "0123456789"}); ``` <a name="util.console"></a> ### util.console **Kind**: static class of [<code>util</code>](#util) * [.console](#util.console) * [.log(message, [textColor], [backgroundColor], [brightness])](#util.console.log) * [.error(message)](#util.console.error) * [.warn(message)](#util.console.warn) * [.success(message)](#util.console.success) * [.info(message)](#util.console.info) <a name="util.console.log"></a> #### console.log(message, [textColor], [backgroundColor], [brightness]) Logs a message to the console in the given color. **Kind**: static method of [<code>console</code>](#util.console) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | The message to log. | | [textColor] | <code>String</code> | The color of the text: "black, white", "red", "yellow", "green", "blue", "cyan", "magenta". | | [backgroundColor] | <code>String</code> | The color of the background: "black, white", "red", "yellow", "green", "blue", "cyan", "magenta". | | [brightness] | <code>String</code> | Adjusts the brightness of the color: "bright", "dim". Leave empty for default. | **Example** ```js util.console.log("The document has been saved.", "green"); ``` <a name="util.console.error"></a> #### console.error(message) Logs a error message to the console in red. **Kind**: static method of [<code>console</code>](#util.console) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | The message to log. | **Example** ```js util.console.error("Error: Please investigate."); ``` <a name="util.console.warn"></a> #### console.warn(message) Logs a warning message to the console in yellow. **Kind**: static method of [<code>console</code>](#util.console) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | The message to log. | **Example** ```js util.console.warn("Optional step not executed."); ``` <a name="util.console.success"></a> #### console.success(message) Logs a success message to the console in green. **Kind**: static method of [<code>console</code>](#util.console) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | The message to log. | **Example** ```js util.console.success("The document has been saved."); ``` <a name="util.console.info"></a> #### console.info(message) Logs a info message to the console in cyan. **Kind**: static method of [<code>console</code>](#util.console) | Param | Type | Description | | --- | --- | --- | | message | <code>String</code> | The message to log. | **Example** ```js util.console.success("The document has been saved."); ``` <a name="util.data"></a> ### util.data **Kind**: static class of [<code>util</code>](#util) * [.data](#util.data) * [.getData(filename, [source])](#util.data.getData) ⇒ <code>Object</code> * [.getSecureData(filename, [source])](#util.data.getSecureData) ⇒ <code>Object</code> * [.readDataFromFile(filePath)](#util.data.readDataFromFile) ⇒ <code>Object</code> * [.writeDataToFile(filePath, data)](#util.data.writeDataToFile) * [.decrypt(data)](#util.data.decrypt) ⇒ <code>String</code> <a name="util.data.getData"></a> #### data.getData(filename, [source]) ⇒ <code>Object</code> Returns the data object with the given filename (JSON, stored in data folder). **Kind**: static method of [<code>data</code>](#util.data) **Returns**: <code>Object</code> - The data object. | Param | Type | Default | Description | | --- | --- | --- | --- | | filename | <code>String</code> | | The name of the data file. | | [source] | <code>String</code> | <code>data</code> | The source key defined under params.import of the config file. | **Example** ```js const data = util.data.getData("myTest"); ``` <a name="util.data.getSecureData"></a> #### data.getSecureData(filename, [source]) ⇒ <code>Object</code> 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 [<code>data</code>](#util.data) **Returns**: <code>Object</code> - The encrypted or local data object. | Param | Type | Default | Description | | --- | --- | --- | --- | | filename | <code>String</code> | | The name of the data file (without suffix '.secure' or '.local'). | | [source] | <code>String</code> | <code>data</code> | The source key defined under params.import of the config file. | **Example** ```js const secureData = util.data.getSecureData("myTest"); ``` <a name="util.data.readDataFromFile"></a> #### data.readDataFromFile(filePath) ⇒ <code>Object</code> Reads the data object from the given filepath. **Kind**: static method of [<code>data</code>](#util.data) **Returns**: <code>Object</code> - The data object. | Param | Type | Description | | --- | --- | --- | | filePath | <code>String</code> | The filepath. | **Example** ```js const data = util.data.readDataFromFile("./data/myData.json"); ``` <a name="util.data.writeDataToFile"></a> #### data.writeDataToFile(filePath, data) Writes the data object to the given filepath. **Kind**: static method of [<code>data</code>](#util.data) | Param | Type | Description | | --- | --- | --- | | filePath | <code>String</code> | The filepath. | | data | <code>Object</code> | The data object to write. | **Example** ```js const data = util.data.writeDataToFile("myTest"); ``` <a name="util.data.decrypt"></a> #### data.decrypt(data) ⇒ <code>String</code> Decrypts the passed input data. **Kind**: static method of [<code>data</code>](#util.data) **Returns**: <code>String</code> - The decrypted data. | Param | Type | Description | | --- | --- | --- | | data | <code>String</code> | The encrypted data to decrypt. | **Example** ```js const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7bef334d26a391a1934cf47338b749d99426980ee4cc7a81deaef21439c6894ab0324cdb29b9b6332635baca442651c5d37847f52bb90b8868e037271a7d456024b39b65fdf4dc62e8d82a3d5683a72e4324c59d339742fc79749f0ee74abef916d38e306218adc48e3547a2b346962249320c962d22cb46d9998de36d8219a2496c0997d0fc389f76fb1431a9b57c317886e9c9795c0a09ad98d9fa0b7687d10814dc7973397f3f72a227a04ead4c3d1d428c096a51922ffc4d7afc3952df1c130def5c5fb3e834605cbf1454885966cc65c77046343f4c678e74931fb2dd6cac8dae17837cf674f288d6550dd7fa6b01f5b7ea68aa6bd27d79dd5d53edb5fd4b4edce824bd31b3939352ad7a71a16bab8c54025c2bb92c54e022fcd23ff08bc54a17fc50d00dc3b884cadbfdefe1e75901fdf80e7324ad02a891f2c4863fa120ca238520b79126c65a03"); ``` <a name="util.file"></a> ### util.file **Kind**: static class of [<code>util</code>](#util) * [.file](#util.file) * [.upload(files, [selector])](#util.file.upload) * [.uploadWebGui(files, selector)](#util.file.uploadWebGui) * [.parsePdf(pdfStream, renderingMethod)](#util.file.parsePdf) ⇒ <code>String</code> * [.expectPdfContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfContainsText) * [.expectPdfNotContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfNotContainsText) * [.getExcelData(filePath, fileName, [sheetIndex], [conversionType])](#util.file.getExcelData) * [.getTextData(filePath)](#util.file.getTextData) * [.expectTextDataToContain(filePath)](#util.file.expectTextDataToContain) * [.getXmlData(filePath)](#util.file.getXmlData) * [.getAttributeValuesFromJson(object)](#util.file.getAttributeValuesFromJson) * [.findFilePathRecursively(directory, fileName)](#util.file.findFilePathRecursively) * [.getFileNamesByExtensions(dirPath, fileExtensions)](#util.file.getFileNamesByExtensions) <a name="util.file.upload"></a> #### file.upload(files, [selector]) Uploads all the file/s by the paths given in the Array. **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Default | Description | | --- | --- | --- | --- | | files | <code>Array.&lt;String&gt;</code> | | Array with path/s of file/s to be uploaded. | | [selector] | <code>String</code> | <code>&quot;input[type&#x3D;&#x27;file&#x27;]&quot;</code> | Custom selector of uploader control (in case there are more then one present). | **Example** ```js await util.file.upload(["path/to/text1.txt", "path/to/text2.txt"]); // uses the default uploader control ``` **Example** ```js await util.file.upload(["path/to/text1.txt", "path/to/text2.txt"], "input[id='myUpload']"); // upload to file uploader with matching selector ``` <a name="util.file.uploadWebGui"></a> #### file.uploadWebGui(files, selector) Uploads all the file/s by the paths given in the Array for SAP WebGUI apps. **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Description | | --- | --- | --- | | files | <code>Array.&lt;String&gt;</code> | Array with path/s of file/s to be uploaded. | | selector | <code>String</code> | Custom selector of the input element | **Example** ```js await util.file.uploadWebGui(["path/to/text1.txt"], "INPUT[title='External file name']"); ``` <a name="util.file.parsePdf"></a> #### file.parsePdf(pdfStream, renderingMethod) ⇒ <code>String</code> Parses the text from PDF stream. Returned text can be asserted to verify the PDF document content. **Kind**: static method of [<code>file</code>](#util.file) **Returns**: <code>String</code> - The parsed PDF text. **See**: <a href="TODO">Parse PDF</a> | Param | Type | Description | | --- | --- | --- | | pdfStream | <code>Buffer</code> | PDF stream to be downloaded. | | renderingMethod | <code>function</code> | Function to customize the parsing process. | **Example** ```js await util.file.parsePdf(pdfStream, customRenderingMethod); ``` <a name="util.file.expectPdfContainsText"></a> #### file.expectPdfContainsText(pdfStream, text, renderingMethod) Parses the PDF and checks for given text to be contained in PDF. **Kind**: static method of [<code>file</code>](#util.file) **See**: <a href="TODO">Parse pdf</a> | Param | Type | Description | | --- | --- | --- | | pdfStream | <code>Buffer</code> | PDF stream to be downloaded. | | text | <code>String</code> | The expected text. | | renderingMethod | <code>function</code> | Function to customize the parsing process. | **Example** ```js await util.file.expectPdfContainsText(pdfStream, "abc"); ``` <a name="util.file.expectPdfNotContainsText"></a> #### file.expectPdfNotContainsText(pdfStream, text, renderingMethod) Parses the PDF and checks for given text not to be contained in PDF. **Kind**: static method of [<code>file</code>](#util.file) **See**: <a href="TODO">Parse pdf</a> | Param | Type | Description | | --- | --- | --- | | pdfStream | <code>Buffer</code> | PDF stream to be downloaded | | text | <code>String</code> | The text expected to be not contained in the PDF. | | renderingMethod | <code>function</code> | Function to customize the parsing process. | **Example** ```js await util.file.expectPdfNotContainsText(pdfStream, "abc"); ``` <a name="util.file.getExcelData"></a> #### file.getExcelData(filePath, fileName, [sheetIndex], [conversionType]) - It returns the excel data based on the conversion type which is passed **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Description | | --- | --- | --- | | filePath | <code>string</code> | File path is required | | fileName | <code>string</code> | File Name is required | | [sheetIndex] | <code>number</code> | sheetIndex is required | | [conversionType] | <code>string</code> | Value for this are [json, csv, txt] | **Example** ```js const myTableContent = await util.file.getExcelData("/Users/path/myWork", "myTable.xlx"); ``` <a name="util.file.getTextData"></a> #### file.getTextData(filePath) - Returns the content of a .txt file. **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Description | | --- | --- | --- | | filePath | <code>string</code> | Path to the file. | **Example** ```js const txtData = await util.file.getTextData(path.resolve(__dirname, "./testFiles/test3.txt")); const isDateIncluded = txtData.includes("26.6.2023"); common.assertion.expectEqual(isDateIncluded, true); ``` <a name="util.file.expectTextDataToContain"></a> #### file.expectTextDataToContain(filePath) - Reads the specified .txt file and asserts if it includes a specific string. **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Description | | --- | --- | --- | | filePath | <code>string</code> | Path to the file. | **Example** ```js await util.file.expectTextDataToContain("/Users/path/myWork", "supplierList.txt"); ``` <a name="util.file.getXmlData"></a> #### file.getXmlData(filePath) - Returns the converted JSON object based on the passed XML file. **Kind**: static method of [<code>file</code>](#util.file) | Param | Type | Description | | --- | --- | --- | | filePath | <code>string</code> | Path to the file. | **Example** ```js const xmlData = await util.file.getXmlData(path.resolve(__dirname, "./testFiles/tes