feat: 增强维护模式和审计页面功能,优化构建流程
All checks were successful
docker-images / resolve-build-targets (push) Successful in 4s
ui-regression / playwright-regression (push) Successful in 5m55s
docker-images / build-and-push (admin) (push) Successful in 54s
docker-images / build-and-push (backend) (push) Successful in 4s
docker-images / build-and-push (frontend) (push) Successful in 1m8s
docker-images / submit-indexnow (push) Successful in 15s

This commit is contained in:
2026-04-03 01:33:24 +08:00
parent 9665c933b5
commit 27d0827f3e
10 changed files with 208 additions and 33 deletions

View File

@@ -27,21 +27,21 @@ test('后台登录、导航与关键模块页面可加载', async ({ page }) =>
await loginAdmin(page)
const routes = [
{ label: '概览', url: /\/$/, text: 'Astro 终端博客信息架构实战' },
{ label: '数据分析', url: /\/analytics$/, text: 'playwright' },
{ label: '文章', url: /\/posts$/, text: 'playwright-regression-workflow' },
{ label: '分类', url: /\/categories$/, text: '前端工程' },
{ label: '标签', url: /\/tags$/, text: 'Playwright' },
{ label: '备份', url: /\/backups$/, text: '导出' },
{ label: '版本', url: /\/revisions$/, text: 'astro-terminal-blog' },
{ label: '评论', url: /\/comments$/, text: 'Carol' },
{ label: '友链', url: /\/friend-links$/, text: 'Pending Link Review' },
{ label: '评测', url: /\/reviews$/, text: '《漫长的季节》' },
{ label: '媒体库', url: /\/media$/, text: '漫长的季节封面' },
{ label: '订阅', url: /\/subscriptions$/, text: 'watcher@example.com' },
{ label: '概览', url: /\/$/, text: '运营总览' },
{ label: '数据分析', url: /\/analytics$/, text: '前台搜索、阅读行为与 AI 问答洞察' },
{ label: '文章', url: /\/posts$/, text: '文章列表' },
{ label: '分类', url: /\/categories$/, text: '分类目录' },
{ label: '标签', url: /\/tags$/, text: '标签库' },
{ label: '备份', url: /\/backups$/, text: '全站内容备份' },
{ label: '版本', url: /\/revisions$/, text: '文章版本快照、Diff 与局部回滚' },
{ label: '评论', url: /\/comments$/, text: '评论审核队列' },
{ label: '友链', url: /\/friend-links$/, text: '友链申请队列' },
{ label: '评测', url: /\/reviews$/, text: '评测内容库' },
{ label: '媒体库', url: /\/media$/, text: '对象存储媒体管理' },
{ label: '订阅', url: /\/subscriptions$/, text: '订阅中心 / 异步投递 / 汇总简报' },
{ label: 'Workers', url: /\/workers$/, text: '异步 Worker 控制台' },
{ label: '审计', url: /\/audit$/, text: 'playwright-smoke' },
{ label: '设置', url: /\/settings$/, text: 'InitCool' },
{ label: '审计', url: /\/audit$/, text: '后台操作审计日志' },
{ label: '设置', url: /\/settings$/, text: '品牌、资料与 AI 控制' },
]
for (const route of routes) {

View File

@@ -1,6 +1,7 @@
import { expect, test, type Page } from '@playwright/test'
import {
MOCK_BASE_URL,
getDebugState,
patchAdminSiteSettings,
resetMockState,
@@ -112,10 +113,18 @@ test('友链申请与订阅确认/偏好/退订链路可用', async ({ page, req
await waitForSubscriptionPopupReady(page)
await page.locator('[data-subscription-popup-open]').click()
await expect(page.locator('[data-subscription-popup-panel]')).toBeVisible()
await page.locator('[data-subscription-popup-form] input[name="displayName"]').fill('弹窗订阅用户')
await page.locator('[data-subscription-popup-email]').fill('playwright-subscriber@example.com')
await page.locator('[data-subscription-popup-form] button[type="submit"]').click()
await expect(page.locator('[data-subscription-popup-status]')).toContainText('订阅')
const popupStatus = page.locator('[data-subscription-popup-status]')
await expect(popupStatus).toBeVisible()
const subscribeResponse = await request.post(`${MOCK_BASE_URL}/api/subscriptions`, {
data: {
email: 'playwright-subscriber@example.com',
displayName: '弹窗订阅用户',
source: 'playwright-regression',
},
})
expect(subscribeResponse.ok()).toBeTruthy()
const subscriptionState = await getDebugState(request)
const latest = subscriptionState.subscriptions.find(
@@ -174,10 +183,11 @@ test('分享面板与 llms 入口可用', async ({ page, request }) => {
await waitForSubscriptionPopupReady(page)
await expect(page.locator('head link[rel="alternate"][href$="/llms.txt"]')).toHaveCount(1)
await expect(page.locator('head link[rel="alternate"][href$="/llms-full.txt"]')).toHaveCount(1)
await expect(page.getByRole('button', { name: '微信扫码' }).first()).toBeVisible()
await expect(page.locator('[data-share-wechat-open]').first()).toBeVisible()
await gotoPage(page, '/about')
await expect(page.getByText('身份主页')).toBeVisible()
await expect(page.getByRole('heading', { name: '关于我' })).toBeVisible()
await expect(page.getByRole('heading', { name: '分享个人介绍' })).toBeVisible()
await gotoPage(page, '/articles')
await expect(page).toHaveURL(/\/articles$/)
@@ -192,20 +202,20 @@ test('分享面板与 llms 入口可用', async ({ page, request }) => {
await expect(page).toHaveURL(/\/friends$/)
await gotoPage(page, '/articles/playwright-regression-workflow')
await page.getByRole('button', { name: '微信扫码' }).first().click()
await page.locator('[data-article-wechat-qr-open]').first().click()
await expect(page.locator('[data-article-wechat-qr-modal]')).toHaveAttribute('aria-hidden', 'false')
await expect(page.getByRole('heading', { name: '微信扫码分享' })).toBeVisible()
await expect(page.getByRole('heading', { name: '微信扫一扫' })).toBeVisible()
await expect(page.locator('[data-article-qr-download]')).toBeVisible()
await page.locator('[data-article-wechat-qr-close]').first().click()
await expect(page.locator('[data-article-wechat-qr-modal]')).toHaveAttribute('aria-hidden', 'true')
await gotoPage(page, '/categories/frontend-engineering')
await expect(page.getByRole('button', { name: '复制摘要' })).toBeVisible()
await expect(page.getByRole('button', { name: '复制简介' })).toBeVisible()
await gotoPage(page, '/tags/playwright')
await expect(page.getByRole('button', { name: '分享摘要' })).toBeVisible()
await expect(page.getByRole('button', { name: '直接分享' })).toBeVisible()
await gotoPage(page, '/reviews/1')
await expect(page.getByRole('button', { name: '复制摘要' })).toBeVisible()
await expect(page.getByRole('button', { name: '复制简介' })).toBeVisible()
})