Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: e2e test cli option capability #9985

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/all-versions-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:

# Test templates
- run: npm install -g @microsoft/teamsfx-cli@${{ matrix.cli-version }}
- run: teamsfx new --app-name migrationtest --capabilities ${{ matrix.template-capabilities }} --programming-language ${{ matrix.language }} --interactive false
- run: teamsfx new --app-name migrationtest --capability ${{ matrix.template-capabilities }} --programming-language ${{ matrix.language }} --interactive false
working-directory: ./
- run: npm install -D @microsoft/teamsfx-cli@alpha
working-directory: ./migrationtest
Expand Down
6 changes: 3 additions & 3 deletions docs/cli/user-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Let's start by installing `teamsfx-cli` from `npm` and run `teamsfx -h` to check
|:---------------- |:-------------|:-------------|
|`--app-name` | Yes| Name of your Teams application.|
|`--interactive`| No | Select the options interactively. Options are `true` and `false`. The default value is `true`.|
|`--capabilities`| No| Choose Teams application capabilities, multiple Options are: `tab`, `bot`, `messaging-extension` and `tab-spfx`. The default value is: `tab`.|
|`--capability`| No| Choose Teams application capabilities, multiple Options are: `tab`, `bot`, `messaging-extension` and `tab-spfx`. The default value is: `tab`.|
|`--programming-language`| No| Programming Language for the project. Options are `javascrip` or `typescript` and default value is: `javascript`.|
|`--folder`| No | Project directory. A sub folder with the your app name will be created under this directory. The default value is: `./`.|
|`--spfx-framework-type`| No| Applicable if `Tab(SPfx)` capability is selected. Frontend Framework. Options are `none` and `react`, the default value is: `none`.|
Expand All @@ -62,13 +62,13 @@ Using interactive mode to create a Teams app is super intuitive, please try it b
#### A tab app hosted on SPFx using React

```bash
teamsfx new --interactive false --app-name newspfxapp --capabilities tab-spfx --spfx-framework-type react
teamsfx new --interactive false --app-name newspfxapp --capability tab-spfx --spfx-framework-type react
```

#### A Teams app in JavaScript contains tab, bot capabilities and Azure Functions

```bash
teamsfx new --interactive false --app-name newtabbotapp --capabilities tab bot --programming-language javascript --azure-resources function
teamsfx new --interactive false --app-name newtabbotapp --capability tab bot --programming-language javascript --azure-resources function
```

