Skip to content

Commit 1d492ce

Browse files
authored
test: update terminal task information for basic bot project (#14503)
* test: update terminal task information for basic bot project * test: output terminal logs if having failure
1 parent d946dea commit 1d492ce

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

packages/tests/src/ui-test/localdebug/localdebug-bot-twice.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe("Local Debug Tests", function () {
5858
try {
5959
await waitForTerminal(
6060
LocalDebugTaskLabel.StartBotApp,
61-
LocalDebugTaskInfo.StartBotInfo
61+
LocalDebugTaskInfo.ServerListening
6262
);
6363
await stopDebugging();
6464
await driver.sleep(Timeout.stopdebugging);
@@ -72,14 +72,14 @@ describe("Local Debug Tests", function () {
7272
await waitForTerminal(LocalDebugTaskLabel.StartLocalTunnel);
7373
await waitForTerminal(
7474
LocalDebugTaskLabel.StartBotApp,
75-
LocalDebugTaskInfo.StartBotInfo
75+
LocalDebugTaskInfo.ServerListening
7676
);
7777

7878
// check if there is error "Could not attach to main target"
7979
await driver.sleep(Timeout.startdebugging);
8080
await waitForTerminal(
8181
LocalDebugTaskLabel.StartBotApp,
82-
LocalDebugTaskInfo.StartBotInfo
82+
LocalDebugTaskInfo.ServerListening
8383
);
8484
} catch {
8585
const dialog = new ModalDialog();
@@ -101,14 +101,14 @@ describe("Local Debug Tests", function () {
101101
try {
102102
await waitForTerminal(
103103
LocalDebugTaskLabel.StartBotApp,
104-
LocalDebugTaskInfo.StartBotInfo
104+
LocalDebugTaskInfo.ServerListening
105105
);
106106

107107
// check if there is error "Debug Anyway"
108108
await driver.sleep(Timeout.startdebugging);
109109
await waitForTerminal(
110110
LocalDebugTaskLabel.StartBotApp,
111-
LocalDebugTaskInfo.StartBotInfo
111+
LocalDebugTaskInfo.ServerListening
112112
);
113113
} catch {
114114
const dialog = new ModalDialog();
@@ -118,7 +118,7 @@ describe("Local Debug Tests", function () {
118118
await driver.sleep(Timeout.shortTimeLoading);
119119
await waitForTerminal(
120120
LocalDebugTaskLabel.StartBotApp,
121-
LocalDebugTaskInfo.StartBotInfo
121+
LocalDebugTaskInfo.ServerListening
122122
);
123123
}
124124
}

packages/tests/src/ui-test/templates/basic-bot-ts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("Local Debug Tests", function () {
7575
await waitForTerminal(LocalDebugTaskLabel.StartLocalTunnel);
7676
await waitForTerminal(
7777
LocalDebugTaskLabel.StartBotApp,
78-
LocalDebugTaskInfo.StartBotInfo
78+
LocalDebugTaskInfo.ServerListening
7979
);
8080

8181
const teamsAppId = await localDebugTestContext.getTeamsAppId();

packages/tests/src/ui-test/templates/basic-bot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe("Local Debug Tests", function () {
7171
await waitForTerminal(LocalDebugTaskLabel.StartLocalTunnel);
7272
await waitForTerminal(
7373
LocalDebugTaskLabel.StartBotApp,
74-
LocalDebugTaskInfo.StartBotInfo
74+
LocalDebugTaskInfo.ServerListening
7575
);
7676

7777
const teamsAppId = await localDebugTestContext.getTeamsAppId();

packages/tests/src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ export class LocalDebugTaskInfo {
477477
static readonly StartBotInfo = "Bot Started";
478478
static readonly StartBotInfo2 = "Bot started";
479479
static readonly AppListening = "app listening";
480+
static readonly ServerListening = "Server listening";
480481
static readonly BackendStartedInfo = "Worker process started and initialized";
481482
static readonly NoError = "Found 0 errors";
482483
}

packages/tests/src/utils/vscodeOperation.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ export async function findWordFromTerminal(word: string): Promise<boolean> {
14391439
await VSBrowser.instance.takeScreenshot(
14401440
getScreenshotName("debug failed")
14411441
);
1442+
await showTerminalLogs();
14421443
assert.fail("[failed] error message found !!!");
14431444
}
14441445
// verify success message
@@ -1498,14 +1499,25 @@ export async function addSpfxWebPart(webPartName = "helloworld") {
14981499
);
14991500
}
15001501

1502+
export async function showTerminalLogs(): Promise<void> {
1503+
try {
1504+
const bottomBarPanel = new BottomBarPanel();
1505+
const terminalView = await new TerminalView(bottomBarPanel).wait();
1506+
const terminalLogs = await terminalView.getText();
1507+
console.log("Terminal Logs: " + terminalLogs);
1508+
} catch {
1509+
console.log("Can't get terminal logs");
1510+
}
1511+
}
1512+
15011513
export async function getOutputLogs(): Promise<string | undefined> {
15021514
const driver = VSBrowser.instance.driver;
15031515
console.log("openTerminalView");
15041516
await openTerminalView();
15051517
console.log("openOutputView");
15061518
const pannel = new BottomBarPanel();
15071519
const output = await pannel.openOutputView();
1508-
console.log("Teams Toolkit");
1520+
console.log("Microsoft 365 Agents Toolkit");
15091521
try {
15101522
const maximize = await pannel.findElement(
15111523
By.css("a.action-label.codicon.codicon-panel-maximize")
@@ -1516,8 +1528,8 @@ export async function getOutputLogs(): Promise<string | undefined> {
15161528
console.log("already maximized");
15171529
}
15181530
try {
1519-
// This api is not work on macos, it will throw: Error: Channel Teams Toolkit not found
1520-
await output.selectChannel("Teams Toolkit");
1531+
// This api is not work on macos, it will throw: Error: Channel Microsoft 365 Agents Toolkit not found
1532+
await output.selectChannel("Microsoft 365 Agents Toolkit");
15211533
// Get output
15221534
console.log("Get output");
15231535
const text = await output.getText();

0 commit comments

Comments
 (0)