-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add apimsg with microsoft entra auth test cases (#11997)
- Loading branch information
Showing
9 changed files
with
326 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/tests/src/ui-test/localdebug/localdebug-msg-newapi-microsoftentra-ts.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* @author Anne Fu <v-annefu@microsoft.com> | ||
*/ | ||
import * as path from "path"; | ||
import { startDebugging, waitForTerminal } from "../../utils/vscodeOperation"; | ||
import { | ||
initNoAddappPage, | ||
validateApiMeResult, | ||
} from "../../utils/playwrightOperation"; | ||
import { LocalDebugTestContext } from "./localdebugContext"; | ||
import { Timeout, LocalDebugTaskLabel } from "../../utils/constants"; | ||
import { Env } from "../../utils/env"; | ||
import { it } from "../../utils/it"; | ||
import { validateFileExist } from "../../utils/commonUtils"; | ||
|
||
describe("Local Debug Tests", function () { | ||
this.timeout(Timeout.testCase); | ||
let localDebugTestContext: LocalDebugTestContext; | ||
|
||
beforeEach(async function () { | ||
// ensure workbench is ready | ||
this.timeout(Timeout.prepareTestCase); | ||
localDebugTestContext = new LocalDebugTestContext("msgmicroentra", { | ||
lang: "typescript", | ||
}); | ||
await localDebugTestContext.before(); | ||
}); | ||
|
||
afterEach(async function () { | ||
this.timeout(Timeout.finishTestCase); | ||
await localDebugTestContext.after(false, true); | ||
}); | ||
|
||
it( | ||
"[Typescript] Local debug for API Message Extension with none auth", | ||
{ | ||
testPlanCaseId: 28665898, | ||
author: "v-annefu@microsoft.com", | ||
}, | ||
async function () { | ||
const projectPath = path.resolve( | ||
localDebugTestContext.testRootFolder, | ||
localDebugTestContext.appName | ||
); | ||
validateFileExist(projectPath, "src/functions/repair.ts"); | ||
await startDebugging("Debug in Teams (Chrome)"); | ||
await waitForTerminal(LocalDebugTaskLabel.StartLocalTunnel); | ||
await waitForTerminal( | ||
LocalDebugTaskLabel.StartBackend, | ||
"Worker process started and initialized" | ||
); | ||
const teamsAppId = await localDebugTestContext.getTeamsAppId(); | ||
const page = await initNoAddappPage( | ||
localDebugTestContext.context!, | ||
teamsAppId, | ||
Env.username, | ||
Env.password | ||
); | ||
await validateApiMeResult(page, localDebugTestContext.appName); | ||
} | ||
); | ||
}); |
64 changes: 64 additions & 0 deletions
64
packages/tests/src/ui-test/localdebug/localdebug-msg-newapi-microsoftentra.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* @author Anne Fu <v-annefu@microsoft.com> | ||
*/ | ||
import * as path from "path"; | ||
import * as fs from "fs-extra"; | ||
import { startDebugging, waitForTerminal } from "../../utils/vscodeOperation"; | ||
import { | ||
initNoAddappPage, | ||
validateApiMeResult, | ||
} from "../../utils/playwrightOperation"; | ||
import { LocalDebugTestContext } from "./localdebugContext"; | ||
import { Timeout, LocalDebugTaskLabel } from "../../utils/constants"; | ||
import { Env } from "../../utils/env"; | ||
import { it } from "../../utils/it"; | ||
import { validateFileExist } from "../../utils/commonUtils"; | ||
|
||
describe("Local Debug Tests", function () { | ||
this.timeout(Timeout.testCase); | ||
let localDebugTestContext: LocalDebugTestContext; | ||
|
||
beforeEach(async function () { | ||
// ensure workbench is ready | ||
this.timeout(Timeout.prepareTestCase); | ||
localDebugTestContext = new LocalDebugTestContext("msgmicroentra"); | ||
await localDebugTestContext.before(); | ||
}); | ||
|
||
afterEach(async function () { | ||
this.timeout(Timeout.finishTestCase); | ||
await localDebugTestContext.after(false, true); | ||
}); | ||
|
||
it( | ||
"[Javascript] Local debug for API Message Extension with Microsoft Entra auth", | ||
{ | ||
testPlanCaseId: 28665871, | ||
author: "v-annefu@microsoft.com", | ||
}, | ||
async function () { | ||
const projectPath = path.resolve( | ||
localDebugTestContext.testRootFolder, | ||
localDebugTestContext.appName | ||
); | ||
validateFileExist(projectPath, "src/functions/repair.js"); | ||
await startDebugging("Debug in Teams (Chrome)"); | ||
await waitForTerminal(LocalDebugTaskLabel.StartLocalTunnel); | ||
await waitForTerminal( | ||
LocalDebugTaskLabel.StartBackend, | ||
"Worker process started and initialized" | ||
); | ||
const teamsAppId = await localDebugTestContext.getTeamsAppId(); | ||
const page = await initNoAddappPage( | ||
localDebugTestContext.context!, | ||
teamsAppId, | ||
Env.username, | ||
Env.password | ||
); | ||
await validateApiMeResult(page, localDebugTestContext.appName); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...s/tests/src/ui-test/remotedebug/remotedebug-msg-newapi-microsoftentra-ts-win-only.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* @author Anne Fu <v-annefu@microsoft.com> | ||
*/ | ||
import * as path from "path"; | ||
import { VSBrowser } from "vscode-extension-tester"; | ||
import { Timeout } from "../../utils/constants"; | ||
import { | ||
RemoteDebugTestContext, | ||
provisionProject, | ||
deployProject, | ||
} from "./remotedebugContext"; | ||
import { | ||
execCommandIfExist, | ||
createNewProject, | ||
} from "../../utils/vscodeOperation"; | ||
import { it } from "../../utils/it"; | ||
import { | ||
initNoAddappPage, | ||
validateApiMeResult, | ||
} from "../../utils/playwrightOperation"; | ||
import { Env } from "../../utils/env"; | ||
|
||
describe("Remote debug Tests", function () { | ||
this.timeout(Timeout.testAzureCase); | ||
let remoteDebugTestContext: RemoteDebugTestContext; | ||
let testRootFolder: string; | ||
let appName: string; | ||
const appNameCopySuffix = "copy"; | ||
let newAppFolderName: string; | ||
let projectPath: string; | ||
|
||
beforeEach(async function () { | ||
// ensure workbench is ready | ||
this.timeout(Timeout.prepareTestCase); | ||
remoteDebugTestContext = new RemoteDebugTestContext("msgmicroentra"); | ||
testRootFolder = remoteDebugTestContext.testRootFolder; | ||
appName = remoteDebugTestContext.appName; | ||
newAppFolderName = appName + appNameCopySuffix; | ||
projectPath = path.resolve(testRootFolder, newAppFolderName); | ||
await remoteDebugTestContext.before(); | ||
}); | ||
|
||
afterEach(async function () { | ||
this.timeout(Timeout.finishAzureTestCase); | ||
await remoteDebugTestContext.after(); | ||
|
||
//Close the folder and cleanup local sample project | ||
|
||
await execCommandIfExist("Workspaces: Close Workspace", Timeout.webView); | ||
console.log(`[Successfully] start to clean up for ${projectPath}`); | ||
await remoteDebugTestContext.cleanUp( | ||
appName, | ||
projectPath, | ||
false, | ||
true, | ||
false | ||
); | ||
}); | ||
|
||
it( | ||
"[auto] [Typescript] Remote debug for API Message Extension with Microsoft Entra auth", | ||
{ | ||
testPlanCaseId: 28665924, | ||
author: "v-annefu@microsoft.com", | ||
}, | ||
async function () { | ||
const driver = VSBrowser.instance.driver; | ||
await createNewProject("msgmicroentra", appName, { lang: "TypeScript" }); | ||
await provisionProject(appName, projectPath); | ||
await deployProject(projectPath, Timeout.botDeploy); | ||
const teamsAppId = await remoteDebugTestContext.getTeamsAppId( | ||
projectPath | ||
); | ||
const page = await initNoAddappPage( | ||
remoteDebugTestContext.context!, | ||
teamsAppId, | ||
Env.username, | ||
Env.password | ||
); | ||
await validateApiMeResult(page, remoteDebugTestContext.appName); | ||
} | ||
); | ||
}); |
86 changes: 86 additions & 0 deletions
86
...ages/tests/src/ui-test/remotedebug/remotedebug-msg-newapi-microsoftentra-win-only.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
/** | ||
* @author Anne Fu <v-annefu@microsoft.com> | ||
*/ | ||
import * as path from "path"; | ||
import { VSBrowser } from "vscode-extension-tester"; | ||
import { Timeout } from "../../utils/constants"; | ||
import { | ||
RemoteDebugTestContext, | ||
provisionProject, | ||
deployProject, | ||
} from "./remotedebugContext"; | ||
import { | ||
execCommandIfExist, | ||
createNewProject, | ||
} from "../../utils/vscodeOperation"; | ||
import { it } from "../../utils/it"; | ||
import { | ||
initNoAddappPage, | ||
validateApiMeResult, | ||
} from "../../utils/playwrightOperation"; | ||
import { Env } from "../../utils/env"; | ||
|
||
describe("Remote debug Tests", function () { | ||
this.timeout(Timeout.testAzureCase); | ||
let remoteDebugTestContext: RemoteDebugTestContext; | ||
let testRootFolder: string; | ||
let appName: string; | ||
const appNameCopySuffix = "copy"; | ||
let newAppFolderName: string; | ||
let projectPath: string; | ||
|
||
beforeEach(async function () { | ||
// ensure workbench is ready | ||
this.timeout(Timeout.prepareTestCase); | ||
remoteDebugTestContext = new RemoteDebugTestContext("msgmicroentra"); | ||
testRootFolder = remoteDebugTestContext.testRootFolder; | ||
appName = remoteDebugTestContext.appName; | ||
newAppFolderName = appName + appNameCopySuffix; | ||
projectPath = path.resolve(testRootFolder, newAppFolderName); | ||
await remoteDebugTestContext.before(); | ||
}); | ||
|
||
afterEach(async function () { | ||
this.timeout(Timeout.finishAzureTestCase); | ||
await remoteDebugTestContext.after(); | ||
|
||
//Close the folder and cleanup local sample project | ||
|
||
await execCommandIfExist("Workspaces: Close Workspace", Timeout.webView); | ||
console.log(`[Successfully] start to clean up for ${projectPath}`); | ||
await remoteDebugTestContext.cleanUp( | ||
appName, | ||
projectPath, | ||
false, | ||
true, | ||
false | ||
); | ||
}); | ||
|
||
it( | ||
"[auto] [Javascript] Remote debug for API Message Extension with Microsoft Entra auth", | ||
{ | ||
testPlanCaseId: 28665898, | ||
author: "v-annefu@microsoft.com", | ||
}, | ||
async function () { | ||
const driver = VSBrowser.instance.driver; | ||
await createNewProject("msgmicroentra", appName); | ||
await provisionProject(appName, projectPath); | ||
await deployProject(projectPath, Timeout.botDeploy); | ||
const teamsAppId = await remoteDebugTestContext.getTeamsAppId( | ||
projectPath | ||
); | ||
const page = await initNoAddappPage( | ||
remoteDebugTestContext.context!, | ||
teamsAppId, | ||
Env.username, | ||
Env.password | ||
); | ||
await validateApiMeResult(page, remoteDebugTestContext.appName); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters