docs: [verified] move metric contracts under Measurement
Build and publish Eldorado documentation / build (pull_request) Successful in 41s
Build and publish Eldorado documentation / build (pull_request) Successful in 41s
This commit is contained in:
1 parent
b9c2047c61
commit
85852f0744
45 files changed
+1101
-433
No files matched your search
@@ -0,0 +1,79 @@
|
||||
const {chromium} = require('playwright');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
(async () => {
|
||||
const base = process.argv[2] || 'http://127.0.0.1:4173';
|
||||
const prefix = '/eldorado-v1/documentation';
|
||||
const manifest = JSON.parse(fs.readFileSync('research/ai-adoption/measurement-migration.json','utf8'));
|
||||
const output = `.cache/metric-pages-${process.argv[3] || 'local'}`;
|
||||
fs.mkdirSync(output,{recursive:true});
|
||||
const browser = await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE,args:['--no-sandbox']});
|
||||
const results = [];
|
||||
try {
|
||||
for (const width of [1440,390]) {
|
||||
const context = await browser.newContext({viewport:{width,height:900}});
|
||||
try {
|
||||
const page = await context.newPage();
|
||||
const errors = [];
|
||||
page.on('pageerror',e => errors.push(e.message));
|
||||
for (const m of manifest.metrics) {
|
||||
const url = `${base}${prefix}${m.url}`;
|
||||
assert.equal((await page.goto(url,{waitUntil:'networkidle'})).status(),200);
|
||||
assert.equal(await page.locator('article h1').innerText(),m.title);
|
||||
assert.equal(await page.locator('link[rel="canonical"]').getAttribute('href'),`https://pages.apps.lego-cloud.eu${prefix}${m.url}`);
|
||||
const table = page.locator('article table');
|
||||
assert.equal(await table.count(),1);
|
||||
assert.equal(await table.locator('tbody tr').count(),11);
|
||||
const article = await page.locator('article').innerText();
|
||||
assert(article.includes(m.status === 'prototype' ? 'Prototype calculation' : 'Unimplemented metric'));
|
||||
assert(article.includes('no live telemetry'));
|
||||
assert.equal(await page.locator('.breadcrumbs a').filter({hasText:'Measurement'}).getAttribute('href'),`${prefix}/strategy/measurement/`);
|
||||
assert(!await page.evaluate(() => document.documentElement.scrollWidth > innerWidth));
|
||||
await page.goto(`${base}${prefix}/strategy/reference/measurement-contracts/#${m.oldAnchor}`,{waitUntil:'networkidle'});
|
||||
await page.waitForURL(url);
|
||||
await page.locator('article h1').waitFor();
|
||||
results.push({width,metric:m.oldAnchor,canonical:true,redirect:true,fields:11});
|
||||
}
|
||||
for (const suffix of ['', '#unknown-anchor', '#__proto__']) {
|
||||
await page.goto(`${base}${prefix}/strategy/reference/measurement-contracts/${suffix}`,{waitUntil:'networkidle'});
|
||||
await page.waitForURL(`${base}${prefix}/strategy/measurement/`);
|
||||
}
|
||||
for (const [anchor,target] of [
|
||||
['collection-and-safeguards','collection-and-safeguards/'],
|
||||
['decide-what-counts-before-counting','collection-and-safeguards/#decide-what-counts-before-counting'],
|
||||
['baseline-and-interpretation','collection-and-safeguards/#baseline-and-interpretation'],
|
||||
['event-and-privacy-contract','collection-and-safeguards/#event-and-privacy-contract'],
|
||||
['run-the-synthetic-measurement-example','synthetic-example/'],
|
||||
['metric-contracts','#metric-definitions'],
|
||||
]) {
|
||||
await page.goto(`${base}${prefix}/strategy/reference/measurement-contracts/#${anchor}`,{waitUntil:'networkidle'});
|
||||
await page.waitForURL(`${base}${prefix}/strategy/measurement/${target}`);
|
||||
if (target.includes('#')) await page.locator(`#${target.split('#')[1]}`).waitFor();
|
||||
}
|
||||
await page.goto(`${base}${prefix}/strategy/measurement/supported-bundle-coverage/`,{waitUntil:'networkidle'});
|
||||
await page.locator('.breadcrumbs a').filter({hasText:'Measurement'}).click();
|
||||
await page.waitForURL(`${base}${prefix}/strategy/measurement/`);
|
||||
if (width < 997) await page.getByRole('button',{name:'Toggle navigation bar'}).click();
|
||||
const menu = page.locator('.theme-doc-sidebar-menu').filter({visible:true});
|
||||
const category = menu.locator('.theme-doc-sidebar-item-category').filter({has:page.getByRole('link',{name:'Measurement',exact:true})}).last();
|
||||
const caret = category.locator(':scope > .menu__list-item-collapsible > button.menu__caret');
|
||||
await caret.click();
|
||||
await category.getByRole('link',{name:'Validated task success',exact:true}).waitFor({state:'hidden'});
|
||||
await caret.focus(); await page.keyboard.press('Enter');
|
||||
await category.getByRole('link',{name:'Validated task success',exact:true}).waitFor({state:'visible'});
|
||||
await menu.getByRole('link',{name:'Measurement',exact:true}).click();
|
||||
await page.waitForURL(`${base}${prefix}/strategy/measurement/`);
|
||||
await page.locator('article h1').waitFor();
|
||||
if (width < 997) await page.getByRole('button',{name:'Close navigation bar'}).waitFor({state:'hidden'});
|
||||
await page.locator('#metric-definitions').scrollIntoViewIfNeeded();
|
||||
await page.screenshot({path:`${output}/${width}-index.png`});
|
||||
await page.goto(`${base}${prefix}/strategy/measurement/supported-bundle-coverage/`,{waitUntil:'networkidle'});
|
||||
await page.screenshot({path:`${output}/${width}-metric.png`,fullPage:true});
|
||||
assert.deepEqual(errors,[]);
|
||||
} finally {await context.close();}
|
||||
}
|
||||
assert.equal(results.length,32);
|
||||
fs.writeFileSync(`${output}/results.json`,JSON.stringify(results,null,2));
|
||||
console.log('PASS: 16 metric pages × 2 widths; canonical metadata, contract fields, status, all legacy metric/shared/fallback redirects and linked Measurement keyboard navigation');
|
||||
} finally {await browser.close();}
|
||||
})().catch(e => {console.error(e);process.exitCode=1;});
|
||||
@@ -43,18 +43,19 @@ const fs = require('node:fs');
|
||||
}
|
||||
const reference = '/eldorado-v1/documentation/strategy/reference/measurement-contracts/';
|
||||
await page.goto(`${base}${reference}#supported-bundle-coverage`, {waitUntil:'networkidle'});
|
||||
await page.locator('#supported-bundle-coverage').waitFor();
|
||||
await page.waitForURL(`${base}/eldorado-v1/documentation/strategy/measurement/supported-bundle-coverage/`);
|
||||
await page.getByRole('heading', {level:1, name:'Supported bundle coverage', exact:true}).waitFor();
|
||||
assert((await page.locator('article').innerText()).includes('Supported bundle coverage'));
|
||||
assert.equal(await page.locator('.breadcrumbs a').filter({hasText:'Stage - 01 - Skills Adoption'}).getAttribute('href'), '/eldorado-v1/documentation/strategy/stage-01-skills-adoption/');
|
||||
assert((await page.locator('.breadcrumbs').innerText()).includes('Reference'));
|
||||
assert((await page.locator('.breadcrumbs').innerText()).includes('Measurement'));
|
||||
await open();
|
||||
await menu.getByRole('link', {name:'Measurement Contracts', exact:true}).waitFor({state:'visible'});
|
||||
await menu.getByRole('link', {name:'Supported bundle coverage', exact:true}).waitFor({state:'visible'});
|
||||
await page.screenshot({path:`${output}/${width}-reference.png`, animations:'disabled'});
|
||||
assert.deepEqual(errors, []);
|
||||
} finally {await context.close();}
|
||||
}
|
||||
assert.equal(results.length, documents.length * 3);
|
||||
fs.writeFileSync(`${output}/results.json`, JSON.stringify(results,null,2));
|
||||
console.log(`PASS: all ${documents.length} docs have visible unique sidebar entries at 3 viewports; Contribution links, Reference breadcrumbs and reported anchor work`);
|
||||
console.log(`PASS: all ${documents.length} docs have visible unique sidebar entries at 3 viewports; Contribution links, Measurement breadcrumbs and reported anchor redirect work`);
|
||||
} finally {await browser.close();}
|
||||
})().catch(e => {console.error(e); process.exitCode = 1;});
|
||||
@@ -18,11 +18,12 @@ const fs = require('node:fs');
|
||||
assert.equal(await page.locator('h1').innerText(), 'Skills Measurement');
|
||||
assert((await page.title()).startsWith('Skills Measurement |'));
|
||||
assert.equal(await page.locator('.strategy-content details').count(), 0);
|
||||
assert.equal(await page.locator('.strategy-content h2').count(), 4);
|
||||
assert.equal(await page.locator('.strategy-content h2').count(), 5);
|
||||
if (width < 700) await page.getByRole('button', {name:'Toggle navigation bar'}).click();
|
||||
const menu = page.locator('.theme-doc-sidebar-menu .menu__link').filter({visible:true});
|
||||
await menu.first().waitFor({state:'visible'});
|
||||
assert.deepEqual(await menu.allTextContents(), ['Target','Roadmap','Stage - 01 - Skills Adoption','Governance','Quality','Adoption','Measurement','Maintenance','Reference','Stage - 02 - Autonomous Agent']);
|
||||
const metrics = JSON.parse(fs.readFileSync('research/ai-adoption/measurement-migration.json','utf8')).metrics;
|
||||
assert.deepEqual(await menu.allTextContents(), ['Target','Roadmap','Stage - 01 - Skills Adoption','Governance','Quality','Adoption','Measurement',...metrics.map(m => m.title),'Collection and safeguards','Run the synthetic measurement example','Maintenance','Stage - 02 - Autonomous Agent']);
|
||||
if (width < 700) await page.getByRole('button', {name:'Close navigation bar'}).click();
|
||||
const panel = page.locator('.archify-panel--story');
|
||||
const iframe = panel.locator(width > 700 ? '.story-desktop' : '.story-mobile');
|
||||
@@ -65,15 +66,14 @@ const fs = require('node:fs');
|
||||
await page.locator('.strategy-content h2').nth(1).scrollIntoViewIfNeeded();
|
||||
await page.screenshot({path:`${output}/${width}-pilot.png`});
|
||||
await page.screenshot({path:`${output}/${width}-full.png`, fullPage:true});
|
||||
const links = await page.locator('.strategy-content a[href*="measurement-contracts"]').evaluateAll(nodes => nodes.map(n => n.href));
|
||||
const links = await page.locator('.strategy-content a[href*="/measurement/"]').evaluateAll(nodes => nodes.map(n => n.href));
|
||||
for (const href of [...new Set(links)]) {
|
||||
const navigation = await page.goto(href, {waitUntil:'networkidle'});
|
||||
if (navigation) assert.equal(navigation.status(), 200);
|
||||
assert.equal(page.url(), href);
|
||||
if (new URL(href).hash) await page.locator(new URL(href).hash).waitFor({state:'visible'});
|
||||
}
|
||||
assert.equal(await page.locator('.strategy-content h3').count(), 19);
|
||||
assert((await page.locator('.strategy-content').innerText()).includes('9 prototype calculations and 7 unimplemented metrics'));
|
||||
assert.equal(new Set(links.map(h => new URL(h).pathname)).size, 18);
|
||||
assert(!await page.evaluate(() => document.documentElement.scrollWidth > innerWidth));
|
||||
assert.deepEqual(errors, []);
|
||||
results.push({width, geometry, links:links.length, title:true, sidebar:true, controls:true, export:true, reference:true});
|
||||
|
||||
@@ -8,9 +8,12 @@ const fs = require('node:fs');
|
||||
const prefix = '/eldorado-v1/documentation/strategy/';
|
||||
const first = 'Stage - 01 - Skills Adoption';
|
||||
const second = 'Stage - 02 - Autonomous Agent';
|
||||
const topics = ['Governance','Quality','Adoption','Measurement','Maintenance','Reference'];
|
||||
const ids = ['target-operating-model','roadmap','stage-01-skills-adoption','skills-governance','skills-quality','skills-adoption','measurement','skills-maintenance','reference/measurement-contracts','stage-02-autonomous-agent'];
|
||||
const titles = ['Target','Roadmap',first,'Skills governance','Skills quality','Skills adoption','Skills Measurement','Skills maintenance','Skills KPI reference',second];
|
||||
const topics = ['Governance','Quality','Adoption','Measurement','Maintenance'];
|
||||
const metrics = JSON.parse(fs.readFileSync('research/ai-adoption/measurement-migration.json','utf8')).metrics;
|
||||
const childIds = [...metrics.map(m => m.docId),'measurement/collection-and-safeguards','measurement/synthetic-example'];
|
||||
const childTitles = [...metrics.map(m => m.title),'Collection and safeguards','Run the synthetic measurement example'];
|
||||
const ids = ['target-operating-model','roadmap','stage-01-skills-adoption','skills-governance','skills-quality','skills-adoption','measurement',...childIds,'skills-maintenance','stage-02-autonomous-agent'];
|
||||
const titles = ['Target','Roadmap',first,'Skills governance','Skills quality','Skills adoption','Skills Measurement',...childTitles,'Skills maintenance',second];
|
||||
const browser = await chromium.launch({headless:true, executablePath:process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE, args:['--no-sandbox']});
|
||||
const results = [];
|
||||
try {
|
||||
@@ -39,11 +42,12 @@ const fs = require('node:fs');
|
||||
await category.getByRole('link', {name:'Governance', exact:true}).waitFor({state:'visible'});
|
||||
assert.deepEqual(await visibleLabels(), ['Target','Roadmap',first,...topics,second]);
|
||||
assert.deepEqual(await category.locator('ul .menu__link').filter({visible:true}).allTextContents(), topics);
|
||||
const reference = category.getByRole('button', {name:'Reference', exact:true});
|
||||
const measurement = category.locator('.theme-doc-sidebar-item-category').filter({has:page.getByRole('link', {name:'Measurement', exact:true})});
|
||||
const reference = measurement.locator(':scope > .menu__list-item-collapsible > button.menu__caret');
|
||||
await reference.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await category.getByRole('link', {name:'Measurement Contracts', exact:true}).waitFor({state:'visible'});
|
||||
assert.deepEqual(await visibleLabels(), ['Target','Roadmap',first,...topics,'Measurement Contracts',second]);
|
||||
await category.getByRole('link', {name:'Validated task success', exact:true}).waitFor({state:'visible'});
|
||||
assert.deepEqual(await visibleLabels(), ['Target','Roadmap',first,...topics.slice(0,4),...childTitles,'Maintenance',second]);
|
||||
await reference.click();
|
||||
await page.screenshot({path:`${output}/${width}-expanded.png`, animations:'disabled'});
|
||||
await caret.click();
|
||||
@@ -68,10 +72,12 @@ const fs = require('node:fs');
|
||||
else assert.equal(await prev.count(), 0);
|
||||
if (index < ids.length-1) assert.equal(await next.getAttribute('href'), `${prefix}${ids[index+1]}/`);
|
||||
else assert.equal(await next.count(), 0);
|
||||
if (index >= 3 && index <= 7) {
|
||||
if (index >= 3 && index < ids.length - 1) {
|
||||
assert.equal(await page.locator('.breadcrumbs a').filter({hasText:first}).getAttribute('href'), `${prefix}stage-01-skills-adoption/`);
|
||||
menu = await openMenu();
|
||||
assert.deepEqual(await visibleLabels(), ['Target','Roadmap',first,...topics,second]);
|
||||
const expectedTopics = id === 'measurement' || id.startsWith('measurement/') ? [...topics.slice(0,4),...childTitles,'Maintenance'] : topics;
|
||||
assert.deepEqual(await visibleLabels(), ['Target','Roadmap',first,...expectedTopics,second]);
|
||||
if (id.startsWith('measurement/')) assert.equal(await page.locator('.breadcrumbs a').filter({hasText:'Measurement'}).getAttribute('href'), `${prefix}measurement/`);
|
||||
await closeMenu();
|
||||
}
|
||||
assert(!await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), `${width}: overflow on ${id}`);
|
||||
@@ -84,6 +90,6 @@ const fs = require('node:fs');
|
||||
} finally {await context.close();}
|
||||
}
|
||||
assert.equal(results.length, 4);
|
||||
console.log('PASS: 4 desktop/mobile viewports; all 10 routes; linked category, keyboard expansion, nested Reference, breadcrumbs, next/previous and no overflow/errors');
|
||||
console.log(`PASS: 4 desktop/mobile viewports; all ${ids.length} routes; linked Measurement category, keyboard expansion, breadcrumbs, next/previous and no overflow/errors`);
|
||||
} finally {await browser.close();}
|
||||
})().catch(error => {console.error(error); process.exitCode = 1;});
|
||||
@@ -24,7 +24,7 @@ const fs=require('node:fs');
|
||||
assert.equal(geometry.nodes.length,(source.components||source.nodes).length,id);
|
||||
for(const n of geometry.nodes) assert(n.x>=0 && n.y>=0 && n.right<=geometry.width+1 && n.bottom<=geometry.height+1,`${id} ${width} clipped ${JSON.stringify(n)} / ${geometry.height}`);
|
||||
const data=await page.locator('.strategy-content').evaluate(el=>({words:el.innerText.trim().split(/\s+/).length,overflow:document.documentElement.scrollWidth>innerWidth,openDetails:el.querySelectorAll('details[open]').length}));
|
||||
assert(data.words<=(id==='measurement'?1100:id==='roadmap'?600:200),id);assert(!data.overflow,id);assert.equal(data.openDetails,0,id);
|
||||
assert(data.words<=(id==='measurement'?1500:id==='roadmap'?600:200),id);assert(!data.overflow,id);assert.equal(data.openDetails,0,id);
|
||||
await page.evaluate(()=>scrollTo({top:0,behavior:'instant'}));await page.screenshot({path:`.cache/story-${label}/${width}-${id}.png`,fullPage:true});
|
||||
const opener=panel.getByRole('button',{name:/^Expand /});await opener.click();
|
||||
const close=panel.getByRole('button',{name:'Close full-screen diagram',exact:true});await close.waitFor({state:'visible'});
|
||||
@@ -44,7 +44,8 @@ const fs=require('node:fs');
|
||||
results.push({id,width,...data,geometry,modalClick:true,modalEscape:true,focusRestored:true,details:id!=='measurement'});fs.writeFileSync(`.cache/story-${label}/results.json`,JSON.stringify(results,null,2));
|
||||
}
|
||||
await page.goto(`${base}/eldorado-v1/documentation/strategy/reference/measurement-contracts/#validated-task-success`,{waitUntil:'networkidle'});
|
||||
const heading=page.locator('#validated-task-success');await heading.waitFor({state:'visible'});
|
||||
await page.waitForURL(`${base}/eldorado-v1/documentation/strategy/measurement/validated-task-success/`);
|
||||
await page.getByRole('heading',{level:1,name:'Validated task success',exact:true}).waitFor();
|
||||
assert.equal(await page.locator('.strategy-content details').count(),0,'reference is directly readable');
|
||||
await context.close();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user