1.0.2 • Published 2 years ago
wdio-enverus-core-ui-utils v1.0.2
WDIO Enverus Core UI utils
About
The motivation with this module is to provide a high-level abstraction for Core UI utils.
Getting Started
Install WDIO Enverus Core UI Utils
as an npm module and save it to your package.json file as a development dependency:
npm install wdio-enverus-core-ui-utils --save-dev
Once installed it can now be referenced by simply calling
import {
FileUtils as fileUtils,
StringUtils as stringUtils,
CookiesUtils as cookiesUtils
} from 'wdio-enverus-core-ui-utils';
Available methods:
File Utils:
- isFileDownloadedThenMove - Check if file name with extension is present in Download folder and move it
- isFileDownloadedThenMoveByPartName - Check if file name with extension is present in Download folder and move it (part of the name)
- moveFileIfExists - Move File if exist
- moveFileByPartNameIfExists - Move File if exist (part of the name)
- getFullPathToFile - Get full path to file
- getFullPathToFileByPartName - Get full path to file (part of the name )
- _moveFile - Move File from directory
- fileLineCount - Compare the number of line in file and table
- downloadFileFromRemoteServer - Download file from remote server. Using session id
- uploadFile - Upload file
- readTextFile - Read text file
- extractArchive - Extract archive to path
- _getFileName - Return file name with with extension(check case)
- fileHeader - Get file header
- fileLineData - Get file line data By Index
- csvToJson - Convert csv file to json
- isFileExist - Check if file exist
Method Summary
Methods | Methods type | Parameters |
---|---|---|
isFileDownloadedThenMove | public | fileName, fileExtension, suiteName, waitTimeout |
isFileDownloadedThenMoveByPartName | public | fileName, suiteName, waitTimeout |
moveFileIfExists | public | dirName, fileNameWithExt, suiteName, timeOut |
moveFileByPartNameIfExists | public | dirName, fileName, suiteName, timeOut |
getFullPathToFile | public | dirName, fileNameWithExt |
getFullPathToFileByPartName | public | dirName, fileNameWithExt |
_moveFile | private | fullPathToFile, fileNameWithExt, suiteName |
fileLineCount | public | fileName, fileExtension, suiteName, remove, splitLine |
downloadFileFromRemoteServer | public | EXPORT_FILE_NAME, FILE_EXTENSION, TIMEOUT |
uploadFile | public | fileName |
readTextFile | public | fileName, filePath, folder |
extractArchive | public | suiteName, fileName, timeout |
_getFileName | private | dirName, fileNameWithExt |
async fileHeader | public | fileName, fileExtension, suiteName |
async fileLineData | public | fileName, fileExtension, suiteName, index |
async csvToJson | public | fileName, fileExtension, suiteName |
isFileExist | public | FILE_NAME, FILE_PATH |
String Utils:
- areArraysEqual - Compare if two string arrays are equal. Order of elements in arrays does not matter.
- arrayToLowerCase - Convert all values in array to lowerCase.
- randomInt - Get random integer
- findDuplicatesInArray - Find duplicates in Array
- stringToArray - Convert string to array
Method Summary
Methods | Methods type | Parameters |
---|---|---|
areArraysEqual | public | arr1, arr2 |
arrayToLowerCase | public | stringArray |
randomInt | public | min, max |
findDuplicatesInArray | public | arr |
stringToArray | public | string, separator, booleanRemoveLegend |
Cookies Utils:
- writeCookies - Write cookies file
- userCookies - Get user cookies from file
- userToken - Get user token from file
userEnv - Get env from file
Method Summary
Methods | Methods type | Parameters |
---|---|---|
writeCookies | public | FILE_NAME, DATA, FILE_PATH |
userCookies | public | FILE_NAME, USER |
userToken | public | FILE_NAME, USER |
userEnv | public | FILE_NAME, FILE_PATH |