chore: add konnect smoke tests (#10014)

This commit is contained in:
Shelby
2026-06-02 16:48:21 -07:00
committed by GitHub
parent 4c83a808b7
commit 13b60292d6
4 changed files with 47 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ interface EnvOptions {
INSOMNIA_VAULT_KEY: string;
INSOMNIA_VAULT_SALT: string;
INSOMNIA_VAULT_SRP_SECRET: string;
KONNECT_API_URL: string;
}
interface AESMessage {
@@ -95,6 +96,7 @@ export const test = baseTest.extend<{
INSOMNIA_VAULT_KEY: userConfig.vaultKey || '',
INSOMNIA_VAULT_SALT: userConfig.vaultSalt || '',
INSOMNIA_VAULT_SRP_SECRET: userConfig.vaultSrpSecret || '',
KONNECT_API_URL: echoServer,
...(userConfig.session ? { INSOMNIA_SESSION: JSON.stringify(userConfig.session) } : {}),
};
const { ELECTRON_RUN_AS_NODE: _ignored, ...launchEnv } = process.env;

View File

@@ -653,4 +653,8 @@ export default function setup(app: Application) {
isAllowed: true,
});
});
app.get('/v2/control-planes', (_req, res) => {
res.status(200).json({ data: [] });
});
}

View File

@@ -0,0 +1,40 @@
import { expect } from '@playwright/test';
import { test } from '../../playwright/test';
test.describe('Konnect sidebar tab', () => {
test('shows intro card without a PAT, configure it, then sync', async ({ page, insomnia }) => {
await page.getByTestId('sidebar-tab-konnect').click();
await expect.soft(page.getByText('Auto-sync your gateway service routes')).toBeVisible();
await page.getByRole('button', { name: 'Configure' }).click();
await page.getByLabel('Personal Access Token').fill('kpat_test');
await page.getByRole('button', { name: 'Connect & Sync' }).click();
await expect.soft(page.getByText('Connected')).toBeVisible();
await page.getByRole('button', { name: 'Close' }).click();
await expect.soft(page.getByRole('button', { name: 'Sync Konnect' })).toBeVisible();
await page.getByTestId('sidebar-tab-projects').click();
await expect.soft(page.getByRole('button', { name: 'Create new Project' })).toBeVisible();
});
test.describe('with konnectSync feature flag disabled', () => {
test.beforeEach(async ({ request }) => {
await request.post('http://127.0.0.1:4010/v1/test-utils/organizations/features', {
data: { features: { gitSync: { enabled: true }, konnectSync: { enabled: false } } },
});
});
test.afterEach(async ({ request }) => {
await request.post('http://127.0.0.1:4010/v1/test-utils/organizations/features', {
data: { features: { gitSync: { enabled: true }, konnectSync: { enabled: true } } },
});
});
test('hides the Konnect tab', async ({ page }) => {
await page.reload();
await expect.soft(page.getByTestId('sidebar-tab-konnect')).toBeHidden();
});
});
});

View File

@@ -114,6 +114,7 @@ export const KonnectSettingsModal = ({
{showDisconnectConfirm ? 'Disconnect Kong Konnect?' : 'Kong Konnect settings'}
</Heading>
<Button
aria-label="Close"
className="flex aspect-square h-6 shrink-0 items-center justify-center rounded-sm text-sm text-(--color-font) ring-1 ring-transparent transition-all hover:bg-(--hl-xs) focus:ring-(--hl-md) focus:ring-inset"
onPress={close}
>