feat(design): 彻底去除全站AI味:排版全面升级为大厂左对齐架构,文案全量替换为实务工程语言
这个提交包含在:
@@ -7,8 +7,11 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if BASE_DIR not in sys.path:
|
||||
sys.path.insert(0, BASE_DIR)
|
||||
|
||||
class TestResult:
|
||||
def __init__(self, name):
|
||||
@@ -213,14 +216,25 @@ def test_contact_page():
|
||||
|
||||
return res.summary()
|
||||
|
||||
def test_no_ai_flavor_suite():
|
||||
res = TestResult("去AI味专项测试 (NoAiFlavor)")
|
||||
from tests.test_no_ai_flavor import TestNoAiFlavor
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestNoAiFlavor)
|
||||
runner = unittest.TextTestRunner(verbosity=0)
|
||||
test_result = runner.run(suite)
|
||||
res.assert_true(test_result.wasSuccessful(), f"去AI味全量断言通过 (共 {test_result.testsRun} 项)")
|
||||
return res.summary()
|
||||
|
||||
def main():
|
||||
import unittest
|
||||
results = [
|
||||
test_cases_page(),
|
||||
test_services_page(),
|
||||
test_products_page(),
|
||||
test_nav_megamenu(),
|
||||
test_about_page(),
|
||||
test_contact_page()
|
||||
test_contact_page(),
|
||||
test_no_ai_flavor_suite()
|
||||
]
|
||||
sys.exit(0 if all(results) else 1)
|
||||
|
||||
|
||||
122
tests/test_no_ai_flavor.py
普通文件
122
tests/test_no_ai_flavor.py
普通文件
@@ -0,0 +1,122 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
去 AI 味(文案与排版)专项自动化测试用例
|
||||
严格遵循 TDD 模式:验证全站文本杜绝 AI 假大空对仗口号,排版具备大厂专业左对齐与严谨网格。
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
class TestNoAiFlavor(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.index_html_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_home/index.html')
|
||||
self.service_page_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_product/service_page.html')
|
||||
self.product_page_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_product/product_page.html')
|
||||
self.cases_page_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_case_show/list.html')
|
||||
self.about_page_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_home/single.html')
|
||||
self.about_mobile_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_home/single_e.html')
|
||||
self.contact_page_path = os.path.join(ROOT_DIR, 'addons/official/view/web/official_online_message/list.html')
|
||||
self.css_path = os.path.join(ROOT_DIR, 'public/assets/addons/official/css/modern_nhc.css')
|
||||
|
||||
with open(self.index_html_path, 'r', encoding='utf-8') as f:
|
||||
self.index_html = f.read()
|
||||
with open(self.service_page_path, 'r', encoding='utf-8') as f:
|
||||
self.service_page = f.read()
|
||||
with open(self.product_page_path, 'r', encoding='utf-8') as f:
|
||||
self.product_page = f.read()
|
||||
with open(self.cases_page_path, 'r', encoding='utf-8') as f:
|
||||
self.cases_page = f.read()
|
||||
with open(self.about_page_path, 'r', encoding='utf-8') as f:
|
||||
self.about_page = f.read()
|
||||
with open(self.about_mobile_path, 'r', encoding='utf-8') as f:
|
||||
self.about_mobile = f.read()
|
||||
with open(self.contact_page_path, 'r', encoding='utf-8') as f:
|
||||
self.contact_page = f.read()
|
||||
with open(self.css_path, 'r', encoding='utf-8') as f:
|
||||
self.css = f.read()
|
||||
|
||||
def test_forbidden_ai_buzzwords_in_index(self):
|
||||
"""首页必须彻底杜绝 AI 假大空对仗套话"""
|
||||
forbidden_words = [
|
||||
'铸造数字生产力',
|
||||
'格物致知',
|
||||
'经纬分明',
|
||||
'架构严谨立骨',
|
||||
'严审磐石',
|
||||
'笃行护航',
|
||||
'成巨流',
|
||||
'海纳百川以成巨流',
|
||||
'聚智能以启新元'
|
||||
]
|
||||
for word in forbidden_words:
|
||||
self.assertNotIn(word, self.index_html, f"首页 index.html 仍包含 AI 味词汇: '{word}'")
|
||||
|
||||
def test_forbidden_ai_buzzwords_in_services(self):
|
||||
"""服务页必须杜绝 AI 假大空标题与步骤套话"""
|
||||
forbidden_words = [
|
||||
'经纬立骨铸基石',
|
||||
'全栈自主赋生产',
|
||||
'格物致知',
|
||||
'架构严谨立骨',
|
||||
'严审磐石',
|
||||
'修己守信',
|
||||
]
|
||||
for word in forbidden_words:
|
||||
self.assertNotIn(word, self.service_page, f"服务页 service_page.html 仍包含 AI 味词汇: '{word}'")
|
||||
|
||||
def test_forbidden_ai_buzzwords_in_products(self):
|
||||
"""产品页必须杜绝 AI 假大空口号"""
|
||||
forbidden_words = [
|
||||
'积厚流光成重器',
|
||||
'矩阵赋能拓坦途',
|
||||
]
|
||||
for word in forbidden_words:
|
||||
self.assertNotIn(word, self.product_page, f"产品页 product_page.html 仍包含 AI 味词汇: '{word}'")
|
||||
|
||||
def test_forbidden_ai_buzzwords_in_about(self):
|
||||
"""关于我们(PC与移动端)必须杜绝空洞口号"""
|
||||
forbidden_words = [
|
||||
'海纳百川,有容乃大;壁立千仞,无欲则刚',
|
||||
'格物致知 · 自主可控',
|
||||
'格物求真',
|
||||
'慎终如始',
|
||||
]
|
||||
for word in forbidden_words:
|
||||
self.assertNotIn(word, self.about_page, f"关于我们 PC 页仍包含 AI 味词汇: '{word}'")
|
||||
self.assertNotIn(word, self.about_mobile, f"关于我们移动端页仍包含 AI 味词汇: '{word}'")
|
||||
|
||||
def test_enterprise_engineering_keywords(self):
|
||||
"""全站必须具备真实大厂软件工程与业务术语"""
|
||||
required_in_index = ['源码交付', '微服务', '私有化部署', '测试驱动']
|
||||
for kw in required_in_index:
|
||||
self.assertIn(kw, self.index_html, f"首页缺少硬核工程关键词: '{kw}'")
|
||||
|
||||
required_in_services = ['源码', '微服务', 'API', 'SLA', '私有化']
|
||||
for kw in required_in_services:
|
||||
self.assertIn(kw, self.service_page, f"服务页缺少硬核工程关键词: '{kw}'")
|
||||
|
||||
def test_layout_enterprise_left_aligned_hero(self):
|
||||
"""首屏与二级页排版验证:左对齐大厂排版与严谨留白"""
|
||||
self.assertIn('text-align: left;', self.css, "CSS 中应包含 text-align: left")
|
||||
# 确保 hero-content 是左对齐
|
||||
hero_content_match = re.search(r'(?:\r?\n)\.nhc-hero-content\s*\{([^}]+)\}', self.css)
|
||||
self.assertTrue(hero_content_match, "必须包含 .nhc-hero-content 样式块")
|
||||
self.assertIn('text-align: left', hero_content_match.group(1))
|
||||
|
||||
# 确保二级页面 Hero 支持左对齐大厂风
|
||||
page_hero_match = re.search(r'\.nhc-page-hero\s*\{([^}]+)\}', self.css)
|
||||
self.assertTrue(page_hero_match, "必须包含 .nhc-page-hero 样式块")
|
||||
self.assertIn('text-align: left', page_hero_match.group(1), "二级页 Hero 推荐大厂左对齐排版")
|
||||
|
||||
def test_typography_and_color_tokens(self):
|
||||
"""规范中的设计令牌:纯净背景、科技蓝主色、严禁霓虹炫目"""
|
||||
self.assertIn('--primary: #2563EB;', self.css)
|
||||
self.assertIn('--bg-primary: #FFFFFF;', self.css)
|
||||
self.assertIn('--bg-secondary: #F8FAFC;', self.css)
|
||||
self.assertIn('--text-primary: #0F172A;', self.css)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
在新工单中引用
屏蔽一个用户