Episode 19: Nextcloud AIO, OpenCloud and Seafile measured with the same test data on the same server
This commit is contained in:
parent
76a3132a17
commit
145d318452
70 changed files with 3296 additions and 0 deletions
29
filesync/client/ui-time.mjs
Normal file
29
filesync/client/ui-time.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// ui-time.mjs P N : Ladezeit der Dateiliste mit 5000 Dateien im Browser (Chromium headless auf ep19fs-cli).
|
||||
// Gemessen ab page.goto(Ordner-URL) bis die erste Dateizeile sichtbar ist und bis der Ordnerinhalt
|
||||
// "fertig" ist (Netzwerk ruhig). Je Lauf neuer Browser-Kontext mit frischer Anmeldung (kalter Cache).
|
||||
import { chromium } from 'playwright';
|
||||
import { readFileSync } from 'fs';
|
||||
const E = Object.fromEntries(readFileSync('/root/ep19fs/env', 'utf8').split('\n').filter(l => l.includes('=')).map(l => [l.slice(0, l.indexOf('=')), l.slice(l.indexOf('=') + 1).replace(/^'|'$/g, '')]));
|
||||
const [P, N] = [process.argv[2], +process.argv[3] || 3];
|
||||
const cfg = {
|
||||
nc: { login: async p => { await p.goto(E.NC_URL + '/login'); await p.fill('#user', E.NC_USER); await p.fill('#password', E.NC_PASS); await p.click('button[type=submit]'); await p.waitForURL(/apps/, { timeout: 60000 }); await p.waitForTimeout(1500); await p.keyboard.press('Escape'); },
|
||||
url: () => E.NC_URL + '/apps/files/files?dir=/up-official/small', row: '[data-cy-files-list-row-name]' },
|
||||
oc: { login: async p => { await p.goto(E.OC_URL + '/'); await p.waitForSelector('#oc-login-username', { timeout: 60000 }); await p.fill('#oc-login-username', E.OC_USER); await p.fill('#oc-login-password', E.OC_PASS); await p.click('button[type=submit]'); await p.waitForURL(/files/, { timeout: 60000 }); },
|
||||
url: () => E.OC_URL + '/files/spaces/personal/admin/up-official/small', row: '[data-item-id]:not(.oc-breadcrumb-list-item)' },
|
||||
sf: { login: async p => { await p.goto(E.SF_URL + '/accounts/login/'); await p.fill('input[name=login]', E.SF_USER); await p.fill('input[name=password]', E.SF_PASS); await p.click('button[type=submit], input[type=submit]'); await p.waitForTimeout(3000); },
|
||||
url: () => E.SF_URL + E.SF_SMALL_PATH, row: 'tr[draggable="true"]' },
|
||||
}[P];
|
||||
const b = await chromium.launch();
|
||||
const res = [];
|
||||
for (let i = 1; i <= N; i++) {
|
||||
const ctx = await b.newContext({ viewport: { width: 1600, height: 900 }, ignoreHTTPSErrors: false }); const p = await ctx.newPage();
|
||||
await cfg.login(p);
|
||||
const t0 = Date.now(); await p.goto(cfg.url(), { waitUntil: 'commit' });
|
||||
await p.waitForSelector(cfg.row, { timeout: 120000 }); const tFirst = (Date.now() - t0) / 1000;
|
||||
await p.waitForLoadState('networkidle', { timeout: 120000 }).catch(() => {}); const tIdle = (Date.now() - t0) / 1000;
|
||||
const rows = await p.locator(cfg.row).count();
|
||||
console.log(` Lauf ${i}: erste Dateizeile nach ${tFirst.toFixed(2)} s, Netzwerk ruhig nach ${tIdle.toFixed(2)} s, Zeilen im DOM: ${rows}`);
|
||||
res.push(tFirst); if (i === N) await p.screenshot({ path: `/root/ep19fs/ui-${P}.png` }); await ctx.close();
|
||||
}
|
||||
console.log(` Mittel erste Zeile ${(res.reduce((a, b) => a + b, 0) / res.length).toFixed(2)} s (n=${res.length})`);
|
||||
await b.close();
|
||||
Loading…
Add table
Add a link
Reference in a new issue