Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Joe-Hendleyafa0bf224748
diff --git a/packages/playwright-core/src/server/injected/injectedScript.ts b/packages/playwright-core/src/server/injected/injectedScript.ts
index c988143a8f..dba8d188e4 100644
--- a/packages/playwright-core/src/server/injected/injectedScript.ts
+++ b/packages/playwright-core/src/server/injected/injectedScript.ts
@@ -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}/>`);
diff --git a/tests/library/hit-target.spec.ts b/tests/library/hit-target.spec.ts
index 0b3d0f6597..6bf4085b6b 100644
--- a/tests/library/hit-target.spec.ts
+++ b/tests/library/hit-target.spec.ts
@@ -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 }) => {
diff --git a/tests/page/elementhandle-convenience.spec.ts b/tests/page/elementhandle-convenience.spec.ts
index 5020f34ea8..8e2f4895bf 100644
--- a/tests/page/elementhandle-convenience.spec.ts
+++ b/tests/page/elementhandle-convenience.spec.ts
@@ -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 }) => {
diff --git a/tests/page/page-wait-for-selector-1.spec.ts b/tests/page/page-wait-for-selector-1.spec.ts
index d20165af66..3ab3e92b73 100644
--- a/tests/page/page-wait-for-selector-1.spec.ts
+++ b/tests/page/page-wait-for-selector-1.spec.ts
@@ -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>`);
});