Skip to content

Commit bdae667

Browse files
ConnorQi01ConnorQi
andauthored
Verify extension debugger is visible in select debugger list (#2419)
Co-authored-by: Connor Qi (BEYONDSOFT CONSULTING INC) <v-peq@microsoft.com>
1 parent 68ee820 commit bdae667

5 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for details.
3+
4+
import { Page } from "playwright";
5+
import { SmokeTestLogger } from "./helper/smokeTestLogger";
6+
import { app, screenshots } from "./main";
7+
import * as assert from "assert";
8+
import { ElementHelper } from "./helper/elementHelper";
9+
import { Element } from "./helper/constants";
10+
import { ComponentHelper } from "./helper/componentHelper";
11+
12+
export function startDebugConfigurationTests(): void {
13+
describe("DebugConfigurationTest", () => {
14+
async function initApp(): Promise<Page> {
15+
await app.launch();
16+
return app.getMainPage();
17+
}
18+
19+
async function dispose() {
20+
if (this.currentTest?.state === "failed") {
21+
SmokeTestLogger.info("Test failed, taking screenshot ...");
22+
await screenshots.takeScreenshots(
23+
this.currentTest.parent?.title || "Others",
24+
this.currentTest.title.replace(/\s+/g, "_"),
25+
);
26+
}
27+
try {
28+
SmokeTestLogger.info(`Dispose test: "${this.currentTest.title}" ...`);
29+
if (app) {
30+
await app.close();
31+
}
32+
} catch (error) {
33+
SmokeTestLogger.error(`Error while dispose: ${error}`);
34+
}
35+
}
36+
37+
afterEach(dispose);
38+
39+
it("Verify extension debugger is visible in select debugger list", async () => {
40+
const createLaunchFile = "create a launch.json file";
41+
const rnOptionText = "More React Native options...";
42+
43+
await initApp();
44+
45+
await ComponentHelper.openRunAndDebugTab();
46+
await ElementHelper.WaitElementClassNameVisible(Element.welcomeViewClassName);
47+
await ElementHelper.clickElementByText(createLaunchFile);
48+
49+
const rnOption = await ElementHelper.TryFindElement(
50+
`[aria-label="${rnOptionText}"]`,
51+
2000,
52+
);
53+
assert.notStrictEqual(rnOption, null);
54+
});
55+
});
56+
}

test/smoke/suites/helper/componentHelper.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export class ComponentHelper {
3131
}
3232
}
3333

34+
public static async openRunAndDebugTab() {
35+
const debugIcon = await ElementHelper.WaitElementClassNameVisible(
36+
Element.runAndDebugTabButtonClassName,
37+
);
38+
await debugIcon.click();
39+
}
40+
3441
public static async WaitFileVisibleInFileExplorer(
3542
fileName: string,
3643
): Promise<ElementHandle<SVGElement | HTMLElement> | null> {

test/smoke/suites/helper/constants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ export class Element {
1111
public static fileExplorerViewId = "workbench.view.explorer";
1212
public static debugActionItemDropdownAriaLable = "Run or Debug...";
1313
public static debugActionItemButtonSelector = ".action-label.codicon.codicon-debug-alt";
14+
public static runAndDebugTabButtonClassName = "codicon-run-view-icon";
15+
public static createLaunchConfigFileLinkClassName = "monaco-link";
16+
public static welcomeViewClassName = "welcome-view-content";
17+
public static vscodeMonacoButtonClassName = "monaco-button";
1418
}

test/smoke/suites/helper/elementHelper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export class ElementHelper {
2727
}
2828
}
2929

30+
public static async clickElementByText(text: string) {
31+
await this.Page().click(`text=${text}`);
32+
}
33+
3034
public static async WaitElementClassNameVisible(
3135
className: string,
3236
timeout: number = 1000,

test/smoke/suites/smoke.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { startActionBarTests } from "./actionBar.test";
55
import { startExtensionActivationTests } from "./activation.test";
66
import { startCommandPaletteTests } from "./commands.test";
7+
import { startDebugConfigurationTests } from "./debugConfiguration.test";
78
import { startFileExplorerTests } from "./fileExplorer.test";
89
import { SmokeTestLogger } from "./helper/smokeTestLogger";
910
import { smokeTestFail } from "./helper/utilities";
@@ -32,5 +33,6 @@ export function startSmokeTests(setup: () => Promise<void>, cleanUp: () => Promi
3233
startFileExplorerTests();
3334
startPackagerTests();
3435
startActionBarTests();
36+
startDebugConfigurationTests();
3537
});
3638
}

0 commit comments

Comments
 (0)