Keep offline completion outside the activation barrier

This commit is contained in:
Jonathan Sykes
2026-10-09 10:26:23 +08:00
parent 6b8d590638
commit 2c8d563d01
3 changed files with 30 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ import { chromium, webkit } from 'playwright';
const repo = resolve(fileURLToPath(new URL('..', import.meta.url)));
const commit = 'b77938a', oldTag = '1175f1a1d2c1';
const args = process.argv.slice(2);
const targetFrontend = args.includes('--frontend-source') ? resolve(args[args.indexOf('--frontend-source')+1]) : join(repo,'frontend');
const profile = args.includes('--profile') ? args[args.indexOf('--profile')+1] : 'lossy';
const browserName = args.includes('--browser') ? args[args.indexOf('--browser') + 1] : 'all';
assert.ok(['all', 'chromium', 'webkit'].includes(browserName));
@@ -55,7 +56,7 @@ async function run(name) {
});
}
async function start(old) {
symlinkSync(old ? join(repo, `perf/fixtures/shell-${oldTag}`) : join(repo, 'frontend'), join(cwd, 'public'));
symlinkSync(old ? join(repo, `perf/fixtures/shell-${oldTag}`) : targetFrontend, join(cwd, 'public'));
output = '';
child = spawn('bun', [old ? join(scratch, 'server/server.js') : join(repo, 'server/server.js')], {
cwd, env: { ...process.env, BUILD_TAG: '', ASSET_HASHING: old ? '0' : '1', PORT: String(port),
@@ -114,7 +115,7 @@ async function run(name) {
const response = await fetch(`${backend}${path}${query}`);
assert.equal(response.status, 200);
assert.equal(response.headers.get('x-asset-hash'), manifest.files[path].h);
assert.deepEqual(Buffer.from(await response.arrayBuffer()), readFileSync(join(repo, 'frontend', path.slice(1))));
assert.deepEqual(Buffer.from(await response.arrayBuffer()), readFileSync(join(targetFrontend, path.slice(1))));
if (query.includes('?v=')) assert.equal(response.headers.get('cache-control'), 'no-store');
}
}
@@ -150,6 +151,8 @@ async function run(name) {
await oldTab.goto(origin,{waitUntil:'load'});
assert.equal(await oldTab.locator('meta[name="ytp-build"]').getAttribute('content'),oldTag);
const oldBytes = await oldTab.evaluate(async()=>await (await fetch('/app.js')).text());
// Bring the updating page forward after checking the retained old tab.
await page.bringToFront();
console.log(name,'clicking legacy refresh');
await page.locator('#modal').getByRole('button', { name: 'Refresh UI', exact: true }).click({noWaitAfter:true,timeout:15000});
console.log(name,'legacy refresh clicked');