Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
66 lines
6.6 KiB
JavaScript
66 lines
6.6 KiB
JavaScript
window.addEventListener('load',async()=>{
|
|
const wait=async(test,step)=>{for(let i=0;i<150;i++){if(test())return;await new Promise(r=>setTimeout(r,30));}throw new Error(step+': '+document.querySelector('[data-governance-result]')?.textContent);};
|
|
try{
|
|
document.querySelector('[data-governance-open]').click();
|
|
const dialog=document.querySelector('[data-governance-dialog]'),form=dialog.querySelector('[data-publication-form]'),fields=form.querySelector('fieldset');
|
|
await wait(()=>!fields.disabled,'open');
|
|
form.querySelector('[data-publication-preview]').click();
|
|
await wait(()=>!fields.disabled&&form.querySelector('[data-publication-impact] li'),'impact');
|
|
if(!form.querySelector('[data-publication-impact]').textContent.includes('/public/page'))throw new Error('Missing approved Path');
|
|
form.elements.confirm.checked=true;form.requestSubmit();
|
|
await wait(()=>!fields.disabled&&form.querySelector('[data-publication-status]').textContent===form.dataset.enabled,'approve');
|
|
const frame=document.createElement('iframe');frame.src='/public/page';document.body.append(frame);
|
|
await new Promise((resolve,reject)=>{frame.onload=resolve;frame.onerror=reject;});
|
|
if(!frame.contentDocument.querySelector('h1')?.textContent.includes('Public browser sentinel')||frame.contentWindow.authoredRan||frame.contentDocument.querySelector('.auth-menu'))throw new Error('Unsafe/broken public projection');
|
|
await wait(()=>frame.contentDocument.querySelector('[data-public-children-body] a[href="/public/page/child"]'),'async children');
|
|
const viewButtons=[...frame.contentDocument.querySelectorAll('.public-children-views button')];
|
|
if(viewButtons.map(button=>button.textContent).join('')!=='▦☷≡'||viewButtons.some(button=>!button.title||button.getAttribute('aria-label')!==button.title))throw new Error('Public view icons / accessible labels');
|
|
if(frame.contentDocument.querySelector('a[download]')||!frame.contentDocument.querySelector('.public-topbar a[href="/v/tree"]'))throw new Error('Public navigation chrome');
|
|
frame.style.width='100%';frame.style.height='600px';
|
|
const navigate=async url=>{await new Promise((resolve,reject)=>{frame.onload=resolve;frame.onerror=reject;frame.src=url;});};
|
|
const doc=()=>frame.contentDocument;
|
|
await navigate('/v/tree');
|
|
await wait(()=>doc().querySelector('[data-public-tree-tools]:not([hidden])'),'tree enhancement');
|
|
const row=path=>[...doc().querySelectorAll('[data-public-tree-path]')].find(r=>r.dataset.publicTreePath===path);
|
|
doc().querySelector('[data-public-collapse]').click();
|
|
if(!row('/public/page/child').hidden||row('/public').hidden)throw new Error('Tree collapse');
|
|
const link=row('/public').querySelector('.public-tree-name');link.focus();
|
|
link.dispatchEvent(new frame.contentWindow.KeyboardEvent('keydown',{key:'ArrowRight',bubbles:true}));
|
|
if(row('/public/page').hidden||!row('/public/page/child').hidden)throw new Error('Tree keyboard expand');
|
|
doc().querySelector('[data-public-expand]').click();
|
|
row('/public/page').querySelector('[data-public-tree-toggle]').click();
|
|
if(!row('/public/page/child').hidden||row('/public/page-other').hidden)throw new Error('Tree prefix collision');
|
|
const filter=doc().querySelector('[data-public-tree-filter]');filter.value='grandchild';filter.dispatchEvent(new frame.contentWindow.Event('input'));
|
|
if(row('/public/page/child/grandchild').hidden||row('/public').hidden||!row('/public/page-other').hidden)throw new Error('Tree filter ancestry');
|
|
await navigate('/v/browser/public/page');
|
|
await wait(()=>doc().querySelector('[data-public-children-body] a[href="/public/page/child"]'),'folder listing');
|
|
if(!doc().querySelector('a[href="/public/page"]')||!doc().querySelector('.public-child-folder[href="/v/browser/public/page/child"]'))throw new Error('Page / folder navigation');
|
|
const original=frame.contentWindow.fetch.bind(frame.contentWindow);let fail=true;
|
|
frame.contentWindow.fetch=(...args)=>fail?Promise.resolve(new frame.contentWindow.Response('temporary failure',{status:503})):original(...args);
|
|
doc().querySelector('[data-view="detail"]').click();
|
|
await wait(()=>doc().querySelector('[data-public-children-body] button'),'children retry');
|
|
fail=false;doc().querySelector('[data-public-children-body] button').click();
|
|
await wait(()=>doc().querySelector('.public-children-details'),'children retry success');
|
|
doc().querySelector('[data-view="list"]').click();doc().querySelector('[data-view="icon"]').click();
|
|
await wait(()=>doc().querySelector('.public-children-icons'),'latest view wins');
|
|
if(doc().querySelector('.public-children-list')||doc().querySelector('[data-view="icon"]').getAttribute('aria-pressed')!=='true')throw new Error('Stale children response');
|
|
await navigate('/public/page');
|
|
await wait(()=>doc().querySelector('.public-children-icons'),'view preference retained');
|
|
if(doc().documentElement.scrollWidth>frame.clientWidth+5)throw new Error('Public navigation horizontal overflow');
|
|
await navigate('/');
|
|
await wait(()=>doc().querySelector('[data-public-children-body] a[href="/v/tree/public"]'),'public home directory');
|
|
const tree=await fetch('/v/tree');if(!tree.ok||!(await tree.text()).includes('/public/page/child'))throw new Error('Public tree');
|
|
const map=await fetch('/_/api/v1/city/map');if(!map.ok||(await map.json()).quartiers.length!==1)throw new Error('Public City');
|
|
await navigate('/v/tree');
|
|
await wait(()=>doc().querySelector('[data-public-tree-tools]:not([hidden])'),'final tree');
|
|
form.querySelector('[data-publication-revoke]').click();
|
|
await wait(()=>!fields.disabled&&form.querySelector('[data-publication-status]').textContent===form.dataset.disabled,'revoke');
|
|
const response=await fetch('/public/page',{redirect:'manual'});if(response.status===200)throw new Error('Revocation failed');
|
|
const children=await fetch('/v/children?path=/public/page');if((await children.text()).includes('/public/page/child'))throw new Error('Stale children cache');
|
|
dialog.close();
|
|
[...document.body.children].forEach(element=>{if(element!==frame)element.style.display='none';});
|
|
document.body.style.margin='0';document.body.style.padding='0';frame.style.border='0';frame.style.height='100vh';
|
|
document.body.dataset.vimReady='true';
|
|
}catch(error){const box=document.createElement('div');box.id='error';box.textContent=error.message;document.body.append(box);}
|
|
});
|