Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/coc/test/e2e/queue-conversation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,20 @@ test.describe('Queue Task Conversation – Scroll', () => {
await gotoQueueTask(page, serverUrl, wsId, taskId);
await waitForConversation(page, 2);

// Wait for the initial auto-scroll-to-bottom (a deferred
// requestAnimationFrame in ChatDetail) to settle, and for the
// conversation to overflow enough that scrolling to the top yields
// dist > 100. Otherwise that pending rAF can fire *after* we scroll
// up, snapping back to the bottom and clearing isScrolledUp before
// the assertion runs.
await page.waitForFunction(() => {
const el = document.querySelector('[data-testid="activity-chat-conversation"]');
if (!el) return false;
const overflow = el.scrollHeight - el.clientHeight;
const distFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
return overflow > 150 && distFromBottom < 80;
}, { timeout: 5000 });

// Scroll to top programmatically
await page.evaluate(() => {
const el = document.querySelector('[data-testid="activity-chat-conversation"]');
Expand Down
5 changes: 5 additions & 0 deletions packages/coc/test/server/template-watcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ describe('TemplateWatcher', () => {
cleanupWatchers.push(watcher);
watcher.watchWorkspace('ws1', root);

// Let the watcher fully register before writing (macOS FSEvents can be
// slow to attach; without this the rapid writes below can all land
// before the watch is established, yielding 0 callbacks).
await wait(200);

const templatesDir = path.join(root, '.vscode', 'templates');

// Rapid-fire 10 writes within 100ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ describe('ProviderModelsSection', () => {
await waitFor(() => {
expect(screen.getByTestId('provider-models-section')).toBeDefined();
});
const cards = screen.getAllByTestId('provider-model-card');
// Cards are populated from localModels, which the hook syncs in a
// useEffect that runs after `loading` flips false — so the section can
// render one tick before the cards exist. Wait for them instead of
// querying synchronously.
const cards = await screen.findAllByTestId('provider-model-card');
expect(cards).toHaveLength(2);
expect(screen.getByTestId('provider-models-count').textContent).toBe('2 models');
expect(screen.getByTestId('provider-models-enabled-count').textContent).toContain('1 of 2 enabled');
Expand Down
24 changes: 17 additions & 7 deletions packages/vscode-extension/src/test/suite/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,18 @@ suite('ShortcutsCommands Integration Tests', function() {
}
});

test('should delete group with items', async () => {
test('should delete group with items', async function() {
// Increase timeout for this flaky test (slow macOS runners)
this.timeout(10000);

// Setup: Create a group with items
await configManager.createLogicalGroup('Group With Items To Delete');
await configManager.addToLogicalGroup('Group With Items To Delete', testFolder, 'Test Folder', 'folder');
await configManager.saveConfiguration(await configManager.loadConfiguration());

// Trigger the extension to refresh its view and wait for file system to settle
await vscode.commands.executeCommand('shortcuts.refresh');
await new Promise(resolve => setTimeout(resolve, 200));
await new Promise(resolve => setTimeout(resolve, 300));

provider.refresh();

Expand All @@ -679,11 +682,18 @@ suite('ShortcutsCommands Integration Tests', function() {
try {
await vscode.commands.executeCommand('shortcuts.deleteLogicalGroup', groupItem);

// Wait for file system operations to complete
await new Promise(resolve => setTimeout(resolve, 100));
configManager.invalidateCache();
const config = await configManager.loadConfiguration();
const exists = config.logicalGroups.some(g => g.name === 'Group With Items To Delete');
// Poll for the deletion to be reflected on disk + cache
// (fixed 100ms sleep was racing slow macOS file watchers — caused
// intermittent `true !== false` failures in CI).
const deadline = Date.now() + 3000;
let exists = true;
while (Date.now() < deadline) {
await new Promise(resolve => setTimeout(resolve, 100));
configManager.invalidateCache();
const config = await configManager.loadConfiguration();
exists = config.logicalGroups.some(g => g.name === 'Group With Items To Delete');
if (!exists) break;
}
assert.strictEqual(exists, false, 'Group should be deleted');

} finally {
Expand Down
Loading