Библиотека scroll.ts (scrollThrough) с тестами на фикстурах, сценарий scroll.spec.ts: листы форм, отчёты проектов, своды 1/2, projects/summaries, admin-контроль, смена фильтра свода. Параметры PERF_TARGETS/CPU_RATES/REPEATS/ROLES/AXES. Refs #202 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import path from 'node:path';
|
|
import { scrollThrough } from '../lib/scroll';
|
|
|
|
const fx = (n: string) => 'file://' + path.resolve(__dirname, '../fixtures', n);
|
|
|
|
test('scrollThrough: длинный список y проходится до конца', async ({ page }) => {
|
|
await page.goto(fx('long-list.html'));
|
|
const r = await scrollThrough(page, '#box', 'y');
|
|
expect(r.complete).toBe(true);
|
|
expect(r.steps).toBeGreaterThanOrEqual(100);
|
|
// вернулись к началу
|
|
expect(await page.evaluate(() => document.querySelector('#box')!.scrollTop)).toBeLessThanOrEqual(2);
|
|
});
|
|
|
|
test('scrollThrough: ось x', async ({ page }) => {
|
|
await page.goto(fx('long-list.html'));
|
|
const r = await scrollThrough(page, '#box', 'x');
|
|
expect(r.complete).toBe(true);
|
|
});
|
|
|
|
test('scrollThrough: при исчерпании maxSteps complete === false', async ({ page }) => {
|
|
await page.goto(fx('clipped-list.html'));
|
|
const r = await scrollThrough(page, '#box', 'y', 200, 10);
|
|
expect(r.complete).toBe(false);
|
|
expect(r.steps).toBeLessThanOrEqual(10);
|
|
});
|