Skip to content
Astera Technology

Run a complete isolated offline task pack

Execute the HTML, script and local seed needed by one task.

Download complete case notes and answer keys ↓

Set the decision and its input

The toy task loads HTML and JS, then reads seed values2 and3 to display5. An HTML/JS-only pack displays no-seed. The corrected pack supplies the seed. The browser context is actually offline and routes are satisfied only from the explicit in-memory cache map.

Filled local test worksheet
CaseInput JSON
Base test{"cacheSeed":true,"values":[2,3]}
Download editable CSV ↓

Run the supplied comparison

Actual browser asset requests are intercepted locally; unknown routes abort and none continue externally. This finite distribution test is not a universal service-worker recipe or proof that a whole business system works offline.

Faulty and required outputs
PathOutput JSON
Faulty path{"offline":true,"text":"no-seed","missing":["/seed.json"],"externalTransport":0}
Required path{"offline":true,"text":"5","missing":[],"externalTransport":0}
Download editable CSV ↓
Node24.14.1 programme; Playwright1.63 Chromium required
import assert from 'node:assert/strict';
import {createRequire} from 'node:module';
const htmlEscape=s=>String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
async function withPage(action,options={}){
  const require=createRequire(import.meta.url);const {chromium}=require('playwright');
  const browser=await chromium.launch({headless:true});
  try{const context=await browser.newContext(options);const page=await context.newPage();
    const requests=[];await page.route('**/*',route=>{requests.push(route.request().url());return route.abort();});
    return await action(page,context,requests);
  }finally{await browser.close();}
}

const run=async function run(i,corrected=true){
    if(typeof i.cacheSeed!=='boolean')return {held:true};
    return withPage(async(page,context)=>{await page.unroute('**/*');await context.setOffline(true);const missing=[];
      const cache=new Map([['/app','<link rel="icon" href="data:,"><output>loading</output><script src="/app.js"></script>'],['/app.js','fetch("/seed.json").then(r=>r.json()).then(d=>document.querySelector("output").textContent=String(d.values.reduce((a,b)=>a+b,0))).catch(()=>document.querySelector("output").textContent="no-seed");']]);
      if(corrected&&i.cacheSeed)cache.set('/seed.json',JSON.stringify({values:i.values}));
      await page.route('**/*',route=>{const url=new URL(route.request().url());if(url.origin==='https://offline.example.invalid'&&cache.has(url.pathname))return route.fulfill({body:cache.get(url.pathname),contentType:url.pathname.endsWith('.json')?'application/json':url.pathname.endsWith('.js')?'text/javascript':'text/html'});missing.push(url.pathname);return route.abort();});
      await page.goto('https://offline.example.invalid/app');await page.waitForFunction(()=>document.querySelector('output').textContent!=='loading',{timeout:2000});
      return {offline:true,text:await page.locator('output').textContent(),missing,externalTransport:0};
    });
  };
const cases=[{"input":{"cacheSeed":true,"values":[2,3]},"corrected":false,"expected":{"offline":true,"text":"no-seed","missing":["/seed.json"],"externalTransport":0}},{"input":{"cacheSeed":true,"values":[2,3]},"corrected":true,"expected":{"offline":true,"text":"5","missing":[],"externalTransport":0}},{"input":{"cacheSeed":false,"values":[2,3]},"corrected":true,"expected":{"offline":true,"text":"no-seed","missing":["/seed.json"],"externalTransport":0}},{"input":{"cacheSeed":true,"values":[]},"corrected":true,"expected":{"offline":true,"text":"0","missing":[],"externalTransport":0}},{"input":{"cacheSeed":null,"values":[2,3]},"corrected":true,"expected":{"held":true}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

A missing seed remains failed; a present empty seed displays0. Unknown inventory is held.

  1. List task-owned assets
  2. Run the isolated offline task
  3. Inspect output and missing routes

Do not infer general offline support from this one result.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
declared pack really lacks seed{"cacheSeed":false,"values":[2,3]}{"offline":true,"text":"no-seed","missing":["/seed.json"],"externalTransport":0}
present empty seed{"cacheSeed":true,"values":[]}{"offline":true,"text":"0","missing":[],"externalTransport":0}
cache inventory unknown{"cacheSeed":null,"values":[2,3]}{"held":true}
Download editable CSV ↓

Does loading the application script complete the base task?

Show the worked answer

No. The seed is required too. The repaired isolated run displays5 with no missing route.

Related resources

Cloud and system operations →