Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for consistent hyphen rendering in headless/headed #34159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
43 changes: 43 additions & 0 deletions tests/library/headful.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,46 @@ it('headless and headful should use same default fonts', async ({ page, browserN
}
await headlessBrowser.close();
});

it('should have the same hyphen rendering on headless and headed', {
annotation: {
type: 'issue',
description: 'https://github.com/microsoft/playwright/issues/33590'
}
}, async ({ browserType, page, headless, server }) => {
const content = `
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.hyphenated {
width: 100px;
hyphens: auto;
text-align: justify;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="hyphenated">
supercalifragilisticexpialidocious
</div>
</body>
</html>
`;
server.setRoute('/hyphenated.html', (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(content);
});
const oppositeBrowser = await browserType.launch({ headless: !headless });
const oppositePage = await oppositeBrowser.newPage();
await oppositePage.goto(server.PREFIX + '/hyphenated.html');
await page.goto(server.PREFIX + '/hyphenated.html');

const [divHeight1, divHeight2] = await Promise.all([
page.evaluate(() => document.querySelector('.hyphenated').getBoundingClientRect().height),
oppositePage.evaluate(() => document.querySelector('.hyphenated').getBoundingClientRect().height),
]);
expect(divHeight1).toBe(divHeight2);
await oppositeBrowser.close();
});
Loading