Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
24 changes: 23 additions & 1 deletion e2e/pages/app-shell/ai-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ export const buildAiPreferencesLocators = (page: Page) => ({
noModelsNotice: () => page.getByTestId('ai-copilot-no-models'),
/** The error shown inside the Copilot card */
error: () => page.getByTestId('ai-provider-github-copilot').getByRole('alert')
}
},
compatEndpoint: (endpointId: string) => ({
header: () => page.getByTestId(`ai-endpoint-${endpointId}-header`),
expandedHeader: () =>
page.getByTestId(`ai-endpoint-${endpointId}-header`).and(page.locator('[aria-expanded="true"]')),
testConnectionButton: () => page.getByTestId(`ai-endpoint-${endpointId}-test`),
readyTestConnectionButton: () =>
page.getByTestId(`ai-endpoint-${endpointId}-test`).and(page.locator(':enabled')),
feedback: () => page.getByTestId(`ai-endpoint-${endpointId}`).getByRole('status')
})
});

/**
Expand Down Expand Up @@ -61,3 +70,16 @@ export const expandCopilotCard = async (page: Page) => {
await expect(header).toHaveAttribute('aria-expanded', 'true');
});
};

export const testCompatEndpointConnection = async (page: Page, endpointId: string) => {
await test.step(`Test the connection of endpoint "${endpointId}"`, async () => {
const { header, expandedHeader, testConnectionButton, readyTestConnectionButton }
= buildAiPreferencesLocators(page).compatEndpoint(endpointId);
await readyTestConnectionButton().waitFor({ state: 'attached' });
await expandedHeader()
.waitFor({ timeout: 2000 })
.catch(() => header().click());
await expandedHeader().waitFor();
await testConnectionButton().click();
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"preferences": {
"onboarding": {
"hasLaunchedBefore": true,
"hasSeenWelcomeModal": true
},
"request": {
"sslVerification": true,
"customCaCertificate": {
"enabled": {{customCaEnabled}},
"filePath": "{{customCaFilePath}}"
},
"keepDefaultCaCertificates": {
"enabled": true
}
},
"proxy": {
"source": "{{proxySource}}",
"disabled": {{proxyDisabled}},
"pac": {
"source": "{{pacUrl}}"
},
"config": {
"protocol": "http",
"hostname": "127.0.0.1",
"port": {{proxyPort}},
"auth": {
"username": "",
"password": ""
},
"bypassProxy": "{{proxyBypass}}"
}
},
"ai": {
"enabled": true,
"providers": {
"openai-compatible:private-gateway": {
"enabled": true
}
},
"openaiCompatibleEndpoints": [
{
"id": "private-gateway",
"name": "Private gateway",
"baseURL": "https://localhost:{{endpointPort}}{{endpointBasePath}}",
"models": [
{
"id": "private-gateway:test-model",
"label": "Test model",
"modelId": "test-model"
}
]
}
]
}
}
}
Loading
Loading