add one more test

This commit is contained in:
Simon Knott 2024-12-16 18:55:21 +01:00
parent 6c61ab3353
commit 9765124b8b
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -938,6 +938,32 @@ for (const useIntermediateMergeReport of [true, false] as const) {
await expect(attachment).toBeInViewport(); await expect(attachment).toBeInViewport();
}); });
test('steps with internal attachments have links', async ({ runInlineTest, page, showReport }) => {
const result = await runInlineTest({
'a.test.js': `
import { test, expect } from '@playwright/test';
test('passing', async ({ page }, testInfo) => {
for (let i = 0; i < 100; i++)
await testInfo.attach('spacer', { body: 'content' });
await test.step('step', async () => {
testInfo.attachments.push({ name: 'attachment', body: 'content', contentType: 'text/plain' });
})
});
`,
}, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });
expect(result.exitCode).toBe(0);
await showReport();
await page.getByRole('link', { name: 'passing' }).click();
const attachment = page.getByText('attachment', { exact: true });
await expect(attachment).not.toBeInViewport();
await page.getByLabel('step').getByTitle('link to attachment').click();
await expect(attachment).toBeInViewport();
});
test('should highlight textual diff', async ({ runInlineTest, showReport, page }) => { test('should highlight textual diff', async ({ runInlineTest, showReport, page }) => {
const result = await runInlineTest({ const result = await runInlineTest({
'helper.ts': ` 'helper.ts': `