appcenter-cli
Version:
Command line tool for Visual Studio App Center
124 lines (100 loc) • 3.52 kB
text/typescript
import { CommandArgs, help, longName, required, hasArg } from "../../../util/commandline";
import { UITestPreparer } from "../lib/uitest-preparer";
import { PrepareTestsCommand } from "../lib/prepare-tests-command";
import { out } from "../../../util/interaction";
import { Messages } from "../lib/help-messages";
export default class PrepareUITestCommand extends PrepareTestsCommand {
appPath: string;
buildDir: string;
assemblyDir: string;
storePath: string;
storePassword: string;
keyAlias: string;
keyPassword: string;
signInfo: string;
uiTestToolsDir: string;
fixture: string[];
includeCategory: string[];
excludeCategory: string[];
testChunk: boolean;
fixtureChunk: boolean;
constructor(args: CommandArgs) {
super(args);
this.fixture = this.fixArrayParameter(this.fixture);
this.includeCategory = this.fixArrayParameter(this.includeCategory);
this.excludeCategory = this.fixArrayParameter(this.excludeCategory);
}
protected async validateOptions(): Promise<void> {
if (this.assemblyDir && !this.buildDir) {
out.text("Argument --assembly-dir is obsolete. Please use --build-dir instead.");
this.buildDir = this.assemblyDir;
}
if (!this.buildDir) {
throw new Error("Argument --build-dir is required.");
}
if (this.testChunk && this.fixtureChunk) {
throw new Error("Arguments --fixture-chunk and test-chunk cannot be combined.");
}
}
protected prepareManifest(): Promise<string> {
const preparer = new UITestPreparer(this.artifactsDir, this.buildDir, this.appPath);
preparer.storeFile = this.storePath;
preparer.storePassword = this.storePassword;
preparer.keyAlias = this.keyAlias;
preparer.keyPassword = this.keyPassword;
preparer.signInfo = this.signInfo;
preparer.uiTestToolsDir = this.uiTestToolsDir;
preparer.fixture = this.fixture;
preparer.includeCategory = this.includeCategory;
preparer.excludeCategory = this.excludeCategory;
preparer.testChunk = this.testChunk;
preparer.fixtureChunk = this.fixtureChunk;
return preparer.prepare();
}
protected getSourceRootDir() {
return this.buildDir;
}
}