Files
xinmi/scripts/verify_skills_memory_browser.cjs
yawan f7fc992f57
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
2026-09-22 16:19:06 +08:00

72 lines
5.0 KiB
JavaScript

const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const { chromium } = require('/Users/macclaw/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright')
async function main() {
const directory = '/Volumes/Extreme SSD/yawan-storage/weknora/acceptance'
const credentials = JSON.parse(fs.readFileSync(path.join(directory, 'super-admin-login.json'), 'utf8'))
const login = await fetch('http://127.0.0.1:18080/api/v1/auth/login', {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: credentials.email, password: credentials.password }),
})
assert.equal(login.status, 200)
const auth = await login.json()
const browser = await chromium.launch({ headless: true, channel: 'chrome' })
const checks = [], errors = []
const check = (name, passed) => { checks.push({ name, passed: !!passed }); assert.ok(passed, name) }
try {
const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } })
await context.addInitScript(a => {
const values = { weknora_user: JSON.stringify({ ...a.user, tenant_id: String(a.user.tenant_id) }),
weknora_tenant: JSON.stringify({ ...a.active_tenant, id: '10059' }), weknora_token: a.token,
weknora_refresh_token: a.refresh_token, weknora_memberships: JSON.stringify(a.memberships) }
for (const [key, value] of Object.entries(values)) localStorage.setItem(key, value)
localStorage.setItem('weknora:new-user-guide-done:v1', '1')
}, auth)
const page = await context.newPage()
page.on('pageerror', () => errors.push('page_error'))
await page.goto('http://127.0.0.1:15173/platform/agents?tab=skills')
await page.locator('.instruction-row').first().waitFor()
const globalRow = page.locator('.instruction-row').filter({ hasText: '全局技能' }).first()
await globalRow.getByRole('button', { name: '挂载', exact: true }).click()
const dialog = page.locator('.t-dialog:visible')
await dialog.locator('.mount-agent').first().waitFor()
const globalCount = await dialog.locator('.mount-agent:not(.is-disabled)').count()
check('global_skills_offer_more_than_two_agents', globalCount > 2)
await dialog.getByText('全选可用 Agent', { exact: true }).click()
check('all_eligible_agents_are_selected', await dialog.locator('.mount-agent.is-selected').count() === globalCount)
await page.screenshot({ path: path.join(directory, 'skills-mount-desktop.png'), animations: 'disabled' })
await page.setViewportSize({ width: 390, height: 844 })
await page.waitForFunction(() => {
const rect = document.querySelector('.skills-mount-dialog')?.getBoundingClientRect()
return rect && rect.width <= innerWidth && rect.left >= 0 && rect.right <= innerWidth + 2 && rect.top >= 0 && rect.bottom <= innerHeight
})
check('skill_dialog_fits_mobile', await dialog.evaluate(element => {
const rect = element.getBoundingClientRect(); return rect.width <= innerWidth && rect.left >= 0 && rect.right <= innerWidth + 2 && rect.top >= 0 && rect.bottom <= innerHeight
}))
await page.screenshot({ path: path.join(directory, 'skills-mount-mobile.png'), animations: 'disabled' })
await dialog.getByRole('button', { name: '取消', exact: true }).click()
await page.setViewportSize({ width: 1440, height: 1000 })
const privateRow = page.locator('.instruction-row').filter({ hasText: 'yawen-writing-chain' })
await privateRow.getByRole('button', { name: '挂载', exact: true }).click()
await dialog.locator('.mount-agent').first().waitFor()
check('private_skill_lists_but_blocks_other_owners', await dialog.locator('.mount-agent.is-disabled').count() > 0)
check('private_skill_owner_agents_remain_available', await dialog.locator('.mount-agent:not(.is-disabled)').count() > 0)
await dialog.getByRole('button', { name: '取消', exact: true }).click()
await page.goto('http://127.0.0.1:15173/platform/agents?tab=memory')
await page.locator('.memory-settings .setting-row .t-switch:not(.t-is-disabled)').waitFor()
check('memory_no_disabled_workspace_notice', await page.locator('.memory-settings .notice').count() === 0)
check('memory_add_enabled', await page.locator('.memory-settings').getByRole('button', { name: '添加', exact: true }).isEnabled())
await page.screenshot({ path: path.join(directory, 'memory-settings-desktop.png'), animations: 'disabled' })
await page.locator('.memory-settings .section-header-titlewrap').getByRole('button').filter({ hasText: '记忆' }).click()
await page.locator('.memory-workspace-settings').waitFor()
check('workspace_memory_configuration_opens', await page.locator('.memory-workspace-settings').isVisible())
check('no_browser_errors', errors.length === 0)
console.log(JSON.stringify({ checks, global_selectable_agents: globalCount }, null, 2))
} finally {
await browser.close()
}
}
main().catch(error => { console.error(error.message); process.exitCode = 1 })