@sap_oss/wdio-qmate-service 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/doc.md +127 -0
- package/lib/reuse/modules/util/file.d.ts +45 -0
- package/lib/reuse/modules/util/file.js +114 -0
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/package.json +3 -1
- package/test/core/functional/chaining/test.conf.js +1 -1
- package/test/core/functional/locators/test.locator.conf.js +1 -1
- package/test/core/functional/nativeBrowser/runInBrowser.test.js +1 -1
- package/test/core/functional/nativeBrowser/test.conf.js +1 -1
- package/test/core/functional/nonUi5/test.conf.js +1 -1
- package/test/core/functional/ui5Properties/getAggregations.test.js +2 -2
- package/test/core/functional/ui5Properties/test.conf.js +1 -1
- package/test/core/functional/uiveri5/test.conf.js +1 -1
- package/test/core/testIntegration/config.js +1 -1
- package/test/helper/configurations/chrome.conf.js +3 -1
- package/test/reuse/common/assertion/test.assertion.conf.js +1 -1
- package/test/reuse/common/userInteraction/fillActive.spec.js +4 -4
- package/test/reuse/common/userInteraction/fillActiveAndRetry.spec.js +4 -4
- package/test/reuse/nonUi5/assertion/expectValueToBe.spec.js +2 -2
- package/test/reuse/nonUi5/assertion/test.assertion.conf.js +1 -1
- package/test/reuse/nonUi5/assertion/test.assertion.sauceLabs.conf.js +1 -1
- package/test/reuse/nonUi5/element/getAttributeValue.spec.js +3 -3
- package/test/reuse/nonUi5/element/getByChild.spec.js +3 -3
- package/test/reuse/nonUi5/element/getByClass.spec.js +4 -4
- package/test/reuse/nonUi5/element/getByParent.spec.js +3 -3
- package/test/reuse/nonUi5/element/getByXPath.spec.js +2 -2
- package/test/reuse/nonUi5/element/getValue.spec.js +3 -3
- package/test/reuse/nonUi5/element/highlight.spec.js +1 -1
- package/test/reuse/nonUi5/element/isPresent.spec.js +3 -3
- package/test/reuse/nonUi5/element/isPresentByCss.spec.js +2 -2
- package/test/reuse/nonUi5/element/setInnerHTML.spec.js +1 -1
- package/test/reuse/nonUi5/element/test.element.conf.js +1 -1
- package/test/reuse/nonUi5/element/test.element.sauceLabs.conf.js +1 -1
- package/test/reuse/nonUi5/userInteraction/scrollToElement.spec.js +1 -1
- package/test/reuse/ui5/assertion/test.assertion.conf.js +1 -1
- package/test/reuse/ui5/assertion/test.assertion.sauceLab.conf.js +1 -1
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +1 -1
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.sauceLab.conf.js +1 -1
- package/test/reuse/ui5/control/focus.spec.js +1 -1
- package/test/reuse/ui5/control/test.control.conf.js +1 -1
- package/test/reuse/ui5/control/test.control.sauceLab.conf.js +1 -1
- package/test/reuse/ui5/date/fillRange.spec.js +1 -1
- package/test/reuse/ui5/date/pick.spec.js +1 -1
- package/test/reuse/ui5/date/pickRange.spec.js +1 -1
- package/test/reuse/ui5/element/getByText.spec.js +1 -1
- package/test/reuse/ui5/element/test.element.conf.js +1 -1
- package/test/reuse/ui5/element/test.element.sauceLab.conf.js +1 -1
- package/test/reuse/ui5/navigationBar/test.navigationBar.sauceLab.conf.js +1 -1
- package/test/reuse/ui5/session/logout.spec.js +1 -1
- package/test/reuse/ui5/userInteraction/click.spec.js +1 -1
- package/test/reuse/ui5/userInteraction/doubleClick.spec.js +1 -1
- package/test/reuse/ui5/userInteraction/fill.spec.js +4 -4
- package/test/reuse/ui5/userInteraction/fillAndRetry.spec.js +4 -4
- package/test/reuse/ui5/userInteraction/rightClick.spec.js +1 -1
- package/test/reuse/ui5/userInteraction/scrollToElement.spec.js +2 -2
- package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +2 -2
- package/test/reuse/ui5/userInteraction/test.userInteraction.sauceLab.conf.js +1 -1
- package/test/reuse/util/browser/getCurrentWindow.spec.js +2 -2
- package/test/reuse/util/browser/switchToWindow.spec.js +2 -2
- package/test/reuse/util/file/expectTextDataToContain.spec.js +14 -0
- package/test/reuse/util/file/getAttributeValuesFromJson.spec.js +37 -0
- package/test/reuse/util/file/getFileNamesByExtensions.spec.js +40 -0
- package/test/reuse/util/file/getTextData.spec.js +39 -0
- package/test/reuse/util/file/getXmlData.spec.js +52 -0
- package/test/reuse/util/file/test.file.conf.js +8 -4
- package/test/reuse/util/file/testFiles/test1.json +169 -0
- package/test/reuse/util/file/testFiles/test1.xml +120 -0
- package/test/reuse/util/file/testFiles/test2.xml +122 -0
- package/test/reuse/util/file/testFiles/test3.txt +13 -0
- /package/test/reuse/util/file/{file.spec.js → upload.spec.js} +0 -0
package/docs/doc.md
CHANGED
|
@@ -592,6 +592,13 @@ Global namespace for util modules.
|
|
|
592
592
|
* [.parsePdf(pdfStream, renderingMethod)](#util.file.parsePdf) ⇒ <code>String</code>
|
|
593
593
|
* [.expectPdfContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfContainsText)
|
|
594
594
|
* [.expectPdfNotContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfNotContainsText)
|
|
595
|
+
* [.getExcelData(filePath, fileName, [sheetIndex], [conversionType])](#util.file.getExcelData)
|
|
596
|
+
* [.getTextData(filePath)](#util.file.getTextData)
|
|
597
|
+
* [.expectTextDataToContain(filePath)](#util.file.expectTextDataToContain)
|
|
598
|
+
* [.getXmlData(filePath)](#util.file.getXmlData)
|
|
599
|
+
* [.getAttributeValuesFromJson(object)](#util.file.getAttributeValuesFromJson)
|
|
600
|
+
* [.findFilePathRecursively(directory, fileName)](#util.file.findFilePathRecursively)
|
|
601
|
+
* [.getFileNamesByExtensions(dirPath, fileExtensions)](#util.file.getFileNamesByExtensions)
|
|
595
602
|
* [.formatter](#util.formatter)
|
|
596
603
|
* [.sliceStringAt(input, slicePoint, length)](#util.formatter.sliceStringAt) ⇒ <code>String</code>
|
|
597
604
|
* [.sliceStringAfter(input, slicePoint, length)](#util.formatter.sliceStringAfter) ⇒ <code>String</code>
|
|
@@ -1183,6 +1190,13 @@ const decrypted = util.data.decrypt("d704004c262faa8ef4bdcf34c8a94883e15524872c7
|
|
|
1183
1190
|
* [.parsePdf(pdfStream, renderingMethod)](#util.file.parsePdf) ⇒ <code>String</code>
|
|
1184
1191
|
* [.expectPdfContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfContainsText)
|
|
1185
1192
|
* [.expectPdfNotContainsText(pdfStream, text, renderingMethod)](#util.file.expectPdfNotContainsText)
|
|
1193
|
+
* [.getExcelData(filePath, fileName, [sheetIndex], [conversionType])](#util.file.getExcelData)
|
|
1194
|
+
* [.getTextData(filePath)](#util.file.getTextData)
|
|
1195
|
+
* [.expectTextDataToContain(filePath)](#util.file.expectTextDataToContain)
|
|
1196
|
+
* [.getXmlData(filePath)](#util.file.getXmlData)
|
|
1197
|
+
* [.getAttributeValuesFromJson(object)](#util.file.getAttributeValuesFromJson)
|
|
1198
|
+
* [.findFilePathRecursively(directory, fileName)](#util.file.findFilePathRecursively)
|
|
1199
|
+
* [.getFileNamesByExtensions(dirPath, fileExtensions)](#util.file.getFileNamesByExtensions)
|
|
1186
1200
|
|
|
1187
1201
|
<a name="util.file.upload"></a>
|
|
1188
1202
|
|
|
@@ -1274,6 +1288,119 @@ Parses the PDF and checks for given text not to be contained in PDF.
|
|
|
1274
1288
|
```js
|
|
1275
1289
|
await util.file.expectPdfNotContainsText(pdfStream, "abc");
|
|
1276
1290
|
```
|
|
1291
|
+
<a name="util.file.getExcelData"></a>
|
|
1292
|
+
|
|
1293
|
+
#### file.getExcelData(filePath, fileName, [sheetIndex], [conversionType])
|
|
1294
|
+
- It returns the excel data based on the conversion type which is passed
|
|
1295
|
+
|
|
1296
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1297
|
+
|
|
1298
|
+
| Param | Type | Description |
|
|
1299
|
+
| --- | --- | --- |
|
|
1300
|
+
| filePath | <code>string</code> | File path is required |
|
|
1301
|
+
| fileName | <code>string</code> | File Name is required |
|
|
1302
|
+
| [sheetIndex] | <code>number</code> | sheetIndex is required |
|
|
1303
|
+
| [conversionType] | <code>string</code> | Value for this are [json, csv, txt] |
|
|
1304
|
+
|
|
1305
|
+
**Example**
|
|
1306
|
+
```js
|
|
1307
|
+
const myTableContent = await util.file.getExcelData("/Users/path/myWork", "myTable.xlx");
|
|
1308
|
+
```
|
|
1309
|
+
<a name="util.file.getTextData"></a>
|
|
1310
|
+
|
|
1311
|
+
#### file.getTextData(filePath)
|
|
1312
|
+
- Returns the content of a .txt file.
|
|
1313
|
+
|
|
1314
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1315
|
+
|
|
1316
|
+
| Param | Type | Description |
|
|
1317
|
+
| --- | --- | --- |
|
|
1318
|
+
| filePath | <code>string</code> | Path to the file. |
|
|
1319
|
+
|
|
1320
|
+
**Example**
|
|
1321
|
+
```js
|
|
1322
|
+
const txtData = await util.file.getTextData(path.resolve(__dirname, "./testFiles/test3.txt"));
|
|
1323
|
+
const isDateIncluded = txtData.includes("26.6.2023");
|
|
1324
|
+
common.assertion.expectEqual(isDateIncluded, true);
|
|
1325
|
+
```
|
|
1326
|
+
<a name="util.file.expectTextDataToContain"></a>
|
|
1327
|
+
|
|
1328
|
+
#### file.expectTextDataToContain(filePath)
|
|
1329
|
+
- Reads the specified .txt file and asserts if it includes a specific string.
|
|
1330
|
+
|
|
1331
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1332
|
+
|
|
1333
|
+
| Param | Type | Description |
|
|
1334
|
+
| --- | --- | --- |
|
|
1335
|
+
| filePath | <code>string</code> | Path to the file. |
|
|
1336
|
+
|
|
1337
|
+
**Example**
|
|
1338
|
+
```js
|
|
1339
|
+
await util.file.expectTextDataToContain("/Users/path/myWork", "supplierList.txt");
|
|
1340
|
+
```
|
|
1341
|
+
<a name="util.file.getXmlData"></a>
|
|
1342
|
+
|
|
1343
|
+
#### file.getXmlData(filePath)
|
|
1344
|
+
- Returns the converted JSON object based on the passed XML file.
|
|
1345
|
+
|
|
1346
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1347
|
+
|
|
1348
|
+
| Param | Type | Description |
|
|
1349
|
+
| --- | --- | --- |
|
|
1350
|
+
| filePath | <code>string</code> | Path to the file. |
|
|
1351
|
+
|
|
1352
|
+
**Example**
|
|
1353
|
+
```js
|
|
1354
|
+
const xmlData = await util.file.getXmlData(path.resolve(__dirname, "./testFiles/test2.xml"));
|
|
1355
|
+
```
|
|
1356
|
+
<a name="util.file.getAttributeValuesFromJson"></a>
|
|
1357
|
+
|
|
1358
|
+
#### file.getAttributeValuesFromJson(object)
|
|
1359
|
+
- Traverses the passed JSON object and returns the value/s of the passed attribute if found. Else returns empty Array.
|
|
1360
|
+
|
|
1361
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1362
|
+
|
|
1363
|
+
| Param | Type | Description |
|
|
1364
|
+
| --- | --- | --- |
|
|
1365
|
+
| object | <code>object</code> | The JSON Object to search through. |
|
|
1366
|
+
|
|
1367
|
+
**Example**
|
|
1368
|
+
```js
|
|
1369
|
+
const attribute = util.file.getAttributeValuesFromJson(xmlData, "CtrlSum");
|
|
1370
|
+
```
|
|
1371
|
+
<a name="util.file.findFilePathRecursively"></a>
|
|
1372
|
+
|
|
1373
|
+
#### file.findFilePathRecursively(directory, fileName)
|
|
1374
|
+
- Returns the absolute path of the file with the given filename. Searches Recursively for the file within the given directory.
|
|
1375
|
+
|
|
1376
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1377
|
+
|
|
1378
|
+
| Param | Type | Description |
|
|
1379
|
+
| --- | --- | --- |
|
|
1380
|
+
| directory | <code>string</code> | The name of the directory. |
|
|
1381
|
+
| fileName | <code>string</code> | The name of the file. |
|
|
1382
|
+
|
|
1383
|
+
**Example**
|
|
1384
|
+
```js
|
|
1385
|
+
await util.file.findFilePathRecursively("/Users","test.xls");
|
|
1386
|
+
```
|
|
1387
|
+
<a name="util.file.getFileNamesByExtensions"></a>
|
|
1388
|
+
|
|
1389
|
+
#### file.getFileNamesByExtensions(dirPath, fileExtensions)
|
|
1390
|
+
- Returns the filename/s of the given directory filtered by the given extensions.
|
|
1391
|
+
|
|
1392
|
+
**Kind**: static method of [<code>file</code>](#util.file)
|
|
1393
|
+
|
|
1394
|
+
| Param | Type | Description |
|
|
1395
|
+
| --- | --- | --- |
|
|
1396
|
+
| dirPath | <code>string</code> | The path to the directory. |
|
|
1397
|
+
| fileExtensions | <code>string</code> \| <code>Array.<string></code> | The file extension as string or multiple as string array. |
|
|
1398
|
+
|
|
1399
|
+
**Example**
|
|
1400
|
+
```js
|
|
1401
|
+
const fileName = await util.file.getFileNamesByExtensions("regression/downloads", "xml");
|
|
1402
|
+
const fileNames = await util.file.getFileNamesByExtensions("regression/downloads", "["xml", "txt"]");
|
|
1403
|
+
```
|
|
1277
1404
|
<a name="util.formatter"></a>
|
|
1278
1405
|
|
|
1279
1406
|
### util.formatter
|
|
@@ -68,6 +68,40 @@ export declare class File {
|
|
|
68
68
|
* @example const myTableContent = await util.file.getExcelData("/Users/path/myWork", "myTable.xlx");
|
|
69
69
|
*/
|
|
70
70
|
getExcelData(filePath: string, fileName: string, sheetIndex?: number, conversionType?: string): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* @function getTextData
|
|
73
|
+
* @memberof util.file
|
|
74
|
+
* @description - Returns the content of a .txt file.
|
|
75
|
+
* @param {string} filePath - Path to the file.
|
|
76
|
+
* @example const txtData = await util.file.getTextData(path.resolve(__dirname, "./testFiles/test3.txt"));
|
|
77
|
+
* const isDateIncluded = txtData.includes("26.6.2023");
|
|
78
|
+
* common.assertion.expectEqual(isDateIncluded, true);
|
|
79
|
+
*/
|
|
80
|
+
getTextData(filePath: string): Promise<any>;
|
|
81
|
+
/**
|
|
82
|
+
* @function expectTextDataToContain
|
|
83
|
+
* @memberof util.file
|
|
84
|
+
* @description - Reads the specified .txt file and asserts if it includes a specific string.
|
|
85
|
+
* @param {string} filePath - Path to the file.
|
|
86
|
+
* @example await util.file.expectTextDataToContain("/Users/path/myWork", "supplierList.txt");
|
|
87
|
+
*/
|
|
88
|
+
expectTextDataToContain(filePath: string, searchString: string): Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* @function getXmlData
|
|
91
|
+
* @memberof util.file
|
|
92
|
+
* @description - Returns the converted JSON object based on the passed XML file.
|
|
93
|
+
* @param {string} filePath - Path to the file.
|
|
94
|
+
* @example const xmlData = await util.file.getXmlData(path.resolve(__dirname, "./testFiles/test2.xml"));
|
|
95
|
+
*/
|
|
96
|
+
getXmlData(filePath: string): Promise<any>;
|
|
97
|
+
/**
|
|
98
|
+
* @function getAttributeValuesFromJson
|
|
99
|
+
* @memberof util.file
|
|
100
|
+
* @description - Traverses the passed JSON object and returns the value/s of the passed attribute if found. Else returns empty Array.
|
|
101
|
+
* @param {object} object - The JSON Object to search through.
|
|
102
|
+
* @example const attribute = util.file.getAttributeValuesFromJson(xmlData, "CtrlSum");
|
|
103
|
+
*/
|
|
104
|
+
getAttributeValuesFromJson(object: any, attributeName: string): any[];
|
|
71
105
|
/**
|
|
72
106
|
* @function findFilePathRecursively
|
|
73
107
|
* @memberof util.file
|
|
@@ -77,8 +111,19 @@ export declare class File {
|
|
|
77
111
|
* @example await util.file.findFilePathRecursively("/Users","test.xls");
|
|
78
112
|
*/
|
|
79
113
|
findFilePathRecursively(directory: string, fileName: string): Promise<any>;
|
|
114
|
+
/**
|
|
115
|
+
* @function getFileNamesByExtensions
|
|
116
|
+
* @memberof util.file
|
|
117
|
+
* @description - Returns the filename/s of the given directory filtered by the given extensions.
|
|
118
|
+
* @param {string} dirPath - The path to the directory.
|
|
119
|
+
* @param {string | string[]} fileExtensions - The file extension as string or multiple as string array.
|
|
120
|
+
* @example const fileName = await util.file.getFileNamesByExtensions("regression/downloads", "xml");
|
|
121
|
+
* const fileNames = await util.file.getFileNamesByExtensions("regression/downloads", "["xml", "txt"]");
|
|
122
|
+
*/
|
|
123
|
+
getFileNamesByExtensions(dirPath: string, fileExtensions: string | string[]): string[];
|
|
80
124
|
private _renderPage;
|
|
81
125
|
private _convertSheet;
|
|
126
|
+
private _checkFileEnding;
|
|
82
127
|
}
|
|
83
128
|
declare const _default: File;
|
|
84
129
|
export default _default;
|
|
@@ -33,6 +33,7 @@ const pdf_parse_1 = __importDefault(require("pdf-parse"));
|
|
|
33
33
|
const fs = __importStar(require("fs"));
|
|
34
34
|
const xlsx = __importStar(require("xlsx"));
|
|
35
35
|
const os = __importStar(require("os"));
|
|
36
|
+
const xml2js = __importStar(require("xml2js"));
|
|
36
37
|
/**
|
|
37
38
|
* @class file
|
|
38
39
|
* @memberof util
|
|
@@ -193,6 +194,89 @@ class File {
|
|
|
193
194
|
const sheet = workbook.Sheets[sheetName];
|
|
194
195
|
return this._convertSheet(conversionType, sheet);
|
|
195
196
|
}
|
|
197
|
+
// =================================== TXT ===================================
|
|
198
|
+
/**
|
|
199
|
+
* @function getTextData
|
|
200
|
+
* @memberof util.file
|
|
201
|
+
* @description - Returns the content of a .txt file.
|
|
202
|
+
* @param {string} filePath - Path to the file.
|
|
203
|
+
* @example const txtData = await util.file.getTextData(path.resolve(__dirname, "./testFiles/test3.txt"));
|
|
204
|
+
* const isDateIncluded = txtData.includes("26.6.2023");
|
|
205
|
+
* common.assertion.expectEqual(isDateIncluded, true);
|
|
206
|
+
*/
|
|
207
|
+
async getTextData(filePath) {
|
|
208
|
+
const vl = this.vlf.initLog(this.getTextData);
|
|
209
|
+
if (fs.existsSync(filePath) && this._checkFileEnding(filePath, "txt")) {
|
|
210
|
+
try {
|
|
211
|
+
return await fs.readFileSync(filePath, { encoding: "utf8" });
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
throw new Error(`Function: 'getTextData' failed: ${error}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @function expectTextDataToContain
|
|
220
|
+
* @memberof util.file
|
|
221
|
+
* @description - Reads the specified .txt file and asserts if it includes a specific string.
|
|
222
|
+
* @param {string} filePath - Path to the file.
|
|
223
|
+
* @example await util.file.expectTextDataToContain("/Users/path/myWork", "supplierList.txt");
|
|
224
|
+
*/
|
|
225
|
+
async expectTextDataToContain(filePath, searchString) {
|
|
226
|
+
const vl = this.vlf.initLog(this.expectTextDataToContain);
|
|
227
|
+
if (fs.existsSync(filePath)) {
|
|
228
|
+
try {
|
|
229
|
+
const fileContent = fs.readFileSync(filePath, "utf-8");
|
|
230
|
+
common.assertion.expectTrue(fileContent.includes(searchString));
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
throw new Error("Function 'expectTextDataToContain' failed: Search String not included in .txt file.");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// =================================== XML ===================================
|
|
238
|
+
/**
|
|
239
|
+
* @function getXmlData
|
|
240
|
+
* @memberof util.file
|
|
241
|
+
* @description - Returns the converted JSON object based on the passed XML file.
|
|
242
|
+
* @param {string} filePath - Path to the file.
|
|
243
|
+
* @example const xmlData = await util.file.getXmlData(path.resolve(__dirname, "./testFiles/test2.xml"));
|
|
244
|
+
*/
|
|
245
|
+
async getXmlData(filePath) {
|
|
246
|
+
const vl = this.vlf.initLog(this.getXmlData);
|
|
247
|
+
if (fs.existsSync(filePath) && this._checkFileEnding(filePath, "xml")) {
|
|
248
|
+
try {
|
|
249
|
+
const xmlData = await fs.readFileSync(filePath);
|
|
250
|
+
const parser = new xml2js.Parser({ trim: true, normalize: true });
|
|
251
|
+
return await parser.parseStringPromise(xmlData);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
throw new Error(`Function: 'getXmlData' failed: ${error}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// =================================== JSON ===================================
|
|
259
|
+
/**
|
|
260
|
+
* @function getAttributeValuesFromJson
|
|
261
|
+
* @memberof util.file
|
|
262
|
+
* @description - Traverses the passed JSON object and returns the value/s of the passed attribute if found. Else returns empty Array.
|
|
263
|
+
* @param {object} object - The JSON Object to search through.
|
|
264
|
+
* @example const attribute = util.file.getAttributeValuesFromJson(xmlData, "CtrlSum");
|
|
265
|
+
*/
|
|
266
|
+
getAttributeValuesFromJson(object, attributeName) {
|
|
267
|
+
const values = [];
|
|
268
|
+
if (typeof object !== "object" || object === null) {
|
|
269
|
+
return values;
|
|
270
|
+
}
|
|
271
|
+
if (attributeName in object) {
|
|
272
|
+
values.push(object[attributeName]);
|
|
273
|
+
}
|
|
274
|
+
for (const key in object) {
|
|
275
|
+
const nestedValues = this.getAttributeValuesFromJson(object[key], attributeName);
|
|
276
|
+
values.push(...nestedValues);
|
|
277
|
+
}
|
|
278
|
+
return values.flat();
|
|
279
|
+
}
|
|
196
280
|
// =================================== FILEPATH ===================================
|
|
197
281
|
/**
|
|
198
282
|
* @function findFilePathRecursively
|
|
@@ -228,6 +312,26 @@ class File {
|
|
|
228
312
|
}
|
|
229
313
|
return null;
|
|
230
314
|
}
|
|
315
|
+
// =================================== FILENAME ===================================
|
|
316
|
+
/**
|
|
317
|
+
* @function getFileNamesByExtensions
|
|
318
|
+
* @memberof util.file
|
|
319
|
+
* @description - Returns the filename/s of the given directory filtered by the given extensions.
|
|
320
|
+
* @param {string} dirPath - The path to the directory.
|
|
321
|
+
* @param {string | string[]} fileExtensions - The file extension as string or multiple as string array.
|
|
322
|
+
* @example const fileName = await util.file.getFileNamesByExtensions("regression/downloads", "xml");
|
|
323
|
+
* const fileNames = await util.file.getFileNamesByExtensions("regression/downloads", "["xml", "txt"]");
|
|
324
|
+
*/
|
|
325
|
+
getFileNamesByExtensions(dirPath, fileExtensions) {
|
|
326
|
+
const files = fs.readdirSync(dirPath);
|
|
327
|
+
if (!Array.isArray(fileExtensions)) {
|
|
328
|
+
fileExtensions = [fileExtensions];
|
|
329
|
+
}
|
|
330
|
+
return files.filter((file) => {
|
|
331
|
+
const extension = path.extname(file).toLowerCase();
|
|
332
|
+
return fileExtensions.some((ext) => ext.toLowerCase() === extension.slice(1));
|
|
333
|
+
});
|
|
334
|
+
}
|
|
231
335
|
// =================================== HELPER ===================================
|
|
232
336
|
async _renderPage(pageData) {
|
|
233
337
|
// should be in scope of render page due to library specific implementation
|
|
@@ -274,6 +378,16 @@ class File {
|
|
|
274
378
|
}
|
|
275
379
|
return excelData;
|
|
276
380
|
}
|
|
381
|
+
_checkFileEnding(filePath, expectedFileEnding) {
|
|
382
|
+
const vl = this.vlf.initLog(this._checkFileEnding);
|
|
383
|
+
const fileEnding = path.extname(filePath).slice(1);
|
|
384
|
+
if (fileEnding.toLowerCase() === expectedFileEnding.toLowerCase()) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
throw new Error(`Function 'checkFileEnding' failed: Wrong file format '${fileEnding}' was passed to function. Expected file format: ${expectedFileEnding}.`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
277
391
|
}
|
|
278
392
|
exports.File = File;
|
|
279
393
|
exports.default = new File();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/file.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,8DAAkE;AAClE,2CAA6B;AAC7B,0DAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../src/reuse/modules/util/file.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,8DAAkE;AAClE,2CAA6B;AAC7B,0DAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,+CAAiC;AAIjC;;;GAGG;AAEH,MAAa,IAAI;IAAjB;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA2XzD,CAAC;IAzXC,iFAAiF;IACjF;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CAAC,KAAoB,EAAE,WAAmB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BAC5C,MAAM;YACR,KAAK,KAAK;gBACR,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3C,MAAM;YACR,KAAK,KAAK;gBACR,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3C,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,gBAAgB,CAAC,QAAgB,EAAE,kBAA0B;QACnE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAEnD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnD,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,kBAAkB,CAAC,WAAW,EAAE,EAAE;YACjE,OAAO,IAAI,CAAC;SACb;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,yDAAyD,UAAU,mDAAmD,kBAAkB,GAAG,CAAC,CAAC;SAC9J;IACH,CAAC;CACF;AA5XD,oBA4XC;AACD,kBAAe,IAAI,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap_oss/wdio-qmate-service",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"author": "SAP SE",
|
|
5
5
|
"types": "./@types/index.d.ts",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -136,11 +136,13 @@
|
|
|
136
136
|
"query-string": "^7.1.0",
|
|
137
137
|
"supertest": "^6.1.6",
|
|
138
138
|
"xlsx": "^0.18.5",
|
|
139
|
+
"xml2js": "^0.6.0",
|
|
139
140
|
"yargs": "^17.1.1"
|
|
140
141
|
},
|
|
141
142
|
"devDependencies": {
|
|
142
143
|
"@types/fs-extra": "^11.0.1",
|
|
143
144
|
"@types/pdf-parse": "^1.1.1",
|
|
145
|
+
"@types/xml2js": "^0.4.11",
|
|
144
146
|
"@wdio/cli": "^8.6.9",
|
|
145
147
|
"@wdio/local-runner": "^8.6.9",
|
|
146
148
|
"@wdio/mocha-framework": "^8.6.8",
|
|
@@ -27,5 +27,5 @@ exports.config = merge(profile.config, {
|
|
|
27
27
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
28
28
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
29
29
|
// gets prepended directly.
|
|
30
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
30
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
31
31
|
});
|
|
@@ -34,5 +34,5 @@ exports.config = merge(profile.config, {
|
|
|
34
34
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
35
35
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
36
36
|
// gets prepended directly.
|
|
37
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
37
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
38
38
|
});
|
|
@@ -42,7 +42,7 @@ describe("Test for ", function () {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
it("should use UI5 Control binding properties command on element level", async function () {
|
|
45
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html#/categories");
|
|
45
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories");
|
|
46
46
|
const ui5ControlProperties = {
|
|
47
47
|
"elementProperties": {
|
|
48
48
|
"metadata": "sap.m.StandardListItem", "mProperties": {
|
|
@@ -27,5 +27,5 @@ exports.config = merge(profile.config, {
|
|
|
27
27
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
28
28
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
29
29
|
// gets prepended directly.
|
|
30
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
30
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
31
31
|
});
|
|
@@ -28,5 +28,5 @@ exports.config = merge(profile.config, {
|
|
|
28
28
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
29
29
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
30
30
|
// gets prepended directly.
|
|
31
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
31
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
32
32
|
});
|
|
@@ -50,7 +50,7 @@ describe("Test 'getAllUI5Aggregations()' and 'getUI5Aggregation()' on both eleme
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it("should get List Item aggregations on both element and browser levels and access tooltip aggregation", async function () {
|
|
53
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html#/categories");
|
|
53
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories");
|
|
54
54
|
|
|
55
55
|
const listElementProperties = {
|
|
56
56
|
"elementProperties": {
|
|
@@ -75,7 +75,7 @@ describe("Test 'getAllUI5Aggregations()' and 'getUI5Aggregation()' on both eleme
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it("should try to access non-existing/empty aggregation(s)", async function () {
|
|
78
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html#/categories");
|
|
78
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories");
|
|
79
79
|
const listElementProperties = {
|
|
80
80
|
"elementProperties": {
|
|
81
81
|
"metadata": "sap.m.StandardListItem", "mProperties": {
|
|
@@ -12,5 +12,5 @@ exports.config = merge(profile.config, {
|
|
|
12
12
|
path.resolve(__dirname, "getBindingInfos.test.js")
|
|
13
13
|
],
|
|
14
14
|
|
|
15
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
15
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
16
16
|
});
|
|
@@ -27,5 +27,5 @@ exports.config = merge(profile.config, {
|
|
|
27
27
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
|
28
28
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
|
29
29
|
// gets prepended directly.
|
|
30
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html"
|
|
30
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3"
|
|
31
31
|
});
|
|
@@ -3,7 +3,7 @@ var path = require("path");
|
|
|
3
3
|
var qmateConf = require("../../helper/configurations/chrome.headless.conf");
|
|
4
4
|
// have main config file as default but overwrite environment specific information
|
|
5
5
|
exports.config = merge(qmateConf.config, {
|
|
6
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html",
|
|
6
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3",
|
|
7
7
|
|
|
8
8
|
suites: {
|
|
9
9
|
testLearn:[path.resolve(__dirname, "./filters1.spec.js")]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const merge = require("deepmerge");
|
|
2
2
|
const baseConfig = require("./base.conf.js");
|
|
3
|
+
const path = require("path");
|
|
3
4
|
|
|
4
5
|
exports.config = merge(baseConfig.config, {
|
|
5
6
|
path: "/",
|
|
@@ -29,7 +30,8 @@ exports.config = merge(baseConfig.config, {
|
|
|
29
30
|
"profile.password_manager_enabled": false,
|
|
30
31
|
credentials_enable_service: false,
|
|
31
32
|
password_manager_enabled: false,
|
|
32
|
-
"intl.accept_languages": "en,en_US"
|
|
33
|
+
"intl.accept_languages": "en,en_US",
|
|
34
|
+
"download.default_directory": path.join(process.cwd(), "downloads")
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -6,7 +6,7 @@ exports.config = merge(profile.config, {
|
|
|
6
6
|
maxInstances: 6,
|
|
7
7
|
specFileRetries: 2,
|
|
8
8
|
|
|
9
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html",
|
|
9
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3",
|
|
10
10
|
|
|
11
11
|
specs: [
|
|
12
12
|
path.resolve(__dirname, "expectDefined.spec.js"),
|
|
@@ -14,7 +14,7 @@ describe("userInteraction - fillActive", function () {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
it("Preparation", async function () {
|
|
17
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
17
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
18
18
|
await handleCookiesConsent();
|
|
19
19
|
});
|
|
20
20
|
|
|
@@ -35,7 +35,7 @@ describe("userInteraction - fillActive", function () {
|
|
|
35
35
|
describe("userInteraction - fillActive - element with invalid selector", function () {
|
|
36
36
|
|
|
37
37
|
it("Preparation", async function () {
|
|
38
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
38
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
39
39
|
await handleCookiesConsent();
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -57,7 +57,7 @@ describe("userInteraction - fillActive - element with number", function () {
|
|
|
57
57
|
let actualValue;
|
|
58
58
|
|
|
59
59
|
it("Preparation", async function () {
|
|
60
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
60
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
61
61
|
await handleCookiesConsent();
|
|
62
62
|
});
|
|
63
63
|
|
|
@@ -87,7 +87,7 @@ describe("userInteraction - fillActive - element with empty value", function ()
|
|
|
87
87
|
let value;
|
|
88
88
|
|
|
89
89
|
it("Preparation", async function () {
|
|
90
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
90
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
91
91
|
await handleCookiesConsent();
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -8,7 +8,7 @@ describe("userInteraction - fillActiveAndRetry", function () {
|
|
|
8
8
|
let actualValue;
|
|
9
9
|
|
|
10
10
|
it("Preparation", async function () {
|
|
11
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
11
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
12
12
|
await handleCookiesConsent();
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -39,7 +39,7 @@ describe("userInteraction - fillActiveAndRetry", function () {
|
|
|
39
39
|
describe("userInteraction - fillActiveAndRetry - invalid selector", function () {
|
|
40
40
|
|
|
41
41
|
it("Preparation", async function () {
|
|
42
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
42
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
43
43
|
await handleCookiesConsent();
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -62,7 +62,7 @@ describe("userInteraction - fillActiveAndRetry - element with number", function
|
|
|
62
62
|
let actualValue;
|
|
63
63
|
|
|
64
64
|
it("Preparation", async function () {
|
|
65
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
65
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
66
66
|
await handleCookiesConsent();
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -94,7 +94,7 @@ describe("userInteraction - fillActiveAndRetry - empty value", function () {
|
|
|
94
94
|
let value;
|
|
95
95
|
|
|
96
96
|
it("Preparation", async function () {
|
|
97
|
-
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html");
|
|
97
|
+
await browser.navigateTo("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3");
|
|
98
98
|
await handleCookiesConsent();
|
|
99
99
|
});
|
|
100
100
|
|
|
@@ -3,7 +3,7 @@ const { handleCookiesConsent } = require("../../../helper/utils");
|
|
|
3
3
|
|
|
4
4
|
describe("assertion - expectValueToBe", function () {
|
|
5
5
|
it("Preparation", async function () {
|
|
6
|
-
await common.navigation.navigateToUrl("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html#/categories");
|
|
6
|
+
await common.navigation.navigateToUrl("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories");
|
|
7
7
|
await handleCookiesConsent();
|
|
8
8
|
});
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ describe("assertion - expectValueToBe", function () {
|
|
|
15
15
|
|
|
16
16
|
describe("assertion - expectValueToBe - error case", function () {
|
|
17
17
|
it("Preparation", async function () {
|
|
18
|
-
await common.navigation.navigateToUrl("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html#/categories");
|
|
18
|
+
await common.navigation.navigateToUrl("https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3#/categories");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
it("Execution & Verification", async function () {
|
|
@@ -6,7 +6,7 @@ exports.config = merge(profile.config, {
|
|
|
6
6
|
maxInstances: 6,
|
|
7
7
|
specFileRetries: 2,
|
|
8
8
|
|
|
9
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html",
|
|
9
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3",
|
|
10
10
|
|
|
11
11
|
specs: [
|
|
12
12
|
path.resolve(__dirname, "expectToBeVisible.spec.js"),
|
|
@@ -8,7 +8,7 @@ exports.config = merge(profile.config, {
|
|
|
8
8
|
|
|
9
9
|
maxInstances: 5,
|
|
10
10
|
bail: 1,
|
|
11
|
-
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html",
|
|
11
|
+
baseUrl: "https://sapui5.hana.ondemand.com/1.99.0/test-resources/sap/m/demokit/cart/webapp/index.html?sap-ui-theme=sap_fiori_3",
|
|
12
12
|
|
|
13
13
|
specs: [
|
|
14
14
|
path.resolve(__dirname, "expectToBeVisible.spec.js"),
|