feat: increase length of printed html tags (#31105)

resolves https://github.com/microsoft/playwright/issues/30977 by
increasing the printed length of HTML tags from 50 -> 500 as suggested
by @dgozman
This commit is contained in:
Joe-Hendley 2024-05-31 18:45:56 +01:00 committed by GitHub
parent 76e977a934
commit afa0bf2247
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -983,7 +983,7 @@ export class InjectedScript {
attrs.push(` ${name}="${value}"`);
}
attrs.sort((a, b) => a.length - b.length);
const attrText = trimStringWithEllipsis(attrs.join(''), 50);
const attrText = trimStringWithEllipsis(attrs.join(''), 500);
if (autoClosingTags.has(element.nodeName))
return oneLine(`<${element.nodeName.toLowerCase()}${attrText}/>`);

View File

@ -253,7 +253,7 @@ it('should not click iframe overlaying the target', async ({ page, server }) =>
`);
const error = await page.click('text=click-me', { timeout: 1000 }).catch(e => e);
expect(await page.evaluate('window._clicked')).toBe(undefined);
expect(error.message).toContain(`<iframe srcdoc="<body onclick='window.top._clicked=2' st></iframe> from <div>…</div> subtree intercepts pointer events`);
expect(error.message).toContain(`<iframe srcdoc=\"<body onclick='window.top._clicked=2' style='background-color:red;height:40px;'></body>\"></iframe> from <div>…</div> subtree intercepts pointer events`);
});
it('should not click an element overlaying iframe with the target', async ({ page, server }) => {

View File

@ -34,7 +34,7 @@ it('should have a nice preview for non-ascii attributes/children', async ({ page
await page.goto(server.EMPTY_PAGE);
await page.setContent(`<div title="${'😛'.repeat(100)}">${'😛'.repeat(100)}`);
const handle = await page.$('div');
await expect.poll(() => String(handle)).toBe(`JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛>😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>`);
await expect.poll(() => String(handle)).toBe(`JSHandle@<div title=\"😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛\">😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛😛…</div>`);
});
it('getAttribute should work', async ({ page, server }) => {

View File

@ -135,7 +135,7 @@ it('should report logs while waiting for visible', async ({ page, server }) => {
const error = await watchdog.catch(e => e);
expect(error.message).toContain(`frame.waitForSelector: Timeout 5000ms exceeded.`);
expect(error.message).toContain(`waiting for locator(\'div\') to be visible`);
expect(error.message).toContain(`locator resolved to hidden <div id="mydiv" class="foo bar" foo="1234567890123456…>abcdefghijklmnopqrstuvwyxzabcdefghijklmnopqrstuvw…</div>`);
expect(error.message).toContain(`locator resolved to hidden <div id="mydiv" class="foo bar" foo=\"123456789012345678901234567890123456789012345678901234567890\">abcdefghijklmnopqrstuvwyxzabcdefghijklmnopqrstuvw…</div>`);
expect(error.message).toContain(`locator resolved to hidden <div class="another"></div>`);
});