29 lines
853 B
JavaScript
29 lines
853 B
JavaScript
const speeds = {
|
|
slow: { click: 2000, url: 4000, timeout: 50000 },
|
|
normal: { click: 1000, url: 2000, timeout: 30000 },
|
|
fast: { click: 750, url: 1500, timeout: 20000 },
|
|
superfast: { click: 500, url: 1000, timeout: 10000 },
|
|
};
|
|
|
|
function getSpeed() {
|
|
let speed = 'normal';
|
|
const args = process.argv.slice(2);
|
|
for (let i = 0; i < args.length; i++) {
|
|
if (args[i].startsWith('--')) {
|
|
if (args[i] === '--fast') {
|
|
speed = 'fast';
|
|
}
|
|
else if (args[i] === '--superfast') {
|
|
speed = 'superfast';
|
|
}
|
|
else if (args[i] === '--slow') {
|
|
speed = 'slow';
|
|
}
|
|
}
|
|
}
|
|
console.log(`Using ${speed} speed`);
|
|
const { click: timeTypeClick, url: timeTypeUrl, timeout: timeTypeTimeoutLoading } = speeds[speed];
|
|
return { clickTime: timeTypeClick, urlTime: timeTypeUrl, timeoutLoading: timeTypeTimeoutLoading };
|
|
}
|
|
|
|
module.exports = { getSpeed }; |