cfe60ebbb1
- New workflow `production Smoke` with workflow_dispatch + daily schedule (05:00 UTC). Does NOT run on push/PR. - Runs smoke-http, guest-onboarding, home-shell, and unauthenticated store tests against music-room.huiwings.cn. - Includes optional SSH health check (if PROD_SSH_* secrets configured). - Also makes smoke-http testOrgId configurable via PROD_ORG_ID env var for cross-environment use (moicen vs huiwings). - Adds production-remote-check.sh script. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
62 lines
2.3 KiB
TypeScript
62 lines
2.3 KiB
TypeScript
import { expect, test } from './fixtures';
|
||
|
||
function frontBaseUrl(): string {
|
||
const raw =
|
||
process.env.HUIKE_FRONT_BASE_URL?.trim() ||
|
||
'https://music-room.moicen.com';
|
||
return raw.replace(/\/$/, '');
|
||
}
|
||
|
||
/**
|
||
* 不依赖浏览器:验证网关返回 H5 入口文档(部署/ DNS / TLS / Nginx 全链路底线)。
|
||
*/
|
||
const testOrgId = process.env.PROD_ORG_ID?.trim() || '57753e11dff343b1ab95623933e8960b';
|
||
|
||
test.describe('网关与 H5 文档(request)', () => {
|
||
test('GET / 返回 HTML', async ({ request }) => {
|
||
const res = await request.get(`${frontBaseUrl()}/`);
|
||
expect(res.ok(), `HTTP ${res.status()} ${res.statusText()}`).toBeTruthy();
|
||
const ct = res.headers()['content-type'] ?? '';
|
||
expect(ct).toMatch(/text\/html/i);
|
||
});
|
||
});
|
||
|
||
test.describe('课包商店 API(反代验收)', () => {
|
||
const kcBase =
|
||
process.env.KC_BASE_URL?.trim() || 'https://admin.moicen.com';
|
||
|
||
test('public-packages API 返回 JSON(非 HTML)', async ({ request }) => {
|
||
const url = `${kcBase}/api/v1/clazz/course-package/public-packages?org_id=${testOrgId}&page=1&page_size=20`;
|
||
const res = await request.get(url);
|
||
expect(res.ok(), `HTTP ${res.status()} ${res.statusText()}`).toBeTruthy();
|
||
|
||
const ct = res.headers()['content-type'] ?? '';
|
||
expect(ct).toMatch(/application\/json/i);
|
||
|
||
const body = await res.json();
|
||
expect(body).toHaveProperty('r');
|
||
expect(body.r).toBe(true);
|
||
expect(body).toHaveProperty('d');
|
||
expect(Array.isArray(body.d?.[0])).toBe(true);
|
||
});
|
||
|
||
test('public-packages API 含课包卡片字段', async ({ request }) => {
|
||
const url = `${kcBase}/api/v1/clazz/course-package/public-packages?org_id=${testOrgId}&page=1&page_size=20`;
|
||
const res = await request.get(url);
|
||
expect(res.ok()).toBeTruthy();
|
||
|
||
const body = await res.json();
|
||
const packages = body.d?.[0] as Array<Record<string, unknown>>;
|
||
expect(packages.length).toBeGreaterThan(0);
|
||
|
||
for (const pkg of packages) {
|
||
expect(pkg).toHaveProperty('package_name');
|
||
expect(pkg).toHaveProperty('total_lessons');
|
||
expect(pkg).toHaveProperty('package_status');
|
||
// Pricing fields should exist in data but not displayed in frontend
|
||
expect(pkg).toHaveProperty('original_price');
|
||
expect(pkg).toHaveProperty('selling_price');
|
||
}
|
||
});
|
||
});
|