docs: [verified] answer the six-month AI Architect assignment
Build and publish Eldorado documentation / build (pull_request) Successful in 1m30s
Build and publish Eldorado documentation / build (pull_request) Successful in 1m30s
This commit is contained in:
1 parent
88a4375776
commit
1a2d16bc91
53 files changed
+974
-390
No files matched your search
@@ -131,6 +131,9 @@ function inspectTypography({mobile}) {
|
||||
for (const width of [1440,390,320]) {
|
||||
const page = await browser.newPage({viewport:{width,height:1000}});
|
||||
await page.goto(`${base}/eldorado-v1/documentation/strategy/target-operating-model/`,{waitUntil:'networkidle'});
|
||||
await page.addStyleTag({content:'html {scroll-behavior:auto !important;}'});
|
||||
await page.getByText('Conditional long-term Target operating model — not the six-month promise',{exact:true}).focus();
|
||||
await page.keyboard.press('Enter');
|
||||
const panel = page.locator('[data-diagram="strategy-target"]');
|
||||
const iframe = panel.locator(`:scope > .story-${width > 700 ? 'desktop' : 'mobile'}`);
|
||||
await iframe.scrollIntoViewIfNeeded();
|
||||
@@ -141,10 +144,11 @@ function inspectTypography({mobile}) {
|
||||
await page.screenshot({path:`${output}/${width}-inline.png`,fullPage:true});
|
||||
const exported = [];
|
||||
for (const theme of ['light','dark']) {
|
||||
if (await frame.locator('html').getAttribute('data-theme') !== theme) await frame.locator('#btn-theme').click();
|
||||
if (await frame.locator('html').getAttribute('data-theme') !== theme) {await frame.locator('#btn-theme').focus(); await page.keyboard.press('Enter');}
|
||||
await frame.waitForFunction(t => document.documentElement.dataset.theme === t, theme);
|
||||
await frame.locator('#btn-export').click();
|
||||
const [download] = await Promise.all([page.waitForEvent('download'),frame.locator('[data-format="svg"]').click()]);
|
||||
await frame.locator('#btn-export').focus(); await page.keyboard.press('Enter');
|
||||
await frame.locator('[data-format="svg"]').focus();
|
||||
const [download] = await Promise.all([page.waitForEvent('download'),page.keyboard.press('Enter')]);
|
||||
assert.equal(await download.failure(),null);
|
||||
const path = `${output}/${width}-${theme}.svg`;
|
||||
await download.saveAs(path);
|
||||
@@ -157,6 +161,10 @@ function inspectTypography({mobile}) {
|
||||
const typography = await standalone.evaluate(inspectTypography,{mobile:width < 700});
|
||||
assert.deepEqual(geometry.errors,[]);
|
||||
assert.deepEqual(typography.errors,[]);
|
||||
assert(await standalone.locator('#eldorado-target-caption').evaluate(g=>{
|
||||
const v=g.ownerSVGElement.viewBox.baseVal;
|
||||
return [...g.querySelectorAll('text')].every(t=>{const b=t.getBBox();return b.x>=v.x&&b.y>=v.y&&b.x+b.width<=v.x+v.width&&b.y+b.height<=v.y+v.height;});
|
||||
}), 'Standalone proposed caption must fit the complete canvas');
|
||||
const background = await standalone.locator('rect.c-bg-rect').evaluate(n => getComputedStyle(n).fill);
|
||||
if (exported.length) assert.notEqual(background,exported[0].background,'standalone theme must change');
|
||||
// CDP captures SVG documents without Playwright's HTML-body screenshot wait.
|
||||
@@ -167,7 +175,7 @@ function inspectTypography({mobile}) {
|
||||
exported.push({theme,background,geometry,typography});
|
||||
await standalone.close();
|
||||
}
|
||||
await panel.getByRole('button',{name:/^Expand /}).click();
|
||||
await panel.getByRole('button',{name:/^Expand /}).focus(); await page.keyboard.press('Enter');
|
||||
const full = await (await panel.locator('dialog iframe').elementHandle()).contentFrame();
|
||||
await full.locator('svg[role="img"]').waitFor();
|
||||
// The existing fullscreen viewer always opens the radial desktop source.
|
||||
|
||||
Reference in new issue
Block a user