@sap_oss/wdio-qmate-service
Advanced tools
Comparing version 2.4.2 to 2.5.0
@@ -114,2 +114,12 @@ /// <reference types="node" /> | ||
findFilePathRecursively(directory: string, fileName: string): Promise<any>; | ||
/** | ||
* @function getFileNamesByExtensions | ||
* @memberof util.file | ||
* @description - Returns the filename/s of the given directory filtered by the given extensions. | ||
* @param {string} dirPath - The path to the directory. | ||
* @param {string | string[]} fileExtensions - 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"]"); | ||
*/ | ||
getFileNamesByExtensions(dirPath: string, fileExtensions: string | string[]): string[]; | ||
private _renderPage; | ||
@@ -116,0 +126,0 @@ private _convertSheet; |
@@ -315,2 +315,22 @@ "use strict"; | ||
} | ||
// =================================== FILENAME =================================== | ||
/** | ||
* @function getFileNamesByExtensions | ||
* @memberof util.file | ||
* @description - Returns the filename/s of the given directory filtered by the given extensions. | ||
* @param {string} dirPath - The path to the directory. | ||
* @param {string | string[]} fileExtensions - 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"]"); | ||
*/ | ||
getFileNamesByExtensions(dirPath, fileExtensions) { | ||
const files = fs.readdirSync(dirPath); | ||
if (!Array.isArray(fileExtensions)) { | ||
fileExtensions = [fileExtensions]; | ||
} | ||
return files.filter((file) => { | ||
const extension = path.extname(file).toLowerCase(); | ||
return fileExtensions.some((ext) => ext.toLowerCase() === extension.slice(1)); | ||
}); | ||
} | ||
// =================================== HELPER =================================== | ||
@@ -317,0 +337,0 @@ async _renderPage(pageData) { |
{ | ||
"name": "@sap_oss/wdio-qmate-service", | ||
"version": "2.4.2", | ||
"version": "2.5.0", | ||
"author": "SAP SE", | ||
@@ -5,0 +5,0 @@ "types": "./@types/index.d.ts", |
const merge = require("deepmerge"); | ||
const baseConfig = require("./base.conf.js"); | ||
const path = require("path"); | ||
@@ -32,3 +33,4 @@ exports.config = merge(baseConfig.config, { | ||
password_manager_enabled: false, | ||
"intl.accept_languages": "en,en_US" | ||
"intl.accept_languages": "en,en_US", | ||
"download.default_directory": path.join(process.cwd(), "downloads") | ||
} | ||
@@ -35,0 +37,0 @@ } |
@@ -12,5 +12,4 @@ const path = require("path"); | ||
specs: [ | ||
path.resolve(__dirname, "upload.spec.js"), | ||
path.resolve(__dirname, "pdfParser.spec.js"), | ||
path.resolve(__dirname, "getExcelData.spec.js"), | ||
path.resolve(__dirname, "pdfParser.spec.js"), | ||
path.resolve(__dirname, "getExcelData.spec.js"), | ||
path.resolve(__dirname, "findFilePathRecursively.spec.js"), | ||
@@ -20,4 +19,5 @@ path.resolve(__dirname, "getXmlData.spec.js"), | ||
path.resolve(__dirname, "getTextData.spec.js"), | ||
path.resolve(__dirname, "expectTextDataToContain.spec.js") | ||
path.resolve(__dirname, "expectTextDataToContain.spec.js"), | ||
path.resolve(__dirname, "getFileNamesByExtensions.spec.js") | ||
] | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2543969
704
35898