feat(ui): apply Endoleap themes, brand marks and favicons
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/** CI-only checks against the disposable stack, never against personal documents. */
|
||||
import assert from 'node:assert/strict';
|
||||
import { chromium } from 'playwright-core';
|
||||
export async function verifyBrandUI(base: string) {
|
||||
for (const prefix of process.env.VERIFY_CANVAS_UI === '1' ? ['', '/studio'] : ['']) {
|
||||
const icon = await fetch(`${base}${prefix}/favicon.ico`);
|
||||
assert.equal(icon.status, 200);
|
||||
const bytes = new Uint8Array(await icon.arrayBuffer());
|
||||
assert.deepEqual([...bytes.slice(0, 4)], [0, 0, 1, 0]);
|
||||
assert.equal(bytes[4], 7, 'favicon includes seven resolutions');
|
||||
for (const file of ['logo-light.svg', 'logo-dark.svg', 'icon-dark.svg']) {
|
||||
const image = await fetch(`${base}${prefix}/brand/${file}`);
|
||||
assert.equal(image.status, 200, prefix + '/' + file);
|
||||
assert.match(await image.text(), /<svg/);
|
||||
}
|
||||
}
|
||||
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || '/usr/bin/chromium', headless: true, args: ['--no-sandbox', '--disable-dev-shm-usage'] });
|
||||
try {
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 960 } });
|
||||
const visit = async (path: string, theme: string) => {
|
||||
await page.goto(base + path, { waitUntil: 'commit' });
|
||||
await page.locator('button[data-theme-ready="true"]').first().waitFor();
|
||||
await page.waitForFunction(expected => document.documentElement.dataset.theme === expected, theme);
|
||||
};
|
||||
const background = (selector: string) => page.locator(selector).first().evaluate(el => getComputedStyle(el).backgroundColor);
|
||||
await visit('/', 'home-light');
|
||||
assert.equal(await background('body'), 'rgb(255, 246, 239)');
|
||||
assert.ok((await page.title()).includes('啡跃'));
|
||||
assert.ok((await page.locator('link[rel="icon"]').all()).length >= 2);
|
||||
assert.equal(await page.locator('.endoleap-mark-light').first().isVisible(), true);
|
||||
await page.getByRole('button', { name: '切换明暗主题', exact: true }).first().click();
|
||||
await page.waitForFunction(() => document.documentElement.dataset.theme === 'home-dark');
|
||||
assert.equal(await background('body'), 'rgb(28, 24, 22)');
|
||||
assert.equal(await page.locator('.endoleap-mark-dark').first().isVisible(), true);
|
||||
await visit('/account', 'home-dark');
|
||||
if (process.env.VERIFY_CANVAS_UI === '1') {
|
||||
await visit('/graphic', 'canvas-dark');
|
||||
assert.equal(await background('body'), 'rgb(20, 20, 20)');
|
||||
assert.equal(await page.locator('[class*="boardWrap"] > div').first().evaluate(el => getComputedStyle(el).backgroundColor), 'rgb(255, 255, 255)', 'artwork stays white in dark chrome');
|
||||
await page.getByRole('button', { name: '切换明暗主题', exact: true }).first().click();
|
||||
await page.waitForFunction(() => document.documentElement.dataset.theme === 'canvas-light');
|
||||
await visit('/infinite_canvas', 'canvas-light');
|
||||
assert.equal(await background('[class*="viewport"]'), 'rgb(250, 250, 250)');
|
||||
} else {
|
||||
await page.getByRole('button', { name: '切换明暗主题', exact: true }).first().click();
|
||||
}
|
||||
await visit('/', 'home-light');
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
assert.equal(await page.locator('.endoleap-mark-light').first().isVisible(), true);
|
||||
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1), 'mobile home has no horizontal overflow');
|
||||
console.log('Endoleap logos, both favicon paths, persisted home/canvas themes and artwork color isolation passed.');
|
||||
} finally { await browser.close(); }
|
||||
}
|
||||
@@ -115,7 +115,7 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
|
||||
await page
|
||||
.getByRole("heading", { name: authored.title, exact: true })
|
||||
.waitFor();
|
||||
assert.equal(await page.title(), "社区文档 · 织页");
|
||||
assert.equal(await page.title(), "社区文档 · 啡跃");
|
||||
const search = page.getByRole("textbox", { name: "搜索文档" });
|
||||
await search.fill("不存在的文档");
|
||||
await search.press("Enter");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {verifyBrandUI} from './brand-ui-integration';
|
||||
import {verifyCanvasWorkspace} from './canvas-integration';
|
||||
import {verifyCanvasAgentUI} from './canvas-ui-integration';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -33,6 +34,7 @@ test('real PostgreSQL + S3 notes, flat tags, resource sharing and video processi
|
||||
try{
|
||||
let ready=false;for(let i=0;i<60;i++){try{if((await fetch(base+'/api/health')).ok){ready=true;break;}}catch{}await setTimeout(250);}assert.ok(ready);
|
||||
for(const route of ['/','/images','/videos','/audio','/articles','/motion','/library/import','/tools/doodle','/tools/skills','/tools/skills/street-people','/tools/skills/shadow-puppet'])assert.equal((await fetch(base+route)).status,200,route);
|
||||
await verifyBrandUI(base);
|
||||
await verifyEmailAccounts();
|
||||
await verifyCanvasWorkspace(base);
|
||||
if(process.env.VERIFY_CANVAS_UI==='1')await verifyCanvasAgentUI(base);
|
||||
|
||||
Reference in New Issue
Block a user