#### A Teams tab app with Azure Functions and Azure SQL
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/src/commonlib/cliHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class CliHelper {
processEnv?: NodeJS.ProcessEnv,
options = ""
): Promise<void> {
const command = `teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capabilities ${capability} ${options}`;
const command = `teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capability ${capability} ${options}`;
const timeout = 100000;
try {
const result = await execAsync(command, {
Expand Down Expand Up @@ -277,7 +277,7 @@ export class CliHelper {
npx = false
) {
const npxCommand = npx ? "npx" : "";
const command = `${npxCommand} teamsfx new --interactive false --app-name ${appName} --capabilities ${capability} ${options}`;
const command = `${npxCommand} teamsfx new --interactive false --app-name ${appName} --capability ${capability} ${options}`;
const timeout = 100000;
try {
const result = await execAsync(command, {
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/src/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ teamsfx deploy ${resourceToDeploy} ${option}
capability: "tab" | "bot"

```bash
teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capabilities ${capability} ${options}
teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capability ${capability} ${options}
```

#### createProjectWithCapability
Expand All @@ -314,7 +314,7 @@ enum Capability {
```

```bash
teamsfx new --interactive false --app-name ${appName} --capabilities ${capability} ${options}
teamsfx new --interactive false --app-name ${appName} --capability ${capability} ${options}
```

#### createTemplateProject
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/src/e2e/bot/BotHappyPathCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function happyPathTest(
trigger === undefined
? ""
: `--bot-host-type-trigger ${trigger.join(" ")} `;
const cmdBase = `teamsfx new --interactive false --app-name ${appName} --capabilities ${capabilities} ${triggerStr}`;
const cmdBase = `teamsfx new --interactive false --app-name ${appName} --capability ${capabilities} ${triggerStr}`;
const cmd =
runtime === Runtime.Dotnet
? `${cmdBase} --runtime dotnet`
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/src/e2e/bot/CommandBotHappyPathCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function happyPathTest(runtime: Runtime): void {
it("Provision Resource: command and response", async function () {
const cmd =
runtime === Runtime.Node
? `teamsfx new --interactive false --app-name ${appName} --capabilities command-bot --programming-language typescript`
: `teamsfx new --interactive false --runtime ${runtime} --app-name ${appName} --capabilities command-bot`;
? `teamsfx new --interactive false --app-name ${appName} --capability command-bot --programming-language typescript`
: `teamsfx new --interactive false --runtime ${runtime} --app-name ${appName} --capability command-bot`;
await execAsync(cmd, {
cwd: testFolder,
env: env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function happyPathTest(runtime: Runtime): void {
it("Provision Resource: app service hosted notification", async function () {
const cmd =
runtime === Runtime.Node
? `teamsfx new --interactive false --app-name ${appName} --capabilities notification --bot-host-type-trigger http-restify --programming-language typescript`
: `teamsfx new --runtime dotnet --interactive false --app-name ${appName} --capabilities notification --bot-host-type-trigger http-webapi`;
? `teamsfx new --interactive false --app-name ${appName} --capability notification --bot-host-type-trigger http-restify --programming-language typescript`
: `teamsfx new --runtime dotnet --interactive false --app-name ${appName} --capability notification --bot-host-type-trigger http-webapi`;
await execAsync(cmd, {
cwd: testFolder,
env: env,
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/src/e2e/bot/WorkflowBotHappyPathCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export function happyPathTest(runtime: Runtime): void {
it("Provision Resource: workflow bot", async function () {
const cmd =
runtime === Runtime.Node
? `teamsfx new --interactive false --app-name ${appName} --capabilities workflow-bot --programming-language typescript`
: `teamsfx new --interactive false --runtime ${runtime} --app-name ${appName} --capabilities workflow-bot`;
? `teamsfx new --interactive false --app-name ${appName} --capability workflow-bot --programming-language typescript`
: `teamsfx new --interactive false --runtime ${runtime} --app-name ${appName} --capability workflow-bot`;
await execAsync(cmd, {
cwd: testFolder,
env: env,
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/src/e2e/collaboration/Permission.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Collaboration", function () {

// new a project
await execAsync(
`teamsfx new --interactive false --capabilities sso-launch-page --app-name ${appName}`,
`teamsfx new --interactive false --capability sso-launch-page --app-name ${appName}`,
{
cwd: testFolder,
env: process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("Collaboration", function () {

// new a project
await execAsync(
`teamsfx new --interactive false --capabilities tab-spfx --app-name ${appName}`,
`teamsfx new --interactive false --capability tab-spfx --app-name ${appName}`,
{
cwd: testFolder,
env: process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("Multi Env Happy Path for Azure", function () {
try {
let result;
result = await execAsync(
`teamsfx new --interactive false --app-name ${appName} --capabilities notification --bot-host-type-trigger http-functions --programming-language javascript`,
`teamsfx new --interactive false --app-name ${appName} --capability notification --bot-host-type-trigger http-functions --programming-language javascript`,
{
cwd: testFolder,
env: processEnv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Multi Env Happy Path for SPFx", function () {
"Can create/provision/deploy/validate/package/publish an SPFx project",
{ testPlanCaseId: 24137702, author: "[email protected]" },
async function () {
const command = `teamsfx new --interactive false --app-name ${appName} --capabilities tab-spfx --spfx-framework-type ${type} --spfx-webpart-name helloworld --programming-language typescript`;
const command = `teamsfx new --interactive false --app-name ${appName} --capability tab-spfx --spfx-framework-type ${type} --spfx-webpart-name helloworld --programming-language typescript`;
let result = await execAsync(command, {
cwd: testFolder,
env: processEnv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Start a new project", function () {
"Create SPFx project with minimal framework",
{ testPlanCaseId: 15687313, author: "[email protected]" },
async function () {
const command = `teamsfx new --interactive false --app-name ${appName} --capabilities tab-spfx --spfx-framework-type minimal --spfx-webpart-name helloworld --programming-language typescript`;
const command = `teamsfx new --interactive false --app-name ${appName} --capability tab-spfx --spfx-framework-type minimal --spfx-webpart-name helloworld --programming-language typescript`;
const result = await execAsync(command, {
cwd: testFolder,
env: process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Start a new project", function () {
"Create SPFx project without framework",
{ testPlanCaseId: 15687319, author: "[email protected]" },
async function () {
const command = `teamsfx new --interactive false --app-name ${appName} --capabilities tab-spfx --spfx-framework-type none --spfx-webpart-name helloworld --programming-language typescript`;
const command = `teamsfx new --interactive false --app-name ${appName} --capability tab-spfx --spfx-framework-type none --spfx-webpart-name helloworld --programming-language typescript`;
const result = await execAsync(command, {
cwd: testFolder,
env: process.env,
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/src/ui-test/cliHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export class CliHelper {
processEnv?: NodeJS.ProcessEnv,
options = ""
): Promise<void> {
const command = `teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capabilities ${capability} ${options}`;
const command = `teamsfx new --interactive false --runtime dotnet --app-name ${appName} --capability ${capability} ${options}`;
const timeout = 100000;
try {
const result = await execAsync(command, {
Expand Down Expand Up @@ -379,7 +379,7 @@ export class CliHelper {
processEnv?: NodeJS.ProcessEnv
) {
console.log("isV3Enabled: " + isV3Enabled());
const command = `teamsfx new --interactive false --app-name ${appName} --capabilities ${capability} --programming-language ${lang} ${options}`;
const command = `teamsfx new --interactive false --app-name ${appName} --capability ${capability} --programming-language ${lang} ${options}`;
const timeout = 100000;
try {
await Executor.execute("teamsfx -v", testFolder);
Expand Down
36 changes: 18 additions & 18 deletions packages/tests/src/ui-test/localdebug/localdebugContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,37 @@ export class LocalDebugTestContext extends TestContext {
case "tab":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities sso-launch-page --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability sso-launch-page --programming-language ${this.lang}`
);
break;
case "tabnsso":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab-non-sso --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab-non-sso --programming-language ${this.lang}`
);
break;
case "funcNoti":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities notification --bot-host-type-trigger http-functions --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability notification --bot-host-type-trigger http-functions --programming-language ${this.lang}`
);
break;
case "restNoti":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities notification --bot-host-type-trigger http-restify --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability notification --bot-host-type-trigger http-restify --programming-language ${this.lang}`
);
break;
case "crbot":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities command-bot --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability command-bot --programming-language ${this.lang}`
);
break;
case "function":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab --programming-language ${this.lang}`
);
await execCommand(
path.resolve(this.testRootFolder, this.appName),
Expand All @@ -127,25 +127,25 @@ export class LocalDebugTestContext extends TestContext {
case "bot":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities bot --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability bot --programming-language ${this.lang}`
);
break;
case "msg":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities collect-form-message-extension --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability collect-form-message-extension --programming-language ${this.lang}`
);
break;
case "msgsa":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities search-app --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability search-app --programming-language ${this.lang}`
);
break;
case "tabbot":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab --programming-language ${this.lang}`
);
await execCommand(
path.resolve(this.testRootFolder, this.appName),
Expand All @@ -155,13 +155,13 @@ export class LocalDebugTestContext extends TestContext {
case "spfx":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab-spfx --spfx-framework-type none --spfx-webpart-name ${this.appName}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab-spfx --spfx-framework-type none --spfx-webpart-name ${this.appName}`
);
break;
case "botfunc":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab --programming-language ${this.lang}`
);
await execCommand(
path.resolve(this.testRootFolder, this.appName),
Expand All @@ -175,31 +175,31 @@ export class LocalDebugTestContext extends TestContext {
case "m365lp":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities sso-launch-page --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability sso-launch-page --programming-language ${this.lang}`
);
break;
case "workflow":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities workflow-bot --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability workflow-bot --programming-language ${this.lang}`
);
break;
case "dashboard":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities dashboard-tab --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability dashboard-tab --programming-language ${this.lang}`
);
break;
case "timeNoti":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities notification --bot-host-type-trigger timer-functions --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability notification --bot-host-type-trigger timer-functions --programming-language ${this.lang}`
);
break;
case "ftNoti":
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities notification --bot-host-type-trigger http-and-timer-functions --programming-language ${this.lang}`
`teamsfx new --app-name ${this.appName} --interactive false --capability notification --bot-host-type-trigger http-and-timer-functions --programming-language ${this.lang}`
);
}
if (this.needMigrate) {
Expand Down Expand Up @@ -290,7 +290,7 @@ export class LocalDebugSpfxTestContext extends LocalDebugTestContext {
public async createProject(): Promise<void> {
await execCommand(
this.testRootFolder,
`teamsfx new --app-name ${this.appName} --interactive false --capabilities tab-spfx --spfx-framework-type ${this.framework} --spfx-webpart-name ${this.appName}`
`teamsfx new --app-name ${this.appName} --interactive false --capability tab-spfx --spfx-framework-type ${this.framework} --spfx-webpart-name ${this.appName}`
);
}
}
2 changes: 1 addition & 1 deletion packages/tests/src/utils/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Executor {
customized: Record<string, string> = {}
) {
const command =
`teamsfx new --interactive false --app-name ${appName} --capabilities ${capability} --programming-language ${language} ` +
`teamsfx new --interactive false --app-name ${appName} --capability ${capability} --programming-language ${language} ` +
Object.entries(customized)
.map(([key, value]) => "--" + key + " " + value)
.join(" ");
Expand Down