perf: filter_result_ms не включает таймаут ожидания поиска на сборке «до»
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
85c544b350
commit
5dc6662767
@ -69,3 +69,8 @@ export class ByteCounter {
|
|||||||
return this.firstBytes;
|
return this.firstBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** filter_result_ms: от fill до стабилизации; ответ поиска (если был) не должен быть позже конца; таймаут ожидания (respAt=null) не учитывается. */
|
||||||
|
export function filterResultMs(startAt: number, stableAt: number, respAt: number | null): number {
|
||||||
|
return Math.max(stableAt, respAt ?? 0) - startAt;
|
||||||
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import { attachNetlog } from '../lib/netlog';
|
|||||||
import { append, runDir } from '../lib/results';
|
import { append, runDir } from '../lib/results';
|
||||||
import { scrollThrough, type Axis } from '../lib/scroll';
|
import { scrollThrough, type Axis } from '../lib/scroll';
|
||||||
import { shouldTrace } from '../lib/trace';
|
import { shouldTrace } from '../lib/trace';
|
||||||
import { ByteCounter, SVOD2_DATA_ROW_SELECTOR, SVOD2_PLACEHOLDER_SELECTOR, countPagesRequested, isSvod2SearchUrl, placeholderShare, svod2RespRe } from '../lib/svod2';
|
import { ByteCounter, SVOD2_DATA_ROW_SELECTOR, SVOD2_PLACEHOLDER_SELECTOR, countPagesRequested, filterResultMs as filterResultMsOf, isSvod2SearchUrl, placeholderShare, svod2RespRe } from '../lib/svod2';
|
||||||
|
|
||||||
const CONTAINER = '.MuiTableContainer-root'; // MRT: muiTableContainerProps (RealtimeTable.jsx), SummaryTable, Svod2Page
|
const CONTAINER = '.MuiTableContainer-root'; // MRT: muiTableContainerProps (RealtimeTable.jsx), SummaryTable, Svod2Page
|
||||||
const MIN_ROWS = 20;
|
const MIN_ROWS = 20;
|
||||||
@ -233,13 +233,16 @@ async function measure(browser: import('@playwright/test').Browser, o: RunOpts)
|
|||||||
const input = page.locator('.MuiInputBase-root:has(.MuiInputAdornment-positionStart) input').first();
|
const input = page.locator('.MuiInputBase-root:has(.MuiInputAdornment-positionStart) input').first();
|
||||||
const tFilter = Date.now();
|
const tFilter = Date.now();
|
||||||
// свод 2 «после»: поиск уходит на сервер; нет запроса (сборка «до») - идём дальше
|
// свод 2 «после»: поиск уходит на сервер; нет запроса (сборка «до») - идём дальше
|
||||||
|
// ожидание ответа идёт параллельно со стабилизацией: таймаут 5 с на «до» в метрику не попадает
|
||||||
|
let respAt: number | null = null;
|
||||||
const searchResp = t.kind === 'svod2'
|
const searchResp = t.kind === 'svod2'
|
||||||
? page.waitForResponse((r) => isSvod2SearchUrl(r.url()), { timeout: 5_000 }).catch(() => null)
|
? page.waitForResponse((r) => isSvod2SearchUrl(r.url()), { timeout: 5_000 }).then(() => { respAt = Date.now(); }, () => {})
|
||||||
: null;
|
: null;
|
||||||
await input.fill('1');
|
await input.fill('1');
|
||||||
if (searchResp) await searchResp;
|
|
||||||
stable = await awaitStable(page, 120_000);
|
stable = await awaitStable(page, 120_000);
|
||||||
if (t.kind === 'svod2') filterResultMs = Date.now() - tFilter;
|
const stableAt = Date.now();
|
||||||
|
if (searchResp) await searchResp;
|
||||||
|
if (t.kind === 'svod2') filterResultMs = filterResultMsOf(tFilter, stableAt, respAt);
|
||||||
effect = (await signature(page)) !== sigBefore;
|
effect = (await signature(page)) !== sigBefore;
|
||||||
if (!stable) reason = 'filter did not stabilize in 120s';
|
if (!stable) reason = 'filter did not stabilize in 120s';
|
||||||
else if (!effect) reason = 'filter_no_effect';
|
else if (!effect) reason = 'filter_no_effect';
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
isSvod2SearchUrl,
|
isSvod2SearchUrl,
|
||||||
svod2RespRe,
|
svod2RespRe,
|
||||||
countPagesRequested,
|
countPagesRequested,
|
||||||
|
filterResultMs,
|
||||||
SVOD2_DATA_ROW_SELECTOR,
|
SVOD2_DATA_ROW_SELECTOR,
|
||||||
SVOD2_PLACEHOLDER_SELECTOR,
|
SVOD2_PLACEHOLDER_SELECTOR,
|
||||||
} from '../lib/svod2.ts';
|
} from '../lib/svod2.ts';
|
||||||
@ -62,3 +63,9 @@ test('селекторы', () => {
|
|||||||
assert.equal(SVOD2_DATA_ROW_SELECTOR, 'tbody tr:not([data-svod2-placeholder])');
|
assert.equal(SVOD2_DATA_ROW_SELECTOR, 'tbody tr:not([data-svod2-placeholder])');
|
||||||
assert.equal(SVOD2_PLACEHOLDER_SELECTOR, 'tbody tr[data-svod2-placeholder]');
|
assert.equal(SVOD2_PLACEHOLDER_SELECTOR, 'tbody tr[data-svod2-placeholder]');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('filterResultMs: нет запроса поиска - только стабилизация', () => {
|
||||||
|
assert.equal(filterResultMs(1000, 1700, null), 700);
|
||||||
|
assert.equal(filterResultMs(1000, 1700, 1200), 700);
|
||||||
|
assert.equal(filterResultMs(1000, 1700, 1900), 900);
|
||||||
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user