-
Notifications
You must be signed in to change notification settings - Fork 0
/
runCustomFlowFromGUI.js
59 lines (55 loc) · 1.63 KB
/
runCustomFlowFromGUI.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { chromium, webkit, devices } from 'playwright';
import { getComparator } from 'playwright-core/lib/utils';
import { execSync } from 'child_process';
import { argv } from 'process';
import fs from 'fs';
import os from 'os';
import path from 'path';
import { fileURLToPath } from 'url';
import readline from 'readline';
import printMessage from 'print-message';
import { createCrawleeSubFolders, runAxeScript } from '#root/crawlers/commonCrawlerFunc.js';
import { generateArtifacts } from '#root/mergeAxeResults.js';
import {
createAndUpdateResultsFolders,
createDetailsAndLogs,
createScreenshotsFolder,
cleanUp,
getStoragePath,
} from '#root/utils.js';
import constants, {
proxy,
getIntermediateScreenshotsPath,
getExecutablePath,
removeQuarantineFlag,
getDefaultChromeDataDir,
getDefaultEdgeDataDir,
guiInfoStatusTypes,
} from '#root/constants/constants.js';
import { isSkippedUrl, submitForm, getBlackListedPatterns } from '#root/constants/common.js';
import { consoleLogger, silentLogger, guiInfoLog } from './logs.js';
const generatedScript = argv[2];
console.log(argv);
console.log(generatedScript);
const genScriptString = fs.readFileSync(generatedScript, 'utf-8');
const genScriptCompleted = new Promise((resolve, reject) => {
eval(`(async () => {
try {
${genScriptString}
resolve();
} catch (e) {
reject(e)
}
})();`);
});
await genScriptCompleted;
// const run = () => {
// eval(`(async () => {
// try {
// ${genScriptString}
// } catch (e) {
// console.log(e);
// }
// })();`)
// }
// run();