flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
61 lines • 2.62 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_helper_1 = require("./cli-helper");
const cli_1 = require("./cli");
const prompts = require("prompts");
const fs = require("fs");
function importSuite() {
return __awaiter(this, void 0, void 0, function* () {
cli_1.Cli.hideBanner = true;
cli_helper_1.printHeader();
cli_helper_1.printSubheader("Import Suite");
const suitesAvailableToImport = cli_helper_1.stringArrayToPromptChoices(cli_1.Cli.findDetachedSuites());
if (!suitesAvailableToImport.length) {
cli_1.Cli.log("");
cli_1.Cli.log("There were no JS files in tests folder available to import.");
cli_1.Cli.log("");
cli_1.Cli.exit(0);
}
const responses = yield prompts([
{
type: "multiselect",
name: "suitesNames",
message: "Which suites do you want to import?",
choices: suitesAvailableToImport,
},
{
type: "list",
name: "tags",
message: "Add Tags (Optional)",
initial: "",
separator: " ",
},
]);
if (responses && responses.suitesNames && responses.suitesNames.length > 0) {
responses.suitesNames.forEach((suiteName) => {
cli_1.Cli.config.addSuite({ name: suiteName, tags: responses.tags });
});
yield cli_1.Cli.config.save();
cli_1.Cli.log(`Imported Suites:`);
cli_1.Cli.list(responses.suitesNames);
cli_1.Cli.log("");
cli_1.Cli.exit(0);
}
else {
cli_1.Cli.log("No suites selected. Nothing imported.");
cli_1.Cli.log("");
cli_1.Cli.exit(1);
}
});
}
exports.importSuite = importSuite;
//# sourceMappingURL=import.js.map