Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a45d43f5f7 | |||
| 5b68c5b84e | |||
| 5c068ace81 | |||
| f4397db869 | |||
| 9e5c5abbdf | |||
| 8b949484c1 |
@@ -20,7 +20,9 @@ const fs=require('node:fs/promises');
|
|||||||
async function unobstructed(id){const box=await node(id).boundingBox();assert.ok(box);for(const card of (await snapshot()).cards.filter(n=>n.id!==id)){const other=await node(card.id).boundingBox();assert.ok(other);assert.equal(box.x<other.x+other.width&&box.x+box.width>other.x&&box.y<other.y+other.height&&box.y+box.height>other.y,false,`${id} overlaps ${card.id}`)}}
|
async function unobstructed(id){const box=await node(id).boundingBox();assert.ok(box);for(const card of (await snapshot()).cards.filter(n=>n.id!==id)){const other=await node(card.id).boundingBox();assert.ok(other);assert.equal(box.x<other.x+other.width&&box.x+box.width>other.x&&box.y<other.y+other.height&&box.y+box.height>other.y,false,`${id} overlaps ${card.id}`)}}
|
||||||
const close=(a,b)=>assert.ok(Math.abs(a-b)<2,`${a} ≈ ${b}`);
|
const close=(a,b)=>assert.ok(Math.abs(a-b)<2,`${a} ≈ ${b}`);
|
||||||
async function drag(handle,dx,dy){const b=await handle.boundingBox();assert.ok(b);await page.mouse.move(b.x+b.width/2,b.y+b.height/2);await page.mouse.down();await page.mouse.move(b.x+b.width/2+dx,b.y+b.height/2+dy,{steps:12});await page.mouse.up()}
|
async function drag(handle,dx,dy){const b=await handle.boundingBox();assert.ok(b);await page.mouse.move(b.x+b.width/2,b.y+b.height/2);await page.mouse.down();await page.mouse.move(b.x+b.width/2+dx,b.y+b.height/2+dy,{steps:12});await page.mouse.up()}
|
||||||
await page.goto(base+'/infinite_canvas');
|
const canvasResponse=await page.goto(base+'/infinite_canvas',{waitUntil:'commit',timeout:60000});
|
||||||
|
assert.ok(canvasResponse?.ok(),'Canvas document returns HTTP success');
|
||||||
|
await page.locator('button[data-theme-ready="true"]').waitFor();
|
||||||
await page.getByRole('button',{name:'从示例开始 ↗',exact:true}).click();
|
await page.getByRole('button',{name:'从示例开始 ↗',exact:true}).click();
|
||||||
await page.getByRole('button',{name:'适应画布',exact:true}).click();
|
await page.getByRole('button',{name:'适应画布',exact:true}).click();
|
||||||
await content('brief').click({position:{x:20,y:20}});
|
await content('brief').click({position:{x:20,y:20}});
|
||||||
@@ -99,7 +101,7 @@ const fs=require('node:fs/promises');
|
|||||||
const anchorBefore=await worldAt();await page.mouse.move(1450,150);await page.keyboard.down('Control');await page.mouse.wheel(0,-80);await page.keyboard.up('Control');
|
const anchorBefore=await worldAt();await page.mouse.move(1450,150);await page.keyboard.down('Control');await page.mouse.wheel(0,-80);await page.keyboard.up('Control');
|
||||||
await page.waitForFunction(z=>new DOMMatrix(getComputedStyle(document.querySelector('[class*=world]')).transform).a!==z,anchorBefore.z);
|
await page.waitForFunction(z=>new DOMMatrix(getComputedStyle(document.querySelector('[class*=world]')).transform).a!==z,anchorBefore.z);
|
||||||
const anchorAfter=await worldAt();close(anchorBefore.x,anchorAfter.x);close(anchorBefore.y,anchorAfter.y);
|
const anchorAfter=await worldAt();close(anchorBefore.x,anchorAfter.x);close(anchorBefore.y,anchorAfter.y);
|
||||||
const saved=await snapshot();await page.reload();await page.waitForFunction(()=>!!localStorage.getItem('studio.infinite-canvas.v1'));assert.deepEqual(await snapshot(),saved);
|
const saved=await snapshot();await page.reload({waitUntil:'commit',timeout:60000});await page.locator('button[data-theme-ready="true"]').waitFor();await page.waitForFunction(()=>!!localStorage.getItem('studio.infinite-canvas.v1'));assert.deepEqual(await snapshot(),saved);
|
||||||
const themeToggle=page.getByRole('button',{name:'切换明暗主题',exact:true});
|
const themeToggle=page.getByRole('button',{name:'切换明暗主题',exact:true});
|
||||||
await page.waitForFunction(()=>document.querySelector('[data-theme-ready]')?.dataset.themeReady==='true');
|
await page.waitForFunction(()=>document.querySelector('[data-theme-ready]')?.dataset.themeReady==='true');
|
||||||
const initialMode=await page.evaluate(()=>document.documentElement.dataset.mode);
|
const initialMode=await page.evaluate(()=>document.documentElement.dataset.mode);
|
||||||
|
|||||||
@@ -48,9 +48,11 @@ export const useGuidanceAccount = () => useContext(AccountContext);
|
|||||||
export default function GuidanceShell({
|
export default function GuidanceShell({
|
||||||
children,
|
children,
|
||||||
title = "探索文档",
|
title = "探索文档",
|
||||||
|
standalone = false,
|
||||||
}: {
|
}: {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
standalone?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const dialog = useRef<HTMLDialogElement>(null);
|
const dialog = useRef<HTMLDialogElement>(null);
|
||||||
@@ -187,6 +189,19 @@ export default function GuidanceShell({
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (standalone) return (
|
||||||
|
<AccountContext.Provider value={{ user, loading, error, refresh }}>
|
||||||
|
<div className={s.accountPage}>
|
||||||
|
<Head><title>{`${title} · 啡跃`}</title></Head>
|
||||||
|
<a className={s.skipLink} href="#account-content">跳到正文</a>
|
||||||
|
<header className={s.accountHeader}>
|
||||||
|
<Link href="/" aria-label="啡跃首页"><Brand /></Link>
|
||||||
|
<div><Link href="/">返回首页</Link><ThemeToggle /></div>
|
||||||
|
</header>
|
||||||
|
<main id="account-content">{children}</main>
|
||||||
|
</div>
|
||||||
|
</AccountContext.Provider>
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<AccountContext.Provider value={{ user, loading, error, refresh }}>
|
<AccountContext.Provider value={{ user, loading, error, refresh }}>
|
||||||
<div className={s.site}>
|
<div className={s.site}>
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ export function ThemeToggle() {
|
|||||||
const [dark, setDark] = useState(false);
|
const [dark, setDark] = useState(false);
|
||||||
const [ready, setReady] = useState(false);
|
const [ready, setReady] = useState(false);
|
||||||
useEffect(() => { const sync = () => setDark(document.documentElement.dataset.mode === 'dark'); sync(); setReady(true); window.addEventListener('endoleap-theme', sync); return () => window.removeEventListener('endoleap-theme', sync); }, []);
|
useEffect(() => { const sync = () => setDark(document.documentElement.dataset.mode === 'dark'); sync(); setReady(true); window.addEventListener('endoleap-theme', sync); return () => window.removeEventListener('endoleap-theme', sync); }, []);
|
||||||
return <button type="button" data-theme-ready={ready} className="endoleap-theme-toggle" aria-label="切换明暗主题" title={dark ? '切换浅色模式' : '切换深色模式'} onClick={() => { const mode = document.documentElement.dataset.mode === 'dark' ? 'light' : 'dark'; const scope = document.documentElement.dataset.theme?.startsWith('canvas-') ? 'canvas' : 'home'; document.documentElement.dataset.mode = mode; document.documentElement.dataset.theme = `${scope}-${mode}`; try { localStorage.setItem('endoleap.theme', mode); } catch {} window.dispatchEvent(new Event('endoleap-theme')); }}>◐<span>{dark ? '浅色' : '深色'}</span></button>;
|
return <button type="button" data-theme-ready={ready} className="endoleap-theme-toggle" aria-label="切换明暗主题" title={dark ? '切换浅色模式' : '切换深色模式'} onClick={() => { const mode = document.documentElement.dataset.mode === 'dark' ? 'light' : 'dark'; const scope = document.documentElement.dataset.theme?.startsWith('canvas-') ? 'canvas' : 'home'; document.documentElement.dataset.mode = mode; document.documentElement.dataset.theme = `${scope}-${mode}`; try { localStorage.setItem('endoleap.theme', mode); } catch {} window.dispatchEvent(new Event('endoleap-theme')); }}><span aria-hidden="true">◐</span></button>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function localNext(value: string | string[] | undefined) {
|
|||||||
}
|
}
|
||||||
export default function AccountPage() {
|
export default function AccountPage() {
|
||||||
return (
|
return (
|
||||||
<GuidanceShell title="邮箱账户">
|
<GuidanceShell title="登录与注册" standalone>
|
||||||
<AccountContent />
|
<AccountContent />
|
||||||
</GuidanceShell>
|
</GuidanceShell>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ body{margin:0}
|
|||||||
[data-theme$="-dark"] .endoleap-mark-dark{display:block!important}
|
[data-theme$="-dark"] .endoleap-mark-dark{display:block!important}
|
||||||
.endoleap-wordmark{display:flex!important;flex-direction:column;font-size:17px!important;color:var(--foreground-strong)!important;letter-spacing:.02em!important;margin:0!important;gap:3px}
|
.endoleap-wordmark{display:flex!important;flex-direction:column;font-size:17px!important;color:var(--foreground-strong)!important;letter-spacing:.02em!important;margin:0!important;gap:3px}
|
||||||
.endoleap-wordmark small{display:block;font-size:9px;font-weight:500;letter-spacing:.08em;color:var(--muted-foreground)}
|
.endoleap-wordmark small{display:block;font-size:9px;font-weight:500;letter-spacing:.08em;color:var(--muted-foreground)}
|
||||||
button.endoleap-theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:5px;border:1px solid var(--border);background:var(--surface);color:var(--foreground);border-radius:8px;padding:7px 9px;font-size:12px;line-height:1.2;flex-shrink:0;cursor:pointer}
|
button.endoleap-theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:5px;border:0;background:transparent;color:var(--muted-foreground);border-radius:8px;padding:8px;width:32px;height:32px;font-size:16px;line-height:1.2;flex-shrink:0;cursor:pointer}
|
||||||
button.endoleap-theme-toggle:hover{background:var(--row-hover)}
|
button.endoleap-theme-toggle:hover{background:var(--row-hover)}
|
||||||
:where(a,button,input,textarea,select):focus-visible{outline:2px solid var(--ring);outline-offset:3px}
|
:where(a,button,input,textarea,select):focus-visible{outline:2px solid var(--ring);outline-offset:3px}
|
||||||
::selection{background:var(--selection);color:var(--foreground)}
|
::selection{background:var(--selection);color:var(--foreground)}
|
||||||
@media(max-width:600px){.endoleap-theme-toggle span{display:none}.endoleap-brand{gap:5px}.endoleap-brand .endoleap-mark{width:26px;height:26px}.endoleap-wordmark{font-size:14px!important}}
|
@media(max-width:600px){.endoleap-theme-toggle span{display:inline}.endoleap-brand{gap:5px}.endoleap-brand .endoleap-mark{width:26px;height:26px}.endoleap-wordmark{font-size:14px!important}}
|
||||||
|
|
||||||
button:disabled{cursor:default}
|
button:disabled{cursor:default}
|
||||||
input,textarea,select{accent-color:var(--primary)}
|
input,textarea,select{accent-color:var(--primary)}
|
||||||
|
|||||||
@@ -2380,3 +2380,14 @@
|
|||||||
.primaryButton,.primaryButton:hover{color:var(--primary-foreground);background:var(--primary)}
|
.primaryButton,.primaryButton:hover{color:var(--primary-foreground);background:var(--primary)}
|
||||||
.primaryButton:hover{background:var(--primary-hover)}
|
.primaryButton:hover{background:var(--primary-hover)}
|
||||||
.primaryButton:disabled{background:var(--disabled-background);color:var(--disabled-foreground)}
|
.primaryButton:disabled{background:var(--disabled-background);color:var(--disabled-foreground)}
|
||||||
|
|
||||||
|
/* Authentication has its own public page, without workspace navigation. */
|
||||||
|
.accountPage { min-height: 100vh; background: var(--background); color: var(--foreground); }
|
||||||
|
.accountHeader { max-width: 1200px; margin: 0 auto; padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
|
||||||
|
.accountHeader a { color: var(--muted-foreground); text-decoration: none; }
|
||||||
|
.accountHeader > div { display: flex; align-items: center; gap: 20px; font-size: 13px; }
|
||||||
|
.accountPage > main { max-width: 1120px; margin: 0 auto; padding: 48px 32px 72px; }
|
||||||
|
@media (max-width: 650px) {
|
||||||
|
.accountHeader { padding: 20px; }
|
||||||
|
.accountPage > main { padding: 20px 20px 48px; }
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export async function navigateBrandDocument(navigate, url, now = Date.now) {
|
|||||||
}
|
}
|
||||||
throw new Error(`Document navigation failed: ${url}, HTTP ${status ?? 'no response'}`);
|
throw new Error(`Document navigation failed: ${url}, HTTP ${status ?? 'no response'}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (attempt === 1 && /ECONNRESET|net::ERR_(?:CONNECTION_RESET|CONNECTION_CLOSED|EMPTY_RESPONSE)/.test(String(error))) {
|
if (attempt === 1 && /ECONNRESET|net::ERR_(?:CONNECTION_RESET|CONNECTION_CLOSED|EMPTY_RESPONSE|ABORTED)/.test(String(error))) {
|
||||||
console.warn('Brand navigation connection recovery', JSON.stringify({url, error: String(error), attempt}));
|
console.warn('Brand navigation connection recovery', JSON.stringify({url, error: String(error), attempt}));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,15 @@ test('one proxy failure can recover within the original deadline', async () => {
|
|||||||
}, '/canvas', () => elapsed);
|
}, '/canvas', () => elapsed);
|
||||||
assert.deepEqual(timeouts, [60000, 45000]);
|
assert.deepEqual(timeouts, [60000, 45000]);
|
||||||
});
|
});
|
||||||
test('connection reset can recover once', async () => {
|
test('connection reset and interrupted bootstrap scripts can recover once', async () => {
|
||||||
let calls = 0;
|
for(const failure of ['net::ERR_CONNECTION_RESET','Document bootstrap script request failed: net::ERR_ABORTED']){
|
||||||
await navigateBrandDocument(async () => {
|
let calls = 0;
|
||||||
if (++calls === 1) throw new Error('net::ERR_CONNECTION_RESET');
|
await navigateBrandDocument(async () => {
|
||||||
return response(200);
|
if (++calls === 1) throw new Error(failure);
|
||||||
}, '/canvas');
|
return response(200);
|
||||||
assert.equal(calls, 2);
|
}, '/canvas');
|
||||||
|
assert.equal(calls, 2);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
test('persistent server failure is not hidden', async () => {
|
test('persistent server failure is not hidden', async () => {
|
||||||
let calls = 0;
|
let calls = 0;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** CI-only checks against the disposable stack, never against personal documents. */
|
/** CI-only checks against the disposable stack, never against personal documents. */
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import { chromium } from 'playwright-core';
|
import { chromium, type Request } from 'playwright-core';
|
||||||
import { navigateBrandDocument } from './brand-navigation.mjs';
|
import { navigateBrandDocument } from './brand-navigation.mjs';
|
||||||
export async function verifyBrandUI(base: string) {
|
export async function verifyBrandUI(base: string) {
|
||||||
for (const prefix of process.env.VERIFY_CANVAS_UI === '1' ? ['', '/studio'] : ['']) {
|
for (const prefix of process.env.VERIFY_CANVAS_UI === '1' ? ['', '/studio'] : ['']) {
|
||||||
@@ -19,18 +19,34 @@ export async function verifyBrandUI(base: string) {
|
|||||||
try {
|
try {
|
||||||
const page = await browser.newPage({ viewport: { width: 1440, height: 960 } });
|
const page = await browser.newPage({ viewport: { width: 1440, height: 960 } });
|
||||||
page.setDefaultTimeout(60000);page.setDefaultNavigationTimeout(60000);
|
page.setDefaultTimeout(60000);page.setDefaultNavigationTimeout(60000);
|
||||||
const failures: string[] = [];
|
const failures: string[] = [], scripts: {path:string;status?:number;ms:number;error?:string}[] = [];
|
||||||
|
const scriptStarted = new WeakMap<Request,number>();
|
||||||
|
page.on('request', request => { if(request.resourceType()==='script') scriptStarted.set(request,Date.now()); });
|
||||||
|
page.on('response', response => { if(response.request().resourceType()==='script') { scripts.push({path:new URL(response.url()).pathname,status:response.status(),ms:Date.now()-(scriptStarted.get(response.request())??Date.now())}); if(scripts.length>24)scripts.shift(); } });
|
||||||
page.on('pageerror', error => failures.push(error.message));
|
page.on('pageerror', error => failures.push(error.message));
|
||||||
page.on('requestfailed', request => failures.push(new URL(request.url()).pathname + ': ' + request.failure()?.errorText));
|
page.on('requestfailed', request => { failures.push(new URL(request.url()).pathname + ': ' + request.failure()?.errorText); if(request.resourceType()==='script') scripts.push({path:new URL(request.url()).pathname,ms:Date.now()-(scriptStarted.get(request)??Date.now()),error:request.failure()?.errorText}); });
|
||||||
const visit = async (path: string, theme: string) => {
|
const visit = async (path: string, theme: string) => {
|
||||||
const started = Date.now();
|
const started = Date.now();
|
||||||
try {
|
try {
|
||||||
await navigateBrandDocument(timeout => page.goto(base + path, { waitUntil: 'commit', timeout }), base + path);
|
// DOMContentLoaded also waits for this document's deferred scripts, unlike commit.
|
||||||
|
await navigateBrandDocument(async timeout => {
|
||||||
|
const attemptStarted=Date.now(), bootstrapFailures:string[]=[];
|
||||||
|
const failed=(request:Request)=>{
|
||||||
|
if(request.resourceType()==='script'&&(scriptStarted.get(request)??0)>=attemptStarted)
|
||||||
|
bootstrapFailures.push(request.failure()?.errorText||'unknown script failure');
|
||||||
|
};
|
||||||
|
page.on('requestfailed',failed);
|
||||||
|
try {
|
||||||
|
const response=await page.goto(base+path,{waitUntil:'domcontentloaded',timeout});
|
||||||
|
if(response?.ok()&&bootstrapFailures.length)throw new Error('Document bootstrap script request failed: '+bootstrapFailures.join('; '));
|
||||||
|
return response;
|
||||||
|
} finally {page.off('requestfailed',failed);}
|
||||||
|
}, base + path);
|
||||||
await page.locator('button[data-theme-ready="true"]').first().waitFor();
|
await page.locator('button[data-theme-ready="true"]').first().waitFor();
|
||||||
await page.waitForFunction(expected => document.documentElement.dataset.theme === expected, theme);
|
await page.waitForFunction(expected => document.documentElement.dataset.theme === expected, theme);
|
||||||
console.log('Brand UI route ready:', path, theme, Date.now() - started);
|
console.log('Brand UI route ready:', path, theme, Date.now() - started);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Brand UI navigation diagnostics', JSON.stringify({path, url:page.url(), elapsedMs:Date.now()-started, failures:failures.slice(-20), body:(await page.locator('body').innerText({timeout:3000}).catch(()=>'unavailable')).slice(0,1200)}));
|
console.error('Brand UI navigation diagnostics', JSON.stringify({path, url:page.url(), elapsedMs:Date.now()-started, failures:failures.slice(-20), scripts:scripts.slice(-24), controls:await page.locator('[data-theme-ready]').evaluateAll(elements=>elements.map(el=>({ready:el.getAttribute('data-theme-ready'),display:getComputedStyle(el).display}))), body:(await page.locator('body').innerText({timeout:3000}).catch(()=>'unavailable')).slice(0,1200)}));
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ export async function verifyGuidancePublishing(base:string){
|
|||||||
assert.equal(await page.getByText('没有匹配文档',{exact:false}).count(),0);
|
assert.equal(await page.getByText('没有匹配文档',{exact:false}).count(),0);
|
||||||
await page.reload({waitUntil:'commit'});
|
await page.reload({waitUntil:'commit'});
|
||||||
await page.getByRole('status').filter({hasText:'找到 2 篇文档'}).waitFor();
|
await page.getByRole('status').filter({hasText:'找到 2 篇文档'}).waitFor();
|
||||||
|
// The matching count can also describe the unfiltered list before router hydration.
|
||||||
|
await page.waitForFunction(title=>document.querySelector<HTMLInputElement>('input[aria-label="搜索文档"]')?.value===title,httpDoc.title);
|
||||||
assert.equal(await search.inputValue(),httpDoc.title);
|
assert.equal(await search.inputValue(),httpDoc.title);
|
||||||
await page.getByRole('tab',{name:/事实依据/}).click();
|
await page.getByRole('tab',{name:/事实依据/}).click();
|
||||||
await page.waitForURL(url=>url.searchParams.get('kind')==='evidence',{waitUntil:'commit'});
|
await page.waitForURL(url=>url.searchParams.get('kind')==='evidence',{waitUntil:'commit'});
|
||||||
@@ -63,6 +65,7 @@ export async function verifyGuidancePublishing(base:string){
|
|||||||
await page.getByRole('button',{name:'清除所有筛选'}).click();
|
await page.getByRole('button',{name:'清除所有筛选'}).click();
|
||||||
await page.waitForURL(url=>url.search==='',{waitUntil:'commit'});
|
await page.waitForURL(url=>url.search==='',{waitUntil:'commit'});
|
||||||
await page.locator(link).waitFor({state:'visible'});
|
await page.locator(link).waitFor({state:'visible'});
|
||||||
|
await page.waitForFunction(()=>document.querySelector<HTMLInputElement>('input[aria-label="搜索文档"]')?.value==='');
|
||||||
assert.equal(await search.inputValue(),'');
|
assert.equal(await search.inputValue(),'');
|
||||||
await page.getByRole('navigation',{name:'主导航',exact:true}).getByRole('link',{name:'社区文档',exact:true}).click();await page.locator(link).waitFor({state:'visible'});
|
await page.getByRole('navigation',{name:'主导航',exact:true}).getByRole('link',{name:'社区文档',exact:true}).click();await page.locator(link).waitFor({state:'visible'});
|
||||||
await page.locator(link).click();
|
await page.locator(link).click();
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
|
|||||||
try {
|
try {
|
||||||
const navigation = await (reload ? page.reload({waitUntil:"commit"}) : page.goto(url,{waitUntil:"commit"}));
|
const navigation = await (reload ? page.reload({waitUntil:"commit"}) : page.goto(url,{waitUntil:"commit"}));
|
||||||
assert.ok(navigation?.ok(), "Navigation returns a successful document");
|
assert.ok(navigation?.ok(), "Navigation returns a successful document");
|
||||||
await page.getByText(signedIn ? "editor@example.com" : "登录你的账户",{exact:true}).first().waitFor({state:"attached"});
|
if (new URL(url).pathname === "/account") {
|
||||||
|
await page.getByRole("heading", { name: signedIn ? "你的账户" : "欢迎回来", exact: true }).waitFor();
|
||||||
|
} else {
|
||||||
|
await page.getByText(signedIn ? "editor@example.com" : "登录你的账户",{exact:true}).first().waitFor({state:"attached"});
|
||||||
|
}
|
||||||
assert.ok(sessionReplies > previousSessionReplies, "The new document requests its account fixture and renders the resulting account state");
|
assert.ok(sessionReplies > previousSessionReplies, "The new document requests its account fixture and renders the resulting account state");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const probeStarted=Date.now();
|
const probeStarted=Date.now();
|
||||||
@@ -125,6 +129,7 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
|
|||||||
.waitFor();
|
.waitFor();
|
||||||
await navigate(page.url(), true);
|
await navigate(page.url(), true);
|
||||||
await page.getByRole("heading",{name:"没有匹配文档",exact:true}).waitFor();
|
await page.getByRole("heading",{name:"没有匹配文档",exact:true}).waitFor();
|
||||||
|
await page.waitForFunction(() => document.querySelector<HTMLInputElement>('input[aria-label="搜索文档"]')?.value === "不存在的文档");
|
||||||
assert.equal(await search.inputValue(), "不存在的文档");
|
assert.equal(await search.inputValue(), "不存在的文档");
|
||||||
await page
|
await page
|
||||||
.getByRole("button", { name: "清除所有筛选", exact: true })
|
.getByRole("button", { name: "清除所有筛选", exact: true })
|
||||||
@@ -154,6 +159,9 @@ export async function verifyGuidanceWorkspaceUI(base: string, browser: Browser)
|
|||||||
fullPage: true,
|
fullPage: true,
|
||||||
});
|
});
|
||||||
await navigate(base + "/account");
|
await navigate(base + "/account");
|
||||||
|
assert.equal(await page.getByRole("complementary").count(), 0, "Account page has no workspace sidebar");
|
||||||
|
assert.equal(await page.getByRole("link", { name: "创建文档", exact: true }).count(), 0);
|
||||||
|
await page.getByRole("link", { name: "返回首页", exact: true }).waitFor();
|
||||||
await page.getByRole("button", { name: "创建账户", exact: true }).click();
|
await page.getByRole("button", { name: "创建账户", exact: true }).click();
|
||||||
await page.getByRole("heading", { name: "创建你的账户" }).waitFor();
|
await page.getByRole("heading", { name: "创建你的账户" }).waitFor();
|
||||||
await page
|
await page
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ for repository in creative-studio-review creative-wiki-tests creative-wiki-revie
|
|||||||
echo "Keeping container-referenced review image: $tag"
|
echo "Keeping container-referenced review image: $tag"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
docker image rm "$tag"
|
# Preserve parent layers so unchanged dependency installs stay cached.
|
||||||
|
docker image rm --no-prune "$tag"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ class ReviewCleanupTests(unittest.TestCase):
|
|||||||
'DOCKER_CALLS': str(calls), 'REVIEW_SHA': sha, **extra})
|
'DOCKER_CALLS': str(calls), 'REVIEW_SHA': sha, **extra})
|
||||||
return result.returncode, [json.loads(line) for line in calls.read_text().splitlines()] if calls.exists() else []
|
return result.returncode, [json.loads(line) for line in calls.read_text().splitlines()] if calls.exists() else []
|
||||||
|
|
||||||
def test_removes_only_exact_review_tags_without_force(self):
|
def test_removes_only_exact_review_tags_without_force_and_keeps_parent_cache(self):
|
||||||
code, calls = self.run_cleanup()
|
code, calls = self.run_cleanup()
|
||||||
self.assertEqual(code, 0)
|
self.assertEqual(code, 0)
|
||||||
self.assertEqual([args for args in calls if args[:2] == ['image', 'rm']], [
|
self.assertEqual([args for args in calls if args[:2] == ['image', 'rm']], [
|
||||||
['image', 'rm', name + ':' + SHA] for name in
|
['image', 'rm', '--no-prune', name + ':' + SHA] for name in
|
||||||
['creative-studio-review', 'creative-wiki-tests', 'creative-wiki-review']])
|
['creative-studio-review', 'creative-wiki-tests', 'creative-wiki-review']])
|
||||||
self.assertFalse(any('-f' in args or 'prune' in args or 'volume' in args for args in calls))
|
self.assertFalse(any('-f' in args or 'prune' in args or 'volume' in args for args in calls))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user