mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(html): render inline attachments as monospace (#11214)
This commit is contained in:
parent
373042ed89
commit
5fa7d19f1c
@ -95,10 +95,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
.attachment-link {
|
||||
.attachment-body {
|
||||
white-space: pre-wrap;
|
||||
background-color: var(--color-canvas-subtle);
|
||||
margin-left: 24px;
|
||||
line-height: normal;
|
||||
padding: 8px;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ export const AttachmentLink: React.FunctionComponent<{
|
||||
{attachment.path && <a href={href || attachment.path} target='_blank'>{attachment.name}</a>}
|
||||
{attachment.body && <span>{attachment.name}</span>}
|
||||
</span>} loadChildren={attachment.body ? () => {
|
||||
return [<div className='attachment-link'>{attachment.body}</div>];
|
||||
return [<div className='attachment-body'>{attachment.body}</div>];
|
||||
} : undefined} depth={0}></TreeItem>;
|
||||
};
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ test('should not throw when attachment is missing', async ({ runInlineTest, page
|
||||
await page.click('text=passes');
|
||||
await page.locator('text=Missing attachment "screenshot"').click();
|
||||
const screenshotFile = testInfo.outputPath('test-results' , 'a-passes', 'screenshot.png');
|
||||
await expect(page.locator('.attachment-link')).toHaveText(`Attachment file ${screenshotFile} is missing`);
|
||||
await expect(page.locator('.attachment-body')).toHaveText(`Attachment file ${screenshotFile} is missing`);
|
||||
});
|
||||
|
||||
test('should include image diff', async ({ runInlineTest, page, showReport }) => {
|
||||
@ -203,9 +203,9 @@ test('should include stdio', async ({ runInlineTest, page, showReport }) => {
|
||||
await showReport();
|
||||
await page.click('text=fails');
|
||||
await page.locator('text=stdout').click();
|
||||
await expect(page.locator('.attachment-link')).toHaveText('First line\nSecond line');
|
||||
await expect(page.locator('.attachment-body')).toHaveText('First line\nSecond line');
|
||||
await page.locator('text=stderr').click();
|
||||
await expect(page.locator('.attachment-link').nth(1)).toHaveText('Third line');
|
||||
await expect(page.locator('.attachment-body').nth(1)).toHaveText('Third line');
|
||||
});
|
||||
|
||||
test('should highlight error', async ({ runInlineTest, page, showReport }) => {
|
||||
@ -402,7 +402,7 @@ test('should render text attachments as text', async ({ runInlineTest, page, sho
|
||||
await page.click('text=example.txt');
|
||||
await page.click('text=example.json');
|
||||
await page.click('text=example-utf16.txt');
|
||||
await expect(page.locator('.attachment-link')).toHaveText(['foo', '{"foo":1}', 'utf16 encoded']);
|
||||
await expect(page.locator('.attachment-body')).toHaveText(['foo', '{"foo":1}', 'utf16 encoded']);
|
||||
});
|
||||
|
||||
test('should strikethough textual diff', async ({ runInlineTest, showReport, page }) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user