Allow retrying pending Copilot connectors by pwang347 · Pull Request #341081 · microsoft/vscode · GitHub
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ suite('Connector presentation', () => {
{ statusLabel: 'Connection status not checked', statusIcon: 'info', action: 'check', actionLabel: 'Check Connection' },
{ statusLabel: 'Connected', statusIcon: 'connected', action: 'more' },
{ statusLabel: 'Not connected', action: 'connect', actionLabel: 'Connect' },
{ statusLabel: 'Connection pending', statusIcon: 'pending' },
{ statusLabel: 'Connection pending', statusIcon: 'pending', action: 'retry', actionLabel: 'Try Again' },
{ statusLabel: 'Sign in required', statusIcon: 'attention', action: 'sign_in', actionLabel: 'Sign in' },
{ statusLabel: 'Review required', statusIcon: 'attention', action: 'review', actionLabel: 'Review' },
{ statusLabel: 'Connection failed', statusIcon: 'error', action: 'retry', actionLabel: 'Try Again' },
Expand All @@ -67,16 +67,23 @@ suite('Connector presentation', () => {
const detail = disposables.add(new EmbeddedConnectorDetail(
container, () => { }, service, new class extends mock<INotificationService>() { }(), new class extends mock<IOpenerService>() { }(),
));
const states = ['sign_in_required', 'review_required', 'retryable_error', 'unavailable'] as const;
const states = [
connector('pending'),
connector('error', 'sign_in_required'),
connector('error', 'review_required'),
connector('error', 'retryable_error'),
connector('error', 'unavailable'),
];
const presentations = states.map(state => {
detail.setInput(connector('error', state));
detail.setInput(state);
return {
status: container.querySelector('.connector-detail-facts .embedded-detail-fact-value')?.textContent,
action: container.querySelector('.embedded-detail-title-actions .monaco-button')?.textContent,
};
});

assert.deepStrictEqual(presentations, [
{ status: 'Connection pending', action: 'Try Again' },
{ status: 'Sign in required', action: 'Sign in' },
{ status: 'Review required', action: 'Review' },
{ status: 'Connection failed', action: 'Try Again' },
Expand Down Expand Up @@ -108,15 +115,13 @@ suite('Connector presentation', () => {
assert.deepStrictEqual({ started: actionToken !== undefined, cancelled: actionToken?.isCancellationRequested }, { started: true, cancelled: true });
});

test('an earlier refresh cannot replace a newly selected connector', async () => {
test('an earlier retry cannot replace a newly selected connector', async () => {
const container = DOM.append(document.body, DOM.$('.connector-detail-test'));
disposables.add(toDisposable(() => container.remove()));
const result = new DeferredPromise<readonly ICopilotConnector[]>();
const service = new class extends mock<ICopilotConnectorsService>() {
override readonly onDidChange = Event.None;
override async refresh(): Promise<readonly ICopilotConnector[]> {
return [];
}
override async connect(): Promise<void> { }
override getConnectors(): Promise<readonly ICopilotConnector[]> {
return result.p;
}
Expand Down
Loading
Loading