flagpole
Version:
Simple and fast DOM integration, headless or headful browser, and REST API testing framework.
54 lines • 2.81 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 command_1 = require("../command");
const cli_1 = require("../cli");
const flagpole_execution_1 = require("../../flagpole-execution");
const cli_helper_1 = require("../cli-helper");
const prompts = require("prompts");
class Import extends command_1.Command {
constructor() {
super(...arguments);
this.commandString = "import";
this.description = "find files in the tests folder that are not in Flagpole config and import them";
}
action() {
return __awaiter(this, void 0, void 0, function* () {
cli_1.Cli.subheader("Import Suite");
const suitesAvailableToImport = cli_helper_1.stringArrayToPromptChoices(cli_helper_1.findDetachedSuites());
if (!suitesAvailableToImport.length) {
cli_1.Cli.log("", "There were no JS files in tests folder available to import.", "").exit(0);
}
const responses = yield prompts([
cli_helper_1.promptMultiSelect("suitesNames", "Which suites do you want to import?", suitesAvailableToImport),
cli_helper_1.promptList("tags", "Add Tags (Optional, Space Delimited)"),
]);
if (responses &&
responses.suitesNames &&
responses.suitesNames.length > 0) {
responses.suitesNames.forEach((suiteName) => {
flagpole_execution_1.FlagpoleExecution.global.config &&
flagpole_execution_1.FlagpoleExecution.global.config.addSuite({
name: suiteName,
tags: responses.tags,
});
});
yield flagpole_execution_1.FlagpoleExecution.global.config.save();
cli_1.Cli.log(`Imported Suites:`).list(responses.suitesNames).log("").exit(0);
}
else {
cli_1.Cli.log("No suites selected. Nothing imported.").log("").exit(1);
}
});
}
}
exports.default = Import;
//# sourceMappingURL=import.js.map
;