Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/tools/screenshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {describe, it} from 'node:test';

import {screenshot} from '../../src/tools/screenshot.js';
import {screenshots} from '../snapshot.js';
import {withBrowser} from '../utils.js';
import {html, withBrowser} from '../utils.js';

describe('screenshot', () => {
describe('browser_take_screenshot', () => {
Expand Down Expand Up @@ -77,9 +77,20 @@ describe('screenshot', () => {
it('with full page resulting in a large screenshot', async () => {
await withBrowser(async (response, context) => {
const page = context.getSelectedPage();

await page.setContent(
`<div style="color:blue;">test</div>`.repeat(7_000),
html`${`<div style="color:blue;">test</div>`.repeat(6500)}
<div
id="red"
style="color:blue;"
>test</div
> `,
);
await page.evaluate(() => {
const el = document.querySelector('#red');
return el?.scrollIntoViewIfNeeded();
});

await screenshot.handler(
{params: {format: 'png', fullPage: true}},
response,
Expand Down
Loading