67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
//@1
|
|
console.log("Loading: cli.js");
|
|
|
|
/*
|
|
Consumes : `login-config.json e.g.`
|
|
e.g. "startURL": "https://examples.eze2e.com/login/cookie/login.php",
|
|
"domain" : "https://examples.eze2e.com",
|
|
*/
|
|
|
|
/* Command Line Commands..
|
|
Step 1:
|
|
node cli.js
|
|
|
|
Step 2:
|
|
node generate-graph-data.js
|
|
>Loading: graph-utils.js
|
|
>graph-data.js written
|
|
|
|
Step 3:
|
|
open graph.html
|
|
*/
|
|
|
|
import fs from "fs";
|
|
import { execSync } from "child_process";
|
|
/*
|
|
`Runs` these..
|
|
"crawler-flow.js" , "Step 1: Crawling flows"
|
|
"selectors-crawler.js" , "Step 2: Crawling selectors"
|
|
"test-generator.js" , "Step 3: Generating tests"
|
|
"test-executor.js" , "Step 4: Running tests"
|
|
*/
|
|
|
|
|
|
const ACTION_TIMEOUT = Number(process.env.PW_ACTION_TIMEOUT) || 5000;
|
|
const NAV_TIMEOUT = Number(process.env.PW_NAV_TIMEOUT) || 5000;
|
|
|
|
console.log(`Using timeouts: ACTION_TIMEOUT=${ACTION_TIMEOUT}ms, NAV_TIMEOUT=${NAV_TIMEOUT}ms`);
|
|
|
|
function run(script, label) {
|
|
console.log(`\n=== ${label} (${script}) ===`);
|
|
execSync(`node ${script}`, {
|
|
stdio: "inherit",
|
|
env: {
|
|
...process.env,
|
|
PW_ACTION_TIMEOUT: ACTION_TIMEOUT,
|
|
PW_NAV_TIMEOUT: NAV_TIMEOUT
|
|
}
|
|
});
|
|
}
|
|
|
|
const mode = process.argv[2];
|
|
const outFile = process.argv[3];
|
|
|
|
console.log("\n=== Starting full pipeline ===");
|
|
|
|
run("crawler-flow.js", "Step 1: Crawling flows");
|
|
run("selectors-crawler.js", "Step 2: Crawling selectors");
|
|
run("test-generator.js", "Step 3: Generating tests");
|
|
run("test-executor.js", "Step 4: Running tests");
|
|
|
|
console.log("NEXT STEPS..");
|
|
console.log("node generate-graph-data.js (to generate graph data)");
|
|
console.log("open graph.html (to view graph , can view in browser from file explorer too)");
|
|
|
|
console.log("\n=== Pipeline complete ===");
|
|
|