Webdriverio-command-parser generates js module with functions based on custom command for webdriverio.
Source file
/**
* Check something
*/
browser.addCommand('myCustomCommand', async (myArg, myArgTwo) => {
// do smth
});
Outcome
const myCustomCommand => (myArg, MyArgTwo) => {};
module.exports = {
myCustomCommand
};
Outcoming module may be used for autocomplete in WebStorm.
npm install --save webdriverio-command-parser
for CLI
npm install -g webdriverio-command-parser
CLI (e.g with cron)
wparser -p /path/to/your/commands/ -o /place/for/save/parsed/commands/
You can indicate path to folder or directory
Possible args
-p, --path path to file or directory
-o, --output path to directory or file for write parsed commands
-f, --refile regexp for match files
-c, --recommand regexp for match custom command definitions
-d, --eslintdisable disable eslint in output file
-s, --showall show defective commands
-h, --help show help
As extrenal library
const {parsePath} = require('webdriverio-command-parser');
parsePath('/path/to/your/command').then(() => {
console.log('done');
}).catch(err => {
console.log(`some error here ${err}`);
});
Webdriverio-command-parser генерирует js модуль с функциями на основе кастомных комманд для webdriverio.
Исходный файл
/**
* Check something
*/
browser.addCommand('myCustomCommand', async (myArg, myArgTwo) => {
// do smth
});
Результат
const myCustomCommand => (myArg, MyArgTwo) => {};
module.exports = {
myCustomCommand
};
Полученный модуль можно использовать для автокомплита в WebStorm.
npm install --save webdriverio-command-parser
Или для использования из командной строки
npm install -g webdriverio-command-parser
Из командой строки (например, в кроне)
wparser -p /path/to/your/commands/ -o /place/for/save/parsed/commands/
Можно указывать путь до файла, или до папки.
Возможные аргументы
-p, --path path to file or directory
-o, --output path to directory or file for write parsed commands
-f, --refile regexp for match files
-c, --recommand regexp for match custom command definitions
-d, --eslintdisable disable eslint in output file
-s, --showall show defective commands
-h, --help show help
Как подключаемую либу
const {parsePath} = require('webdriverio-command-parser');
parsePath('/path/to/your/command').then(() => {
console.log('done');
}).catch(err => {
console.log(`some error here ${err}`);
});