Skip to content

Commit 0b27713

Browse files
committed
feat: support for Refresh Tests button in test explorer
1 parent 47bdf62 commit 0b27713

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

vscode-client/testcontrollermanager.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,23 @@ export class TestControllerManager {
9999
) {
100100
this.testController = vscode.tests.createTestController("robotCode.RobotFramework", "RobotFramework");
101101

102+
this.testController.resolveHandler = async (item) => {
103+
await this.refresh(item);
104+
};
105+
106+
this.testController.refreshHandler = async (token) => {
107+
await this.refreshWorkspace(undefined, undefined, token);
108+
};
109+
102110
this.runProfile = this.testController.createRunProfile(
103111
"Run",
104112
vscode.TestRunProfileKind.Run,
105113
async (request, token) => this.runTests(request, token),
106114
true
107115
);
108116

117+
this.runProfile.configureHandler = () => this.configureRunProfile();
118+
109119
this.dryRunProfile = this.testController.createRunProfile(
110120
"Dry Run",
111121
vscode.TestRunProfileKind.Run,
@@ -120,17 +130,15 @@ export class TestControllerManager {
120130
true
121131
);
122132

133+
this.debugProfile.configureHandler = () => this.configureRunProfile();
134+
123135
this.dryRunDebugProfile = this.testController.createRunProfile(
124136
"Dry Debug",
125137
vscode.TestRunProfileKind.Debug,
126138
async (request, token) => this.runTests(request, token, true),
127139
false
128140
);
129141

130-
this.testController.resolveHandler = async (item) => {
131-
await this.refresh(item);
132-
};
133-
134142
const fileWatcher = vscode.workspace.createFileSystemWatcher("**/*.{robot,resource}");
135143
fileWatcher.onDidCreate((uri) => this.refreshUri(uri, "create"));
136144
fileWatcher.onDidDelete((uri) => this.refreshUri(uri, "delete"));
@@ -221,6 +229,33 @@ export class TestControllerManager {
221229
);
222230
}
223231

232+
// eslint-disable-next-line class-methods-use-this
233+
private configureRunProfile() {
234+
vscode.window
235+
.showQuickPick(
236+
[
237+
{ label: "Chrome", picked: true, description: "Run Tests with Chrome browser" },
238+
{ label: "Firefox", picked: false, description: "Run Tests with Firefox browser" },
239+
{ label: "TestDB", picked: false, description: "Run Tests on Test Database" },
240+
{ label: "ProdDB", picked: false, description: "Run Tests on Production Database" },
241+
{ label: "NoHeadless", picked: false, description: "Do not run in headless mode" },
242+
],
243+
{
244+
title: "Select Execution Profile (Teaser: comming soon...)",
245+
canPickMany: true,
246+
}
247+
)
248+
.then(
249+
(result) => {
250+
vscode.window.showInformationMessage(`Selected: ${result?.map((v) => v.label).join(", ") || "<None>"}`).then(
251+
() => undefined,
252+
() => undefined
253+
);
254+
},
255+
() => undefined
256+
);
257+
}
258+
224259
private removeWorkspaceFolderItems(folder: vscode.WorkspaceFolder) {
225260
if (this.robotTestItems.has(folder)) {
226261
const robotItems = this.robotTestItems.get(folder)?.items;

0 commit comments

Comments
 (0)