Skip to content

Commit 514c360

Browse files
committed
Revert "Skip failing e2e tests temporarily"
This reverts commit 140fa2e.
1 parent 140fa2e commit 514c360

File tree

9 files changed

+51
-146
lines changed

9 files changed

+51
-146
lines changed

extensions/cli/src/hubLoader.test.ts

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,6 @@ vi.mock("jszip", () => ({
3232

3333
const mockedJSZip = vi.fn();
3434

35-
const TRANSIENT_HUB_ERROR = /HTTP 5\d{2}|network|ECONNRESET|ENETUNREACH/i;
36-
const RETRY_DELAY_MS = 1000;
37-
const MAX_RETRY_ATTEMPTS = 2;
38-
39-
async function loadHubResourceWithRetry<T>(
40-
loader: () => Promise<T>,
41-
retries = MAX_RETRY_ATTEMPTS,
42-
): Promise<T> {
43-
let lastError: unknown;
44-
45-
for (let attempt = 0; attempt <= retries; attempt++) {
46-
try {
47-
return await loader();
48-
} catch (error) {
49-
lastError = error;
50-
const message =
51-
typeof error === "string"
52-
? error
53-
: error instanceof Error
54-
? error.message
55-
: "";
56-
57-
if (!TRANSIENT_HUB_ERROR.test(message) || attempt === retries) {
58-
throw error;
59-
}
60-
61-
const backoff = RETRY_DELAY_MS * (attempt + 1);
62-
await new Promise((resolve) => setTimeout(resolve, backoff));
63-
}
64-
}
65-
66-
throw lastError;
67-
}
68-
6935
describe("hubLoader", () => {
7036
beforeEach(async () => {
7137
vi.clearAllMocks();
@@ -380,8 +346,9 @@ describe("hubLoader", () => {
380346
});
381347

382348
it("should load rule from real hub: sanity/sanity-opinionated", async () => {
383-
const result = await loadHubResourceWithRetry(() =>
384-
loadPackageFromHub("sanity/sanity-opinionated", ruleProcessor),
349+
const result = await loadPackageFromHub(
350+
"sanity/sanity-opinionated",
351+
ruleProcessor,
385352
);
386353

387354
expect(result).toBeDefined();
@@ -397,9 +364,7 @@ describe("hubLoader", () => {
397364
vi.unmock("jszip");
398365

399366
const testSlug = "upstash/context7-mcp";
400-
const result = await loadHubResourceWithRetry(() =>
401-
loadPackageFromHub(testSlug, mcpProcessor),
402-
);
367+
const result = await loadPackageFromHub(testSlug, mcpProcessor);
403368

404369
expect(result).toBeDefined();
405370
expect(typeof result).toBe("object");
@@ -417,9 +382,7 @@ describe("hubLoader", () => {
417382
vi.unmock("jszip");
418383

419384
const testSlug = "openai/gpt-5";
420-
const result = await loadHubResourceWithRetry(() =>
421-
loadPackageFromHub(testSlug, modelProcessor),
422-
);
385+
const result = await loadPackageFromHub(testSlug, modelProcessor);
423386

424387
expect(result).toBeDefined();
425388
expect(typeof result).toBe("object");
@@ -434,8 +397,9 @@ describe("hubLoader", () => {
434397
}, 30000);
435398

436399
it("should load prompt from real hub: launchdarkly/using-flags", async () => {
437-
const result = await loadHubResourceWithRetry(() =>
438-
loadPackageFromHub("launchdarkly/using-flags", promptProcessor),
400+
const result = await loadPackageFromHub(
401+
"launchdarkly/using-flags",
402+
promptProcessor,
439403
);
440404

441405
expect(result).toBeDefined();

extensions/cli/src/ui/__tests__/TUIChat.editMessage.test.tsx

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import { testBothModes, renderInMode } from "./TUIChat.dualModeHelper.js";
2-
import {
3-
waitForFrameToContain,
4-
waitForFrameToNotContain,
5-
} from "./TUIChat.testHelper.js";
62

73
/**
84
* Integration tests for the message edit feature in TUIChat
@@ -20,10 +16,9 @@ describe("TUIChat - Message Edit Feature", () => {
2016
const { lastFrame, stdin } = renderInMode(mode);
2117

2218
// Verify selector is not open initially
23-
let frame = await waitForFrameToNotContain(
24-
lastFrame,
25-
"No user messages to edit",
26-
);
19+
let frame = lastFrame();
20+
expect(frame).toBeDefined();
21+
expect(frame).not.toContain("No user messages to edit");
2722

2823
// Press Esc twice quickly (within 500ms)
2924
stdin.write("\u001b"); // First Esc
@@ -33,7 +28,9 @@ describe("TUIChat - Message Edit Feature", () => {
3328
await new Promise((resolve) => setTimeout(resolve, 100));
3429

3530
// Verify selector is now open
36-
frame = await waitForFrameToContain(lastFrame, "No user messages to edit");
31+
frame = lastFrame();
32+
expect(frame).toBeDefined();
33+
expect(frame).toContain("No user messages to edit");
3734
});
3835

3936
testBothModes("edit selector should handle navigation", async (mode) => {
@@ -45,10 +42,9 @@ describe("TUIChat - Message Edit Feature", () => {
4542
await new Promise((resolve) => setTimeout(resolve, 100));
4643

4744
// Verify selector is open
48-
let frame = await waitForFrameToContain(
49-
lastFrame,
50-
"No user messages to edit",
51-
);
45+
let frame = lastFrame();
46+
expect(frame).toBeDefined();
47+
expect(frame).toContain("No user messages to edit");
5248

5349
// Try navigation keys
5450
stdin.write("j"); // Down
@@ -58,7 +54,9 @@ describe("TUIChat - Message Edit Feature", () => {
5854
await new Promise((resolve) => setTimeout(resolve, 50));
5955

6056
// Verify selector is still open after navigation
61-
frame = await waitForFrameToContain(lastFrame, "No user messages to edit");
57+
frame = lastFrame();
58+
expect(frame).toBeDefined();
59+
expect(frame).toContain("No user messages to edit");
6260
});
6361

6462
testBothModes("edit selector should exit with Esc", async (mode) => {
@@ -70,20 +68,18 @@ describe("TUIChat - Message Edit Feature", () => {
7068
await new Promise((resolve) => setTimeout(resolve, 100));
7169

7270
// Verify edit selector is open
73-
let frame = await waitForFrameToContain(
74-
lastFrame,
75-
"No user messages to edit",
76-
);
71+
let frame = lastFrame();
72+
expect(frame).toBeDefined();
73+
expect(frame).toContain("No user messages to edit");
7774

7875
// Press Esc to exit
7976
stdin.write("\u001b");
8077
await new Promise((resolve) => setTimeout(resolve, 100));
8178

8279
// Verify edit selector is closed
83-
frame = await waitForFrameToNotContain(
84-
lastFrame,
85-
"No user messages to edit",
86-
);
80+
frame = lastFrame();
81+
expect(frame).toBeDefined();
82+
expect(frame).not.toContain("No user messages to edit");
8783
});
8884

8985
testBothModes("should handle edit flow without crashing", async (mode) => {
@@ -126,25 +122,22 @@ describe("TUIChat - Message Edit Feature", () => {
126122
await new Promise((resolve) => setTimeout(resolve, 100));
127123

128124
// Verify selector opened
129-
let frame = await waitForFrameToContain(
130-
lastFrame,
131-
"No user messages to edit",
132-
);
125+
let frame = lastFrame();
126+
expect(frame).toBeDefined();
127+
expect(frame).toContain("No user messages to edit");
133128

134129
stdin.write("k"); // Navigate (no-op with 0 messages)
135130
await new Promise((resolve) => setTimeout(resolve, 50));
136131

137132
stdin.write("\u001b"); // Close
138133
await new Promise((resolve) => setTimeout(resolve, 100));
139134

140-
frame = await waitForFrameToNotContain(
141-
lastFrame,
142-
"No user messages to edit",
143-
);
135+
frame = lastFrame();
144136

145137
// UI should remain stable and edit selector should be closed
146138
expect(frame).toBeDefined();
147139
expect(frame!.length).toBeGreaterThan(0);
140+
expect(frame).not.toContain("No user messages to edit");
148141
},
149142
);
150143
});
@@ -214,19 +207,17 @@ describe("TUIChat - Edit Feature Edge Cases", () => {
214207
await new Promise((resolve) => setTimeout(resolve, 600)); // Wait longer than 500ms threshold
215208

216209
// Verify selector did not open
217-
let frame = await waitForFrameToNotContain(
218-
lastFrame,
219-
"No user messages to edit",
220-
);
210+
let frame = lastFrame();
211+
expect(frame).toBeDefined();
212+
expect(frame).not.toContain("No user messages to edit");
221213

222214
stdin.write("\u001b"); // Another single Esc after timeout
223215
await new Promise((resolve) => setTimeout(resolve, 100));
224216

225217
// Verify selector still did not open
226-
frame = await waitForFrameToNotContain(
227-
lastFrame,
228-
"No user messages to edit",
229-
);
218+
frame = lastFrame();
219+
expect(frame).toBeDefined();
220+
expect(frame).not.toContain("No user messages to edit");
230221
});
231222

232223
testBothModes(

extensions/cli/src/ui/__tests__/TUIChat.fileSearch.test.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { renderInMode, testSingleMode } from "./TUIChat.dualModeHelper.js";
2-
import {
3-
waitForFrameToContain,
4-
waitForNextRender,
5-
} from "./TUIChat.testHelper.js";
2+
import { waitForNextRender } from "./TUIChat.testHelper.js";
63

74
describe("TUIChat - @ File Search Tests", () => {
85
testSingleMode("shows @ character when user types @", "local", async () => {
@@ -37,9 +34,13 @@ describe("TUIChat - @ File Search Tests", () => {
3734
// Type @ followed by text to filter files
3835
stdin.write("@READ");
3936

40-
const frame = await waitForFrameToContain(lastFrame, "@READ", {
41-
timeout: 2000,
42-
});
37+
// Wait for file search to filter and display results
38+
await new Promise((resolve) => setTimeout(resolve, 500));
39+
40+
const frame = lastFrame()!;
41+
42+
// Should show the typed text
43+
expect(frame).toContain("@READ");
4344

4445
// Should show either navigation hints or at least indicate file search is working
4546
const hasNavigationHints = frame.includes("↑/↓ to navigate");

extensions/cli/src/ui/__tests__/TUIChat.testHelper.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -436,57 +436,6 @@ export async function waitForNextRender(): Promise<void> {
436436
await new Promise((resolve) => setTimeout(resolve, 500));
437437
}
438438

439-
export interface WaitForFrameOptions {
440-
timeout?: number;
441-
interval?: number;
442-
}
443-
444-
export async function waitForFrameCondition(
445-
lastFrame: () => string | undefined,
446-
predicate: (frame: string) => boolean,
447-
{ timeout = 2000, interval = 50 }: WaitForFrameOptions = {},
448-
): Promise<string> {
449-
const start = Date.now();
450-
let frame = lastFrame();
451-
452-
while (Date.now() - start <= timeout) {
453-
if (frame && predicate(frame)) {
454-
return frame;
455-
}
456-
457-
await new Promise((resolve) => setTimeout(resolve, interval));
458-
frame = lastFrame();
459-
}
460-
461-
throw new Error(
462-
`Condition not met within ${timeout}ms. Last frame:\n${frame ?? "<undefined>"}`,
463-
);
464-
}
465-
466-
export function waitForFrameToContain(
467-
lastFrame: () => string | undefined,
468-
text: string,
469-
options?: WaitForFrameOptions,
470-
): Promise<string> {
471-
return waitForFrameCondition(
472-
lastFrame,
473-
(frame) => frame.includes(text),
474-
options,
475-
);
476-
}
477-
478-
export function waitForFrameToNotContain(
479-
lastFrame: () => string | undefined,
480-
text: string,
481-
options?: WaitForFrameOptions,
482-
): Promise<string> {
483-
return waitForFrameCondition(
484-
lastFrame,
485-
(frame) => !frame.includes(text),
486-
options,
487-
);
488-
}
489-
490439
/**
491440
* Helper to check if UI shows remote mode indicators
492441
*/

extensions/vscode/e2e/tests/Autocomplete.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AutocompleteActions } from "../actions/Autocomplete.actions";
55
import { GlobalActions } from "../actions/Global.actions";
66
import { DEFAULT_TIMEOUT } from "../constants";
77

8-
describe.skip("Autocomplete", () => {
8+
describe("Autocomplete", () => {
99
let editor: TextEditor;
1010

1111
before(async function () {

extensions/vscode/e2e/tests/Edit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DEFAULT_TIMEOUT } from "../constants";
1313
import { GUISelectors } from "../selectors/GUI.selectors";
1414
import { TestUtils } from "../TestUtils";
1515

16-
describe.skip("Edit Test", () => {
16+
describe("Edit Test", () => {
1717
let view: WebView;
1818
let editor: TextEditor;
1919
let originalEditorText = "Hello world!";

extensions/vscode/e2e/tests/KeyboardShortcuts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { DEFAULT_TIMEOUT } from "../constants";
1919
import { GUISelectors } from "../selectors/GUI.selectors";
2020
import { TestUtils } from "../TestUtils";
2121

22-
describe.skip("Keyboard Shortcuts", () => {
22+
describe("Keyboard Shortcuts", () => {
2323
let driver: WebDriver;
2424
let editor: TextEditor;
2525
let view: WebView;

extensions/vscode/e2e/tests/PromptFile.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { GlobalActions } from "../actions/Global.actions";
1111
import { DEFAULT_TIMEOUT } from "../constants";
1212

13-
describe.skip("Prompt file", () => {
13+
describe("Prompt file", () => {
1414
let editor: TextEditor;
1515

1616
before(async function () {

extensions/vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@
680680
"e2e:compile": "tsc -p ./tsconfig.e2e.json",
681681
"e2e:build": "npm --prefix ../../gui run build && npm run package",
682682
"e2e:create-storage": "mkdir -p ./e2e/storage",
683-
"e2e:get-chromedriver": "extest get-chromedriver --storage ./e2e/storage --code_version 1.95.0",
684-
"e2e:get-vscode": "extest get-vscode --storage ./e2e/storage --code_version 1.95.0",
683+
"e2e:get-chromedriver": "extest get-chromedriver --storage ./e2e/storage --code_version 1.92.2",
684+
"e2e:get-vscode": "extest get-vscode --storage ./e2e/storage --code_version 1.92.2",
685685
"e2e:sign-vscode": "codesign --entitlements entitlements.plist --deep --force -s - './e2e/storage/Visual Studio Code.app'",
686686
"e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh",
687687
"e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage",

0 commit comments

Comments
 (0)