mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-16 14:57:15 +00:00
fix(web): complete pluginized agent onboarding flows
This commit is contained in:
@@ -9,8 +9,20 @@ const dialogPath = path.join(
|
||||
'src/app/home/components/qrcode-login/QrCodeLoginDialog.tsx',
|
||||
);
|
||||
const localeDir = path.join(root, 'src/i18n/locales');
|
||||
const backendUrlPath = path.join(root, 'src/app/infra/http/backendUrl.ts');
|
||||
|
||||
const dialogSource = fs.readFileSync(dialogPath, 'utf8');
|
||||
const backendUrlSource = fs.readFileSync(backendUrlPath, 'utf8');
|
||||
|
||||
test('QR login resolves a proxy-root API base against the current origin', () => {
|
||||
assert.match(dialogSource, /const baseUrl = getBackendBaseUrl\(\)/);
|
||||
assert.match(backendUrlSource, /!configured \|\| configured === '\/'/);
|
||||
assert.match(backendUrlSource, /return normalizedOrigin/);
|
||||
assert.doesNotMatch(
|
||||
dialogSource,
|
||||
/import\.meta\.env\.VITE_API_BASE_URL \|\| window\.location\.origin/,
|
||||
);
|
||||
});
|
||||
|
||||
test('QR credential exchanges preserve the active Workspace scope', () => {
|
||||
assert.match(dialogSource, /getActiveWorkspaceUuid/);
|
||||
|
||||
@@ -9,6 +9,13 @@ const wizardSource = fs.readFileSync(
|
||||
path.resolve(currentDirectory, '../../src/app/wizard/page.tsx'),
|
||||
'utf8',
|
||||
);
|
||||
const runnerMarketplaceSource = fs.readFileSync(
|
||||
path.resolve(
|
||||
currentDirectory,
|
||||
'../../src/app/home/agents/agent-runner-marketplace.ts',
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
const widgetSource = fs.readFileSync(
|
||||
path.resolve(
|
||||
currentDirectory,
|
||||
@@ -32,11 +39,58 @@ test('shows the test-only notice only when the wizard opts in', () => {
|
||||
assert.match(widgetSource, /testNotice\.textContent = scriptTestNotice/);
|
||||
});
|
||||
|
||||
test('opens the Page Bot preview after every successful wizard save', () => {
|
||||
assert.match(wizardSource, /script\.dataset\.autoOpen = 'true'/);
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/setPageBotPreviewRequest\(\(request\) => request \+ 1\)/,
|
||||
);
|
||||
assert.match(wizardSource, /root\?\.langbotOpen\?\.\(\)/);
|
||||
assert.match(widgetSource, /getAttribute\("data-auto-open"\) === "true"/);
|
||||
assert.match(widgetSource, /root\.langbotOpen = function \(\)/);
|
||||
assert.match(widgetSource, /if \(scriptAutoOpen\) root\.langbotOpen\(\)/);
|
||||
});
|
||||
|
||||
test('binds every message-reply bot to its provisional pipeline before verification', () => {
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/selectedScenarioDefinition\?\.processorKind === 'pipeline'[\s\S]*?httpClient\.createPipeline\(/,
|
||||
);
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/event_pattern: selectedScenarioDefinition\.eventType,[\s\S]*?target_type: 'pipeline',[\s\S]*?target_uuid: previewPipelineUuid/,
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
wizardSource,
|
||||
/selectedAdapter === 'web_page_bot' && !previewPipelineUuid/,
|
||||
);
|
||||
});
|
||||
|
||||
test('keeps the 4.11 AgentRunner marketplace installation flow', () => {
|
||||
assert.match(wizardSource, /RUNNER_COMPONENT_FILTER = 'AgentRunner'/);
|
||||
assert.match(wizardSource, /installPluginFromMarketplace\(/);
|
||||
assert.match(wizardSource, /runnerPluginPrefix\(plugin\)/);
|
||||
assert.match(wizardSource, /registrationDeadline/);
|
||||
assert.match(wizardSource, /loadAgentRunnerCatalog\(\)/);
|
||||
assert.match(wizardSource, /installMarketplaceAgentRunner\(plugin\)/);
|
||||
assert.match(
|
||||
runnerMarketplaceSource,
|
||||
/RUNNER_COMPONENT_FILTER = 'AgentRunner'/,
|
||||
);
|
||||
assert.match(runnerMarketplaceSource, /installPluginFromMarketplace\(/);
|
||||
assert.match(runnerMarketplaceSource, /runnerPluginPrefix\(plugin\)/);
|
||||
assert.match(runnerMarketplaceSource, /registrationDeadline/);
|
||||
});
|
||||
|
||||
test('requires the selected AgentRunner mandatory configuration before finishing', () => {
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/isRequiredRunnerConfigComplete\(selectedRunnerConfigItems, runnerConfig\)/,
|
||||
);
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/return selectedRunner !== null && isRunnerConfigComplete/,
|
||||
);
|
||||
assert.match(
|
||||
wizardSource,
|
||||
/!selectedRunner \|\|[\s\S]*?!isRunnerConfigComplete \|\|[\s\S]*?!createdBotUuid/,
|
||||
);
|
||||
});
|
||||
|
||||
test('requires an observed message only for the message-reply scenario', () => {
|
||||
|
||||
Reference in New Issue
Block a user