Skip to content

Commit eba22ee

Browse files
committed
pretty much good
1 parent 277da03 commit eba22ee

3 files changed

Lines changed: 31 additions & 232 deletions

File tree

package.json

Lines changed: 0 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -112,152 +112,6 @@
112112
]
113113
}
114114
]
115-
},
116-
{
117-
"id": "generate",
118-
"title": "Generate tests with Self-Driving mode",
119-
"description": "Automatically generate multiple tests by asking TestDriver to explore your app.",
120-
"steps": [
121-
{
122-
"id": "terminal",
123-
"title": "Open a Terminal",
124-
"description": "Open a terminal window to use the TestDriver CLI\n[Open Terminal](command:workbench.action.terminal.new)",
125-
"media": {
126-
"image": "media/change.png",
127-
"altText": "TestDriver Change"
128-
},
129-
"completionEvents": [
130-
"onCommand:workbench.action.terminal.new"
131-
]
132-
},
133-
{
134-
"id": "interactive",
135-
"title": "Run TestDriver CLI",
136-
"description": "Run the TestDriver cli in your terminal by typing `testdriverai` and pressing enter.\n[Run TestDriver CLI](command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22testdriverai%20%5Cn%22%7D)",
137-
"media": {
138-
"image": "media/change.png",
139-
"altText": "TestDriver Change"
140-
},
141-
"completionEvents": [
142-
"onCommand:workbench.action.terminal.sendSequence"
143-
]
144-
},
145-
{
146-
"id": "web",
147-
"title": "Run TestDriver Generate",
148-
"description": "Run the TestDriver web test by typing `/generate web 5` in the terminal. TestDriver will create new test prompts in `testdriver/generate` folder.\n[Run /generate Command](command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22%2Fgenerate%20web%205%5Cn%22%7D)",
149-
"media": {
150-
"image": "media/change.png",
151-
"altText": "TestDriver Change"
152-
},
153-
"completionEvents": [
154-
"onCommand:workbench.action.terminal.sendSequence"
155-
]
156-
},
157-
{
158-
"id": "run",
159-
"title": "Run the generated tests",
160-
"description": "TestDriver will use the prompts in the test file to complete the regression test.\n[Run All Tests](command:testing.runAll)",
161-
"media": {
162-
"image": "media/change.png",
163-
"altText": "TestDriver Change"
164-
},
165-
"completionEvents": [
166-
"onCommand:testing.runAll"
167-
]
168-
},
169-
{
170-
"id": "go",
171-
"title": "Deploy your tests!",
172-
"description": "Follow the deployment walkthrough to deploy your new tests to GitHub actions!.\n[Start Walkthrough](command:testdriver.walkthroughDeploy)",
173-
"media": {
174-
"image": "media/change.png",
175-
"altText": "TestDriver Change"
176-
},
177-
"completionEvents": [
178-
"onCommand:testdriver.walkthroughDeploy"
179-
]
180-
}
181-
]
182-
},
183-
{
184-
"id": "deploy",
185-
"title": "Deploy to GitHub Actions",
186-
"description": "Learn how to run your tests within GitHub actions.",
187-
"steps": [
188-
{
189-
"id": "branch",
190-
"title": "Create a new branch",
191-
"description": "Use `git checkout -b testdriver` to make a new branch.\n[Create Branch](command:git.branch)",
192-
"media": {
193-
"image": "media/github.png",
194-
"altText": "TestDriver GitHub"
195-
},
196-
"completionEvents": [
197-
"onCommand:git.branch"
198-
]
199-
},
200-
{
201-
"id": "stage",
202-
"title": "Stage your changes",
203-
"description": "Stage your changes with `git add .`.\n[Stage All Changes](command:git.stageAll)",
204-
"media": {
205-
"image": "media/github.png",
206-
"altText": "TestDriver GitHub"
207-
},
208-
"completionEvents": [
209-
"onCommand:git.stageAll"
210-
]
211-
},
212-
{
213-
"id": "commit",
214-
"title": "Commit your changes",
215-
"description": "Commit your changes with `git commit -m 'your message'`.\n[Commit Changes](command:git.commit)",
216-
"media": {
217-
"image": "media/github.png",
218-
"altText": "TestDriver GitHub"
219-
},
220-
"completionEvents": [
221-
"onCommand:git.commit"
222-
]
223-
},
224-
{
225-
"id": "secrets",
226-
"title": "Sync .env with GitHub secrets",
227-
"description": "Run the `upload-secrets` command to set your API Key and Website URL in GitHub secrets.\n[Run Secret Sync](command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22testdriverai%20upload-secrets%5Cn%22%7D)",
228-
"media": {
229-
"image": "media/github.png",
230-
"altText": "TestDriver GitHub"
231-
},
232-
"completionEvents": [
233-
"onCommand:git.branch"
234-
]
235-
},
236-
{
237-
"id": "push",
238-
"title": "Push your changes",
239-
"description": "Type `git push` in terminal to upload your new test files.\n[Push Changes](command:git.push)",
240-
"media": {
241-
"image": "media/github.png",
242-
"altText": "TestDriver GitHub"
243-
},
244-
"completionEvents": [
245-
"onCommand:git.push"
246-
]
247-
},
248-
{
249-
"id": "docs",
250-
"title": "Watch your test runs!",
251-
"description": "Your test will now run everyday and on new pull requests.\n[Learn More](command:testdriver.openDocsAtCI)",
252-
"media": {
253-
"image": "media/github.png",
254-
"altText": "TestDriver GitHub"
255-
},
256-
"completionEvents": [
257-
"onCommand:workbench.action.openUrl"
258-
]
259-
}
260-
]
261115
}
262116
],
263117
"chatParticipants": [
@@ -299,23 +153,6 @@
299153
]
300154
}
301155
],
302-
"languageModelTools": [{
303-
"name": "testdriver",
304-
"icon": "media/icon.png",
305-
"canBeReferencedInPrompt": true,
306-
"toolReferenceName": "testdriver",
307-
"userDescription": "TestDriver is a tool that can generate and run tests for your application. You can use it to automate workflows, fill out forms, and more.",
308-
"modelDescription": "TestDriver is a tool that can generate and run tests for your application. You can use it to automate workflows, fill out forms, and more. It can also be used to generate test steps using screenshots.",
309-
"inputSchema": {
310-
"type": "object",
311-
"properties": {
312-
"paramName": {
313-
"type": "string",
314-
"description": "description"
315-
}
316-
}
317-
}
318-
}],
319156
"commands": [
320157
{
321158
"command": "testdriver.toggleAnalytics",
@@ -325,14 +162,6 @@
325162
"command": "testdriver.walkthrough",
326163
"title": "TestDriver: Start Setup Walkthrough"
327164
},
328-
{
329-
"command": "testdriver.walkthroughGenerate",
330-
"title": "TestDriver: Start Test Generation Walkthrough"
331-
},
332-
{
333-
"command": "testdriver.walkthroughDeploy",
334-
"title": "TestDriver: Start Deployment Walkthrough"
335-
},
336165
{
337166
"command": "testdriver.init",
338167
"title": "TestDriver: Run setup in the active workspace."

src/commands/index.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,6 @@ export const registerCommands = () => {
6868
false,
6969
);
7070
});
71-
vscode.commands.registerCommand('testdriver.walkthroughDeploy', () => {
72-
track({ event: 'walkthrough.deploy.started' });
73-
74-
vscode.commands.executeCommand(
75-
'workbench.action.openWalkthrough',
76-
'testdriverai.testdriver#deploy',
77-
false,
78-
);
79-
});
80-
vscode.commands.registerCommand('testdriver.walkthroughGenerate', () => {
81-
track({ event: 'walkthrough.generate.started' });
82-
83-
vscode.commands.executeCommand(
84-
'workbench.action.openWalkthrough',
85-
'testdriverai.testdriver#generate',
86-
false,
87-
);
88-
});
8971
vscode.commands.registerCommand('testdriver.openDocsAtCI', () => {
9072
track({ event: 'docs.ci' });
9173

src/tests.ts

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ const setupRunProfiles = (controller: vscode.TestController) => {
134134

135135
// Run all tests in parallel
136136
const testPromises = leafTests.map(async (test) => {
137-
138137
if (token.isCancellationRequested) {
139138
return;
140139
}
@@ -148,49 +147,38 @@ const setupRunProfiles = (controller: vscode.TestController) => {
148147
const abortController = new AbortController();
149148
token.onCancellationRequested(() => abortController.abort());
150149

151-
return new Promise<void>((resolve) => {
152-
try {
153-
const instance = new TDInstance(workspaceFolder.uri.fsPath, {
154-
focus: false,
155-
params: ['run', relativePath, '--new-sandbox'],
156-
});
157-
158-
instance.on('stdout', (data) => {
159-
run.appendOutput(data.replace(/(?<!\r)\n/g, '\r\n'), undefined, test);
160-
});
161-
instance.on('stderr', (data) => {
162-
run.appendOutput(data.replace(/(?<!\r)\n/g, '\r\n'), undefined, test);
163-
});
164-
instance.on('exit', (code) => {
165-
if (code !== 0) {
166-
run.failed(test, 'Test failed with exit code ' + code);
167-
track({
168-
event: 'test.item.failed',
169-
properties: { id: test.id, path: test.uri?.fsPath },
170-
});
171-
} else {
172-
run.passed(test);
173-
track({
174-
event: 'test.item.passed',
175-
properties: { id: test.id, path: test.uri?.fsPath },
176-
});
177-
}
178-
instance.destroy();
179-
resolve();
180-
});
181-
} catch (err: unknown) {
182-
const errorMessage = err instanceof Error ? err.message : String(err);
183-
logger.info(`Test error: ${errorMessage}`);
184-
run.failed(test, new vscode.TestMessage(errorMessage));
185-
track({
186-
event: 'test.item.failed',
187-
properties: { id: test.id, path: test.uri?.fsPath },
188-
});
189-
resolve();
190-
} finally {
191-
logger.info(`Test ${test.id} finished`);
192-
}
150+
const instance = new TDInstance(workspaceFolder.uri.fsPath, {
151+
focus: false,
152+
params: ['--new-sandbox']
153+
});
154+
155+
instance.on('stdout', (data) => {
156+
run.appendOutput(data.replace(/(?<!\r)\n/g, '\r\n'), undefined, test);
193157
});
158+
instance.on('stderr', (data) => {
159+
run.appendOutput(data.replace(/(?<!\r)\n/g, '\r\n'), undefined, test);
160+
});
161+
162+
try {
163+
await instance.run(`/run ${relativePath}`, {
164+
signal: abortController.signal,
165+
});
166+
run.passed(test);
167+
track({
168+
event: 'test.item.passed',
169+
properties: { id: test.id, path: test.uri?.fsPath },
170+
});
171+
} catch (err: unknown) {
172+
const errorMessage = err instanceof Error ? err.message : String(err);
173+
run.failed(test, new vscode.TestMessage(errorMessage));
174+
track({
175+
event: 'test.item.failed',
176+
properties: { id: test.id, path: test.uri?.fsPath },
177+
});
178+
} finally {
179+
instance.destroy();
180+
logger.info(`Test ${test.id} finished`);
181+
}
194182
});
195183

196184
// Wait for all tests to complete

0 commit comments

Comments
 (0)