import fs from 'fs'; import path from 'path'; export async function getFullPathForFileName(fileName: string): Promise { let localFilePath: string; if (fileName.endsWith('.png')) { localFilePath = process.cwd() + '/resources/pngFiles/' + fileName; } else { localFilePath = process.cwd() + '/resources/pdfFiles/' + fileName; } return browser.uploadFile(localFilePath); } export function covertFileNameStringToFilePaths(fileNames: string) { let fullPaths = []; if (fileNames !== '' && !!fileNames) { const fileNameList = fileNames.split(',').map((fileName) => fileName.trim()); fullPaths = fileNameList.map((fileName) => { return getFullPathForFileName(fileName); }); } return fullPaths; } export function getProjectRootDir(): string { let currentDir = __dirname; while (!fs.existsSync(path.join(currentDir, 'package.json'))) { currentDir = path.join(currentDir, '..'); } return currentDir; }