{"repo":"karlhorky/playwright-tricks","free":true,"listed":false,"github":"https://github.com/karlhorky/playwright-tricks","clone":"git clone https://github.com/karlhorky/playwright-tricks.git","description":"A collection of helpful tricks for Playwright tests","language":null,"stars":14,"topics":["playwright","testing"],"license":null,"category":"scrapers-browser-automation","readme_excerpt":"Playwright Tricks A collection of helpful tricks for Playwright tests Fail test on internal server error, thrown errors, console.log() , console.error() Playwright by default will ignore responses with HTTP 500 Internal Server Error, any JavaScript thrown errors on the webpage and usage of console.log() and console.error() (see Playwright issue #27277) To make tested applications more robust, fail the currently running test by creating and using a throwOnErrorsOrConsoleLogging() function: util/playwright.ts To use the function, import the function and call it at the top of your test: To disable errors for a specific path or URL, pass in the arrays ignoredErrors or ignoredConsoleMessages (or adjust them in util/playwright.ts ): Example Playwright logs after failure: Fail test on webServer stderr By default, Playwright will pipe any stderr output from any server configured in webServer to the process stdout, to show errors in the Playwright logs. However, often stderr from a server indicates some problem which should be investigated and fixed. One way of achieving this is to fail the currently running test upon any stderr output from the server, as proposed in Playwright issue #38001. Until Playwright implements a first-class solution for this, failing the currently running test on stderr output from a server can be achieved in many cases by creating a wrapper script exit-on-stderr.ts which will exit the server on any stderr output: exit-on-stderr.ts Create the script above, ma","default_branch":null,"files":null,"tree":[],"storefront":"/r/karlhorky","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/karlhorky/playwright-tricks/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}