Playwright · Middle · Question 28 of 75

How do you attach a file or text to the test report?

Show the answer

Correct answer: await testInfo.attach('log', { body, contentType })

Explanation

Attachments such as server logs or API responses appear next to the failing test in the HTML report.

Further reading

Problem with a question

Playwright · Middle · question 28

Test yourself

Take the Playwright · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz