Skip to content

Commit 5b0c890

Browse files
authored
Clean up unused options in quick debugging action list (#2415)
1 parent 103fbb0 commit 5b0c890

10 files changed

Lines changed: 166 additions & 126 deletions

File tree

.vscode/launch.json

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,27 @@
66
"type": "extensionHost",
77
"request": "launch",
88
"runtimeExecutable": "${execPath}",
9-
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
9+
"args": [
10+
"--extensionDevelopmentPath=${workspaceRoot}"
11+
],
1012
"sourceMaps": true,
11-
"outFiles": ["${workspaceRoot}/src/**/*.js"],
13+
"outFiles": [
14+
"${workspaceRoot}/src/**/*.js"
15+
],
1216
"preLaunchTask": "gulp: build"
1317
},
1418
{
1519
"name": "Quick Launch Extension",
1620
"type": "extensionHost",
1721
"request": "launch",
1822
"runtimeExecutable": "${execPath}",
19-
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
23+
"args": [
24+
"--extensionDevelopmentPath=${workspaceRoot}"
25+
],
2026
"sourceMaps": true,
21-
"outFiles": ["${workspaceRoot}/src/**/*.js"]
27+
"outFiles": [
28+
"${workspaceRoot}/src/**/*.js"
29+
]
2230
},
2331
{
2432
"name": "Launch Extension tests",
@@ -31,7 +39,9 @@
3139
"--extensionTestsPath=${workspaceRoot}/test"
3240
],
3341
"sourceMaps": true,
34-
"outFiles": ["${workspaceRoot}/src/**/*.js"],
42+
"outFiles": [
43+
"${workspaceRoot}/src/**/*.js"
44+
],
3545
"preLaunchTask": "gulp: build"
3646
},
3747
{
@@ -45,21 +55,29 @@
4555
"--extensionTestsPath=${workspaceRoot}/test/localization"
4656
],
4757
"sourceMaps": true,
48-
"outFiles": ["${workspaceRoot}/src/**/*.js"],
58+
"outFiles": [
59+
"${workspaceRoot}/src/**/*.js"
60+
],
4961
"preLaunchTask": "gulp: build"
5062
},
5163
{
52-
"name": "Launch All Smoke Tests",
64+
"name": "Launch Smoke Tests",
5365
"type": "node",
5466
"request": "launch",
5567
"program": "${workspaceFolder}/test/smoke/node_modules/mocha/bin/_mocha",
5668
"cwd": "${workspaceFolder}/test/smoke",
57-
"args": ["--dont-delete-vsix"],
69+
"args": [
70+
"--config ./.mocharc.js ",
71+
"--reporter mocha-multi-reporters"
72+
],
5873
"timeout": 240000,
5974
"stopOnEntry": false,
60-
"outFiles": ["${workspaceRoot}/src/**/*.js"],
61-
"sourceMaps": true
75+
"outFiles": [
76+
"${workspaceFolder}/test/smoke/out/**/*.js"
77+
],
78+
"sourceMaps": true,
79+
"preLaunchTask": "npm: compile-smoke-tests"
6280
}
6381
],
6482
"compounds": []
65-
}
83+
}

.vscode/tasks.json

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,20 @@
11
{
22
"version": "2.0.0",
33
"tasks": [
4-
{
5-
"label": "prepare-smoke-tests",
6-
"type": "process",
7-
"command": [
8-
"yarn"
9-
],
10-
"windows": {
11-
"command": "yarn.cmd"
12-
},
13-
"args": [
14-
"prepare-smoke-tests"
15-
],
16-
"presentation": {
17-
"echo": true,
18-
"reveal": "silent",
19-
"focus": false,
20-
"panel": "shared",
21-
"showReuseMessage": false,
22-
"clear": false
23-
}
24-
},
25-
{
26-
"label": "compile-smoke-tests",
27-
"type": "process",
28-
"command": [
29-
"./node_modules/.bin/tsc"
30-
],
31-
"windows": {
32-
"command": ".\\node_modules\\.bin\\tsc.cmd"
33-
},
34-
"options": {
35-
"cwd": "${workspaceRoot}/test/smoke/vscode/test/smoke"
36-
},
37-
"presentation": {
38-
"echo": true,
39-
"reveal": "silent",
40-
"focus": false,
41-
"panel": "shared",
42-
"showReuseMessage": false,
43-
"clear": false
44-
}
45-
},
46-
{
47-
"label": "Prepare Smoke Tests",
48-
"dependsOn": [
49-
"prepare-smoke-tests"
50-
]
51-
},
52-
{
53-
"label": "Build Smoke Tests",
54-
"dependsOn": [
55-
"compile-smoke-tests"
56-
]
57-
},
584
{
595
"type": "npm",
606
"script": "build",
617
"group": "build",
628
"problemMatcher": [],
639
"label": "gulp: build",
6410
"detail": "gulp build"
11+
},
12+
{
13+
"label": "npm: compile-smoke-tests",
14+
"type": "shell",
15+
"command": "npm run compile-smoke-tests",
16+
"group": "build",
17+
"problemMatcher": []
6518
}
6619
]
67-
}
20+
}

package.json

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -485,34 +485,6 @@
485485
"command": "reactNative.debugScenario.attachHermesApplication",
486486
"when": "isRNProject && isRNHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
487487
},
488-
{
489-
"command": "reactNative.debugScenario.attachDirectIosExperimental",
490-
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
491-
},
492-
{
493-
"command": "reactNative.debugScenario.attachToPackager",
494-
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
495-
},
496-
{
497-
"command": "reactNative.debugScenario.debugAndroid",
498-
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
499-
},
500-
{
501-
"command": "reactNative.debugScenario.debugIos",
502-
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
503-
},
504-
{
505-
"command": "reactNative.debugScenario.debugWindows",
506-
"when": "isRNProject && isRNWindowsProject && config.react-native-tools.displayDebuggingCommandsButton"
507-
},
508-
{
509-
"command": "reactNative.debugScenario.debugMacos",
510-
"when": "isRNProject && isRNMacOSProject && config.react-native-tools.displayDebuggingCommandsButton"
511-
},
512-
{
513-
"command": "reactNative.debugScenario.debugInExponent",
514-
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
515-
},
516488
{
517489
"command": "reactNative.debugScenario.debugInHermesExponent",
518490
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
@@ -523,42 +495,26 @@
523495
},
524496
{
525497
"command": "reactNative.debugScenario.debugAndroidHermes",
526-
"when": "isRNProject && isRNAndroidHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
527-
},
528-
{
529-
"command": "reactNative.debugScenario.debugDirectIosExperimental",
530498
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
531499
},
532500
{
533501
"command": "reactNative.debugScenario.debugIosHermes",
534-
"when": "isRNProject && isRNIosHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
502+
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
535503
},
536504
{
537505
"command": "reactNative.debugScenario.debugMacosHermes",
538-
"when": "isRNProject && isRNMacosHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
539-
},
540-
{
541-
"command": "reactNative.debugScenario.debugWindowsHermes",
542-
"when": "isRNProject && isRNWindowsHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
543-
},
544-
{
545-
"command": "reactNative.debugScenario.runAndroid",
546506
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
547507
},
548508
{
549-
"command": "reactNative.debugScenario.runIos",
509+
"command": "reactNative.debugScenario.debugWindowsHermes",
550510
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
551511
},
552512
{
553513
"command": "reactNative.debugScenario.runAndroidHermes",
554-
"when": "isRNProject && isRNAndroidHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
514+
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
555515
},
556516
{
557517
"command": "reactNative.debugScenario.runIosHermes",
558-
"when": "isRNProject && isRNIosHermesProject && config.react-native-tools.displayDebuggingCommandsButton"
559-
},
560-
{
561-
"command": "reactNative.debugScenario.runDirectIosExperimental",
562518
"when": "isRNProject && config.react-native-tools.displayDebuggingCommandsButton"
563519
}
564520
],
@@ -1419,6 +1375,7 @@
14191375
"prepare": "husky install",
14201376
"prepare-smoke-tests": "cd test/smoke && npm ci",
14211377
"prepare-smoke-tests-project": "cd test/smoke/resources/sampleReactNativeProject && npm install",
1378+
"compile-smoke-tests": "cd test/smoke && tsc",
14221379
"smoke-tests": "cd test/smoke && tsc && node ./node_modules/mocha/bin/_mocha --config ./.mocharc.js --reporter mocha-multi-reporters"
14231380
},
14241381
"prettier": {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 { ElementHelper } from "./helper/elementHelper";
8+
import { Element } from "./helper/constants";
9+
import { WaitHelper } from "./helper/waitHelper";
10+
import { ComponentHelper } from "./helper/componentHelper";
11+
import * as assert from "assert";
12+
13+
export function startActionBarTests(): void {
14+
describe("ActionBarTest", () => {
15+
async function initApp(): Promise<Page> {
16+
await app.launch();
17+
return app.getMainPage();
18+
}
19+
20+
async function dispose() {
21+
if (this.currentTest?.state === "failed") {
22+
SmokeTestLogger.info("Test failed, taking screenshot ...");
23+
await screenshots.takeScreenshots(
24+
this.currentTest.parent?.title || "Others",
25+
this.currentTest.title.replace(/\s+/g, "_"),
26+
);
27+
}
28+
try {
29+
SmokeTestLogger.info(`Dispose test: "${this.currentTest.title}" ...`);
30+
if (app) {
31+
await app.close();
32+
}
33+
} catch (error) {
34+
SmokeTestLogger.error(`Error while dispose: ${error}`);
35+
}
36+
}
37+
38+
afterEach(dispose);
39+
40+
it("Verify extension quick debug action button is working correctly", async () => {
41+
await initApp();
42+
43+
const debugActionItemDropdown = await ElementHelper.TryFindElement(
44+
`[aria-label="${Element.debugActionItemDropdownAriaLable}"]`,
45+
);
46+
assert.notStrictEqual(debugActionItemDropdown, null);
47+
48+
const actionButton = await ElementHelper.WaitElementSelectorVisible(
49+
Element.debugActionItemButtonSelector,
50+
);
51+
actionButton.click();
52+
53+
await WaitHelper.waitIsTrue(async () => {
54+
const packager = await ComponentHelper.getReactNativePackager();
55+
const currentState = await packager.getAttribute("aria-label");
56+
try {
57+
assert.ok(currentState?.includes("primitive-square"));
58+
return true;
59+
} catch {
60+
return false;
61+
}
62+
});
63+
});
64+
});
65+
}

test/smoke/suites/activation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export function startExtensionActivationTests(): void {
4444
`[id="${Constant.previewExtensionId}"]`,
4545
2000,
4646
);
47-
SmokeTestLogger.info("React-native-preview extension is activated");
47+
SmokeTestLogger.info("React-native preview extension is activated");
4848
isActivited = true;
4949
} catch {
5050
try {
5151
await ElementHelper.WaitElementSelectorVisible(
5252
`[id="${Constant.prodExtensionId}"]`,
5353
2000,
5454
);
55-
SmokeTestLogger.info("React-native-prod extension is activated");
55+
SmokeTestLogger.info("React-native prod extension is activated");
5656
isActivited = true;
5757
} catch {
5858
isActivited = false;

test/smoke/suites/helper/componentHelper.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Constant, Element } from "./constants";
55
import { SmokeTestLogger } from "./smokeTestLogger";
66

77
export class ComponentHelper {
8-
static setPage(): Page {
8+
static Page(): Page {
99
const application = app;
1010
return application.getMainPage();
1111
}
@@ -35,10 +35,7 @@ export class ComponentHelper {
3535
fileName: string,
3636
): Promise<ElementHandle<SVGElement | HTMLElement> | null> {
3737
try {
38-
return await ElementHelper.WaitElementSelectorVisible(
39-
`[aria-label="${fileName}"]`,
40-
2000,
41-
);
38+
return await ElementHelper.WaitElementAriaLabelVisible(fileName, 2000);
4239
} catch {
4340
return null;
4441
}

test/smoke/suites/helper/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ export class Element {
99
public static commandPaletteFocusedItemSelector = "#quickInput_list .monaco-list-row.focused";
1010
public static fileExplorerIconSelector = ".action-label.codicon.codicon-explorer-view-icon";
1111
public static fileExplorerViewId = "workbench.view.explorer";
12+
public static debugActionItemDropdownAriaLable = "Run or Debug...";
13+
public static debugActionItemButtonSelector = ".action-label.codicon.codicon-debug-alt";
1214
}

0 commit comments

Comments
 (0)