Skip to content

Commit 94e8327

Browse files
committed
Add smoke test for CDP Node version compatibility feature
1 parent fc844dc commit 94e8327

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 { ComponentHelper } from "./helper/componentHelper";
9+
import { ElementHelper } from "./helper/elementHelper";
10+
import { Element } from "./helper/constants";
11+
12+
export function startCDPNodeVersionCompatibilityTests(): void {
13+
describe("CDPNodeVersionCompatibilityTest", () => {
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 Run and Debug tab is accessible for debugging operations", async () => {
40+
await initApp();
41+
42+
await ComponentHelper.openRunAndDebugTab();
43+
await ElementHelper.WaitElementClassNameVisible(
44+
Element.runAndDebugTabButtonClassName,
45+
5000,
46+
);
47+
48+
SmokeTestLogger.info("Run and Debug tab is accessible");
49+
});
50+
51+
it("Verify command palette can access debug-related commands", async () => {
52+
await initApp();
53+
54+
await ComponentHelper.openCommandPalette();
55+
await ElementHelper.WaitElementClassNameVisible(Element.commandPaletteClassName, 5000);
56+
57+
await ElementHelper.inputText("debug");
58+
const option = await ElementHelper.WaitElementSelectorVisible(
59+
Element.commandPaletteFocusedItemSelector,
60+
5000,
61+
);
62+
63+
const value = await option.getAttribute("aria-label");
64+
assert.ok(value?.toLowerCase().includes("debug"));
65+
SmokeTestLogger.info("Debug commands are available in command palette");
66+
});
67+
68+
it("Verify React Native packager is available for debugging", async () => {
69+
await initApp();
70+
71+
await ComponentHelper.getReactNativePackager();
72+
SmokeTestLogger.info("React Native packager is available for debugging");
73+
});
74+
});
75+
}

test/smoke/suites/smoke.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { startExtensionActivationTests } from "./activation.test";
66
import { startCommandPaletteTests } from "./commands.test";
77
import { startDebugConfigurationTests } from "./debugConfiguration.test";
88
import { startFileExplorerTests } from "./fileExplorer.test";
9+
import { startCDPNodeVersionCompatibilityTests } from "./cdpNodeVersionCompatibility.test";
910
import { SmokeTestLogger } from "./helper/smokeTestLogger";
1011
import { smokeTestFail } from "./helper/utilities";
1112
import { startPackagerTests } from "./packager.test";
@@ -42,6 +43,7 @@ export function startSmokeTests(setup: () => Promise<void>, cleanUp: () => Promi
4243
startPackagerTests();
4344
startActionBarTests();
4445
startDebugConfigurationTests();
46+
startCDPNodeVersionCompatibilityTests();
4547
startVsixExistenceTest();
4648
});
4749
}

0 commit comments

Comments
 (0)